You are here

function menu_edit_menu_form in Drupal 4

Same name and namespace in other branches
  1. 5 modules/menu/menu.module \menu_edit_menu_form()

Menu callback; handle the adding/editing of a new menu.

1 string reference to 'menu_edit_menu_form'
menu_menu in modules/menu.module
Implementation of hook_menu().

File

modules/menu.module, line 304
Allows administrators to customize the site navigation menu.

Code

function menu_edit_menu_form($mid = 0) {
  if (arg(3) == 'edit') {
    if (!($item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $mid)))) {
      drupal_not_found();
      return;
    }
  }
  else {
    $item = array(
      'mid' => 0,
      'pid' => 0,
      'path' => '',
      'weight' => 0,
      'type' => MENU_CUSTOM_MENU,
    );
  }
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#default_value' => $item['title'],
    '#description' => t('The name of the menu.'),
    '#required' => TRUE,
  );
  $form['mid'] = array(
    '#type' => 'value',
    '#value' => $item['mid'],
  );
  $form['pid'] = array(
    '#type' => 'value',
    '#value' => $item['pid'],
  );
  $form['path'] = array(
    '#type' => 'value',
    '#value' => $item['path'],
  );
  $form['weight'] = array(
    '#type' => 'value',
    '#value' => $item['weight'],
  );
  $form['type'] = array(
    '#type' => 'value',
    '#value' => $item['type'],
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );

  // Reuse the submit function of menu_edit_item_form.
  return drupal_get_form('menu_edit_menu_form', $form, 'menu_edit_item_form');
}