문제

I see that from admin/config/content/formats/plain_text I can not disable it for a individual role. How can I do this?

UPDATE: I can change the attributes of the format and rename it, however I see no way to change the machine name of the format. It should be a better way to achieve this.

도움이 되었습니까?

해결책

The "Plain text" input format cannot be disabled for any role. Even if you disable the permission to use the plain text format for a role, users with that role will be able to use the plain text format.

To allow all users to use the full HTML format, you need to:

  • disable all the input format, except the plain text format (which is the only one you cannot disable), in admin/config/content/formats
  • rename the plain text format in "HTML." You cannot rename it "Full HTML," or "full HTML" as Drupal will report you that a input format with that name already exists.
  • change the settings for the input format as shown in the following screenshots, which show the settings before and after the changes.

before

after

(PHP evaluator will be visible only when the PHP filter module is enabled.)

You can also disable the "Convert line breaks into HTML" filter, if you want. In that case, the new line characters will not converted in <br /> tags, and the text will not be wrapped in <p> tags. I would also disable the "Convert URLs into links" filter, which is the filter that changes texts like http://example.com in http://example.com (as it is done in SE sites). I would keep enabled the "Correct faulty and chopped off HTML" filter, which is the filter that fixes the missing closing tags; this avoids that a user can mess with the HTML layout of your site by leaving out a closing tag, such as </b> that would render all the page in bold, or </table> that would seriously mess-up the layout of the page.

To notice that the disabled input formats will not be visible anymore in the settings page, but the "filter_format" table will still contain the data about those input formats; that is the reason you cannot rename the "Plain Text" format as "Full HTML." That database table is also the table that you need to alter, if you want to change the machine name of the input format; in that case, I would first delete the rows for the input formats you don't need.

다른 팁

Better Formats module will allow you to select the default input format per role, and disable the formats selection part of the node edit form http://drupal.org/project/better_formats

The "Plain text" input format cannot be disabled for any role. Even if you disable the permission to use the plain text format for a role, users with that role will be able to use the plain text format.

I have just had to deal with this particular issue. It is actually a little more subtle than that: all Drupal asks for is a fallback format, which is usable by any role. The good news is you can change it (see function filter_fallback_format()), so that you could set filter_fallback_format to filtered_html in the variable table.

Drupal requires a single format to be available for all roles. This is called plain text by default, but can be modifying to function like any format you could create.

The default text input is configurable as well.
Instead of creating two input formats (i.e. Filtered HTML and Plain Text) you can just rename the default input format and uncheck the HTML to plain text conversion.

By enabling the filters for Plain text on admin/config/content/formats/plain_text you can make Plain text to Full HTML as default. And if still you require a Plain text field then you must create one text format and disable all the filters to use it as Plain text format.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 drupal.stackexchange
scroll top