I am trying to hide Authoring information, Revision information, Publishing options tabs in create/edit node for any content type. I tried different modules with no luck. Please give me suggestions how to achieve this. Thanks a lot
5 Answers
To hide the individual options, you can use the following code in your module_form_alter() function:
$form['revision_information']['#access'] = FALSE;
$form['author']['#access'] = FALSE;
$form['options']['#access'] = FALSE;
-
thanks the ['options'] one is the one that takes away the publishing tab.– DianaAug 7, 2015 at 19:32
I usually do this with a custom module and drupal's Form API and setting #access = FALSE
for form elements I want to hide (and test it with 3rd party modules to assure it doesnt break anything).
Recently, I've been made aware of Override Node Options which does exactly this for Drupal 7/6.
-
setting access to false worked for me: in hook_form_alter:
$form['revision_information']['#access'] = false;
– FLYSep 30, 2013 at 11:33
AFAIK, Override Node Options can't disable those options, it just can enable them for users that otherwise don't have needed permissions.
There is Jammer module for removing unneeded elements from display.
-
Thanks this makes it easier and more manageable for non developers! Although the "publish" menu cannot be hidden this way? Anyway I like this solution since most users understand "published" but the other options like revision are hard for some end users. And those options can be hidden with the Jammer module :)– FLYFeb 12, 2014 at 10:40
I wrote this code which work for me
function MODULENAME_form_alter(&$form, $form_state, $form_id) {
dsm($form_id);
if ( $form_id == 'FORM_ID'){
$form['additional_settings']['#access'] = false;
}
return $form;
}
In Drupal 8, there's a core issue to make the revision fields configurable. Please help with that if possible, or use the Hide Revision Field module if not.