User login

Hide the "More information about formatting options" link

Sometimes, you want to have an HTML-enabled input format, but you really don't need the "More information about formatting options" link. Too much clutter (also, in bad browsers like IE, if you go to the more info on input filters page, and click the back button is your browser, do you lose what you entered in the form?)

Possibly localization and a custom language could remove the line, but that's not the natural or best approach. The most wonderfulest Drupal hook, form_alter, is the Agaric way.

The tricky bit is that the offending sentence moves around in the $form format array, depending on what privileges the user actually has to choose input formats.

[body_filter] => Array
(
[body] => Array
(
[#type] => textarea
[#title] => Description
[#default_value] =>
[#rows] => 20
[#required] => 1
)

[format] => Array
(
[1] => Array
(
[#type] => value
[#value] => 1
[#parents] => Array
(
[0] => format
)

)

[format] => Array
(
[guidelines] => Array
(
[#title] => Formatting guidelines
[#value] =>

* Web page addresses and e-mail addresses turn into links automatically.
* Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
* Lines and paragraphs break automatically.

)

)

[2] => Array
(
[#value] =>

More information about formatting options

)

)

)

Resolution

In your implementation of hook_form_alter (probably in a custom module), for the form ID (if or switch statement) of your choice:

unset($form['body_filter']['format'][count($form['body_filter']['format']) - 1]);

UPDATE: Actually, the counting cleverness does nothing for user roles with more permissions, because these throw in a whole fieldset that throws off the count:

[#type] => fieldset
[#title] => Input format
[#collapsible] => 1
[#collapsed] => 1
[#weight] =>
...
[4] => Array
(
[#value] =>
More information about formatting options

)

Comments

language could remove the

language could remove the line, but that's not the natural or best approach. The most wonderfulest Drupal hook, form_alter, is the Agaric way.Erector Sets

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.