You are here

function bigmenu_form_alter in Big Menu 6

Add our own option into the menu management box of the node edit form

hook_form_alter()

ISSUE: I don't know how to stop the normal node edit form menu form_alter() from running each time (and loading all the options each time) even though I'm planning to override it. There could be a performance issue there.

File

./bigmenu.module, line 98
alternative to core menu management

Code

function bigmenu_form_alter(&$form, $form_state, $form_id) {

  // Only add this util if the switch is on. Currently no UI, currently unfinished
  if (!variable_get('bigmenu_alter_node_form', FALSE)) {
    return;
  }
  if (isset($form['#node']) && $form['#node']->type . '_node_form' == $form_id) {
    $item = $form['#node']->menu;
    if ($item['mlid']) {

      // There is an existing link.
    }
    $form['menu']['bigmenu_url'] = array(
      '#type' => 'textfield',
      '#title' => t('Menu parent path'),
      '#description' => t('Enter just the URL or path of your desired menu parent.'),
      '#autocomplete_path' => 'admin/build/bigmenu/alias_autocomplete',
    );
  }
}