You are here

function groupmenu_edit_menu_form in Group Menu 7

Menu callback.

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

1 string reference to 'groupmenu_edit_menu_form'
groupmenu_menu in ./groupmenu.module
Implements hook_menu().

File

./groupmenu.pages.inc, line 51
Page callbacks for groupmenu.

Code

function groupmenu_edit_menu_form($form, &$form_state, $type, $gid, $menu = array()) {
  module_load_include('inc', 'menu', 'menu.admin');
  $group = group_load($gid);
  $label = $group
    ->label();

  // Set the title of the page.
  switch ($type) {
    case 'add':
      drupal_set_title(t('Add menu for @title', array(
        '@title' => $label,
      )), PASS_THROUGH);
      break;
    case 'edit':
      drupal_set_title(t('Edit menu for @title', array(
        '@title' => $label,
      )), PASS_THROUGH);
      break;
  }

  // Build the form.
  $form = array();
  $form = menu_edit_menu($form, $form_state, $type, $menu);
  $form['groupmenu_gid'] = array(
    '#type' => 'value',
    '#value' => $gid,
  );
  if ($type == 'edit') {
    $form['groupmenu_name'] = array(
      '#type' => 'value',
      '#value' => $menu['menu_name'],
    );
  }

  // Add submit handlers.
  $form['#submit'][] = 'menu_edit_menu_submit';
  $form['#submit'][] = 'groupmenu_edit_menu_form_submit';
  $form['#submit'][] = 'groupmenu_edit_menu_form_submit_redirect';
  $form['actions']['delete']['#submit'][0] = 'groupmenu_delete_menu_form_submit';
  return $form;
}