Skip to content

Instantly share code, notes, and snippets.

@pustynnykh
Created September 2, 2014 12:22
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 pustynnykh/b2200476de28a9b8e84e to your computer and use it in GitHub Desktop.
Save pustynnykh/b2200476de28a9b8e84e to your computer and use it in GitHub Desktop.
Remove text format selection from node creating page
<?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