You are here

function menu_edit_menu_form in Drupal 5

Same name and namespace in other branches
  1. 4 modules/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/menu.module
Implementation of hook_menu().

File

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

Code

function menu_edit_menu_form($type, $mid = 0) {
  if ($type == '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.
  $form['#base'] = 'menu_edit_item_form';
  return $form;
}