Quickly hide the text select box format option in Drupal

Posted by on Oct 1, 2014 in Drupal, PHP | No Comments

Sometimes in Drupal you want to hide the text selectbox format from you user. For exemple, you have a textarea with filtered html filter and you do not want the user to see the plain-text option.

There is multiple option to do that here, but here is mine :

In a cutom module simply add this :

This allows you to hide the option for a specific field and to make exeption for particular user. Here for exemple I have hidden the choice for the field ‘my_field’ for users who do not have the permission to ‘Administer text formats and filters’.

Of course, you can add multiple field, or do it for all your fields and you can also change the user_access for some other permission (or condition).

Another solution of course is to install Simplify module 🙂