You are here

function groupmenu_overview_form in Group Menu 7

Form callback which shows an entire menu tree at once.

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

File

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

Code

function groupmenu_overview_form($form, &$form_state, $gid, $menu) {
  module_load_include('inc', 'menu', 'menu.admin');
  drupal_set_title(t('List items for menu !mtitle', array(
    '!mtitle' => $menu['title'],
  )), PASS_THROUGH);
  $group = group_load($gid);
  $label = $group
    ->label();

  // Set the breadcrumb.
  $breadcrumbs = array();
  $breadcrumbs[] = l(t('Home'), '/');
  $breadcrumbs[] = l($label, 'group/' . $gid);
  $breadcrumbs[] = l(t('Menus'), 'group/' . $gid . '/menus');
  drupal_set_breadcrumb($breadcrumbs);
  $form = menu_overview_form($form, $form_state, $menu);
  $form['#theme'] = 'menu_overview_form';
  $form['#empty_text'] = t('There are no menu links yet. !add_link', array(
    '!add_link' => l(t('Add link'), 'group/' . $gid . '/menus/' . $menu['menu_name'] . '/add'),
  ));
  foreach (element_children($form) as $mlid) {
    if (strstr($mlid, 'mlid:')) {
      $item = $form[$mlid]['#item'];
      $operations = array();
      $operations['edit'] = array(
        '#type' => 'link',
        '#title' => t('edit'),
        '#href' => 'group/' . $gid . '/menus/' . $menu['menu_name'] . '/item/' . $item['mlid'] . '/edit',
      );
      if ($item['module'] == 'menu' || $item['updated'] == 1) {
        $operations['delete'] = array(
          '#type' => 'link',
          '#title' => t('delete'),
          '#href' => 'group/' . $gid . '/menus/' . $menu['menu_name'] . '/item/' . $item['mlid'] . '/delete',
        );
      }
      $form[$mlid]['operations'] = $operations;
    }
  }
  return $form;
}