You are here

function og_menu_overview_form in Organic Groups Menu (OG Menu) 7.3

Same name and namespace in other branches
  1. 6.2 og_menu.module \og_menu_overview_form()
  2. 6 og_menu.module \og_menu_overview_form()
  3. 7.2 og_menu.pages.inc \og_menu_overview_form()

Form callback which shows an entire menu tree at once.

1 string reference to 'og_menu_overview_form'
og_menu_menu in ./og_menu.module
Implements hook_menu().

File

./og_menu.pages.inc, line 194
Contains page callbacks for og_menu

Code

function og_menu_overview_form($form, &$form_state, $group_type, $gid, $menu) {
  module_load_include('inc', 'menu', 'menu.admin');
  drupal_set_title(t('List links for menu !mtitle', array(
    '!mtitle' => $menu['title'],
  )), PASS_THROUGH);

  // Set the breadcrumb.
  og_set_breadcrumb($group_type, $gid, array(
    l(t('Group'), "{$group_type}/{$gid}/group"),
  ));
  $b = drupal_get_breadcrumb();
  $b[] = l(t('Menus'), 'group/' . $group_type . '/' . $gid . '/admin/menus');
  drupal_set_breadcrumb($b);
  $form = menu_overview_form($form, $form_state, $menu);
  $form['#theme'] = 'menu_overview_form';
  $form['#empty_text'] = t('There are no menu links yet.');
  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/' . $group_type . '/' . $gid . '/admin/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/' . $group_type . '/' . $gid . '/admin/menus/' . $menu['menu_name'] . '/item/' . $item['mlid'] . '/delete',
        );
      }
      $form[$mlid]['operations'] = $operations;
    }
  }
  return $form;
}