12
November
When you create or edit a node there is some default option or attribute in Node Form so we can disable or hide through custom code by using following code in our custom module.
In my example trying to to through folrm_alter hook. Following code using hide URL Aliasing for the content type of Article.
function MODULENAME_form_alter(&$form, FormStateInterface $form_state, $form_id) { if ($form_id == 'node_article_edit_form' || $form_id == 'node_article_form') { $form['path']['#access'] = FALSE; } }
You can use code as requirements, following other tags are mentioned below which can be use to hide node attribute programmatically
To disable or hide Author and Revision log message in Node Form
$form['meta']['#access'] = FALSE;
To disable or hide Menu Settings in Node Form
$form['menu']['#access'] = FALSE;
To disable or hide Comment Settings in Node Form
$form['comment']['#access'] = FALSE;
To disable or hide Meta Tags in Node Form
$form['field_meta_tags']['#access'] = FALSE;
To disable or hide URL Alias in Node Form
$form['path']['#access'] = FALSE;
To disable or hide promotion Options in Node Form
$form['options']['#access'] = FALSE;
To disable or hide Authoring Information in Node Form
$form['author']['#access'] = FALSE;
To disable or hide Revision Information in Node Form
$form['revision_information']['#access'] = FALSE;
© 2023.ZedAngle. All Rights Reserved.