How To Remove Format Options / Guideliness From Comments Textarea in Drupal 7
The task is very common, but in Drupal 7 you do this in a bit different way than in Drupal 6. Here’s how to remove format options from comments textarea in Drupal 7: UPD: Well, the most easiest way to do this is to install Better Formats module (http://drupal.org/project/better_formats). But do we need another module installed to do this simple thing? Me, not, so let's dig into the code a bit. Basically, we need to alter comment form.
You can do this in two ways:
- By putting your custom code into template.php file
- By putting your custom code into your custom module
It’s up to you which way to choose. If you want your changes to be applicable not only to the active theme, then choose the second option. Ok, now, depending on a way you’ve chosen, add this code to your template.php or module_name.module file:
1 2 3
Option A) If you only want to hide formatting guidelines and Filter Tips link, then add this function to the file:
1 2 3 4 5 6 7
Option B) If you want to hide all format options, then add this function to the file:
1 2 3 4
Save your file and don’t forget to clear Drupal’s cache (Configuration > Development > Performance > Clear All Caches).
That’s all for now, enjoy and happy drupalling!