Quick tip on showing the one menu field not displayed in the node edit form. If you want to display a field for hiding a menu item for a particular node you need to create a form_alter hook.
In this hook you simply create a field named "hidden" using the standard form api underneath the "menu" fieldgroup. And that's it. No submit handler needs to be added or changed. The existing submit handler already handles saving the hidden field if it is available.
/**
* Implementation of hook_form_alter
*/
function custom_menu_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['#node']) && $form['#node->type .'_node_form' == $form_id) {
$item = $form['#node']->menu;
$form['menu']['hidden'] = array(
'#type' => 'checkbox',
'#title' => t('Hidden'),
'#default_value' => $item['hidden'],
'#description' => t('Menu items that are hidden will not be listed in any menu.'),
);
}
}
Need a fresh perspective on a tough project?
Let’s talk about how RDG can help.