Created
September 2, 2014 12:22
-
-
Save pustynnykh/b2200476de28a9b8e84e to your computer and use it in GitHub Desktop.
Remove text format selection from node creating page
This file contains 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 | |
/** | |
* Remove text format selection from node creating page | |
* Implements of hook_element_info_alter(). | |
*/ | |
function YOURTHEME_element_info_alter(&$type) { | |
// Our process callback must run immediately after filter_process_format(). | |
$filter_process_format_location = array_search('filter_process_format', $type['text_format']['#process']); | |
$replacement = array('filter_process_format', 'YOURTHEME_filter_process_format'); | |
array_splice($type['text_format']['#process'], $filter_process_format_location, 1, $replacement); | |
} | |
/** | |
* Process callback for form elements that have a text format selector attached. | |
* | |
* This callback runs after filter_process_format() and performs additional | |
* modifications to the form element. | |
* | |
* @see filter_process_format() | |
*/ | |
function YOURTHEME_filter_process_format($element) { | |
$element['format']['format']['#access'] = FALSE; | |
$element['format']['guidelines']['#access'] = FALSE; | |
$element['format']['help']['#access'] = FALSE; | |
$element['format']['#type'] = 'container'; | |
$element['format']['#attributes']['class'][] = 'element-hidden'; | |
return $element; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment