You are here

function menu_edit_menu in Drupal 6

Same name and namespace in other branches
  1. 7 modules/menu/menu.admin.inc \menu_edit_menu()

Menu callback; Build the form that handles the adding/editing of a custom menu.

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

File

modules/menu/menu.admin.inc, line 395
Administrative page callbacks for menu module.

Code

function menu_edit_menu(&$form_state, $type, $menu = array()) {
  if ($type == 'edit') {
    $form['menu_name'] = array(
      '#type' => 'value',
      '#value' => $menu['menu_name'],
    );
    $form['#insert'] = FALSE;
    $form['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
      '#access' => !in_array($menu['menu_name'], menu_list_system_menus()),
      '#submit' => array(
        'menu_custom_delete_submit',
      ),
      '#weight' => 10,
    );
  }
  else {
    $menu = array(
      'menu_name' => '',
      'title' => '',
      'description' => '',
    );
    $form['menu_name'] = array(
      '#type' => 'textfield',
      '#title' => t('Menu name'),
      '#maxlength' => MENU_MAX_MENU_NAME_LENGTH_UI,
      '#description' => t('The machine-readable name of this menu. This text will be used for constructing the URL of the <em>menu overview</em> page for this menu. This name must contain only lowercase letters, numbers, and hyphens, and must be unique.'),
      '#required' => TRUE,
    );
    $form['#insert'] = TRUE;
  }
  $form['#title'] = $menu['title'];
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#default_value' => $menu['title'],
    '#required' => TRUE,
  );
  $form['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#default_value' => $menu['description'],
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}