Last active
August 29, 2015 14:16
-
-
Save drupality/f6dcfd6e7ced762d32ae to your computer and use it in GitHub Desktop.
Example of hide text format chooser in Drupal 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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