You are here

function og_menu_menu_overview_form in Organic Groups Menu (OG Menu) 7.3

Form for displaying and re-ordering the og menus for a group.

Shows for one menu the menu links accessible to the current user and relevant operations.

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

File

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

Code

function og_menu_menu_overview_form($form, &$form_state, $group_type, $gid) {

  // Set the title of the page.
  $entity_wrapper = entity_metadata_wrapper($group_type, $gid);
  $entity_label = $entity_wrapper
    ->label() ? $entity_wrapper
    ->label() : $group_type . ' ' . $gid;
  drupal_set_title(t('List menus for %title', array(
    '%title' => $entity_label,
  )), PASS_THROUGH);

  // Set the breadcrumb.
  og_set_breadcrumb($group_type, $gid, array(
    l(t('Group'), "{$group_type}/{$gid}/group"),
  ));
  $form['og_menus']['#group_type'] = $group_type;
  $form['og_menus']['#gid'] = $gid;
  $form['og_menus']['#tree'] = TRUE;
  foreach (og_menu_get_menus($group_type, $gid) as $menu) {
    $form['og_menus']['og_menu:' . $menu->menu_name] = array(
      'name' => array(
        '#type' => 'textfield',
        '#title' => $menu->menu_name,
        '#title_display' => $menu->title,
        '#default_value' => $menu->menu_name,
      ),
      'description' => array(
        '#type' => 'textfield',
        '#default_value' => check_plain($menu->description),
        '#size' => 20,
        '#maxlength' => 255,
      ),
      'weight' => array(
        '#type' => 'weight',
        '#title' => t('Weight'),
        '#default_value' => $menu->weight,
        '#delta' => 10,
        '#title_display' => 'invisible',
      ),
    );
  }
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions'] = array(
    '#attributes' => array(
      'class' => 'og-menu-overview',
    ),
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  return $form;
}