t('Advanced options'), '#type' => 'fieldset', '#collapsible' => true, '#collapsed' => (($type & MENU_VISIBLE_IN_TREE) > 0) && (($type & MENU_VISIBLE_IN_BREADCRUMB) > 0), '#weight' => 1, '#tree' => false, ); $form['menu']['options']['tree'] = array( '#type' => 'checkbox', '#title' => t('Visible in tree views') . ((($type & MENU_VISIBLE_IN_TREE) <= 0) ? ' ' . t('(currently invisible)') : ''), '#default_value' => TRUE, '#description' => t('Defines whether the menu item should be visible in tree views. (Affects the enabled/disabled option directly)'), ); $form['menu']['options']['breadcrumb'] = array( '#type' => 'checkbox', '#title' => t('Visible in breadcrumbs'), '#default_value' => ($type & MENU_VISIBLE_IN_BREADCRUMB) > 0, '#description' => t('Defines whether the menu item should be shown in breadcrumbs.'), ); $form['#submit'][] = 'advanced_menu_edit_item_submit'; } /** * Validate the additional fields and merge them into $form_state['values']['type'] */ function advanced_menu_edit_item_submit($form, &$form_state) { die(var_dump($form_state)); if ($form_state['values']['tree']) { $form_state['values']['menu']['hidden'] = 0; $form_state['values']['menu']['original_item']['hidden'] = 0; $form_state['values']['menu']['original_item']['type'] |= MENU_VISIBLE_IN_TREE; } else { $form_state['values']['menu']['hidden'] = 1; $form_state['values']['menu']['original_item']['hidden'] = 1; $form_state['values']['menu']['original_item']['type'] &= ~MENU_VISIBLE_IN_TREE; } if ($form_state['values']['breadcrumb']) { $form_state['values']['menu']['original_item']['type'] |= MENU_VISIBLE_IN_BREADCRUMB; } else { $form_state['values']['menu']['original_item']['type'] &= ~MENU_VISIBLE_IN_BREADCRUMB; } }