5

How do I remove the input formatting options and descriptions from the comment form?

I'm not interested in a CSS and/or jquery based solution, nor am I interested in using the Better Formats module, as I am using Drupal 7 and it specifically states it is not ready for production sites (besides the fact installing a module to do this seems like overkill). I want the html sent over the wire to not have the "input format" related text at all.

Drupal drives me nuts sometimes, because some stuff that should be simple is ridiculously complex.

I've searched but no one seems to know how to do this. Here's some things I've found:

1
  • Drupal is well Drupal..
    – kratos
    Commented Mar 3, 2016 at 17:28

2 Answers 2

16

Ok found this drupal issue discussing the matter: Node and Comment Input Format fieldset is not working (I found it by searching for "edit-comment-body-und-0-format" which html id of the fieldset that contains all the input format mumbo jumbo).

At the end of this issue is a link to the following site which gives a solution: How To Remove Format Options / Guideliness From Comments Textarea in Drupal 7.

Here's the code I'm using on my site, in template.php of my theme (I'm using a zen subtheme):

function mytheme_form_comment_form_alter(&$form, &$form_state) {

  $form['comment_body']['#after_build'][] = 'mytheme_customize_comment_form';

}

function mytheme_customize_comment_form(&$form) {
  $form[LANGUAGE_NONE][0]['format']['#access'] = FALSE;
  return $form;
}

I just tried it and it does seem to be working. Woohoo!

3
  • very well. In the past I have used css on my site to hide the options
    – uwe
    Commented Jan 2, 2012 at 3:02
  • 1
    it should be noted that this (['format']['#access'] = FALSE) disables the Wysiwyg editor
    – batigolix
    Commented Jan 6, 2014 at 15:06
  • @batibolix: for me it not just disables Wysiwyg editor, it also shows warning messages like "Undefined index: format in wysiwyg_pre_render_text_format" in wysiwyg module. Removing items from #pre_render array solves my problem Commented Apr 27, 2014 at 18:18
3

Check this module https://drupal.org/project/simplify .

From the module's project page:

Simplify allows particular fields to be hidden from the user interface. This helps to de-clutter forms and present a more user-friendly experience to content editors.

Very helpful to hide unnecessary tips and text format option under RTE

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.