Skip to content

Instantly share code, notes, and snippets.

@drupality
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drupality/f6dcfd6e7ced762d32ae to your computer and use it in GitHub Desktop.
Save drupality/f6dcfd6e7ced762d32ae to your computer and use it in GitHub Desktop.
Example of hide text format chooser in Drupal 7
<?php
/**
* Implements hook_element_info_alter().
*/
function mymodule_element_info_alter(&$type) {
if (isset($type['text_format'])) {
$type['text_format']['#process'][] = 'mymodule_process_format';
}
}
function mymodule_process_format($element) {
global $user;
//hide for all except superadmin
if ($user->uid <> 1) {
hide($element['format']);
}
return $element;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment