You are here

function og_menu_single_pane_edit_form in OG Menu Single 7

Custom edit form to allow users to enable/disable selectable content types

1 string reference to 'og_menu_single_pane_edit_form'
og_menu_single_menu.inc in plugins/content_types/og_menu_single_menu.inc

File

plugins/content_types/og_menu_single_menu.inc, line 55

Code

function og_menu_single_pane_edit_form($form, &$form_state) {
  if ($plid = og_menu_single_get_active_plid()) {
    $conf = $form_state['conf'];
    $form['settings']['og_menu_single_depth'] = array(
      '#title' => t('Depth'),
      '#type' => 'select',
      '#options' => array(
        0 => t('All'),
        1 => 1,
        2 => 2,
        3 => 3,
        4 => 4,
        5 => 5,
        6 => 6,
        7 => 7,
      ),
      '#default_value' => isset($conf['og_menu_single_depth']) ? $conf['og_menu_single_depth'] : 0,
      '#description' => t('Select how deep/how many levels of the menu to display.'),
    );
    if ($tree = og_menu_single_children_items($plid)) {
      $options = array();
      $options[OG_MENU_SINGLE_MENU_NAME . ':' . 0] = '<' . t('Full Menu') . '>';
      if (module_implements('og_menu_single_menu_parent')) {
        $options[OG_MENU_SINGLE_MENU_NAME . ':auto'] = '<' . t('Automatically Detect') . '>';
      }
      _menu_parents_recurse($tree, OG_MENU_SINGLE_MENU_NAME, '--', $options, 0, 8);
      $form['settings']['og_menu_single_parent'] = array(
        '#title' => t('Parent'),
        '#type' => 'select',
        '#options' => $options,
        '#default_value' => OG_MENU_SINGLE_MENU_NAME . ':' . (isset($conf['og_menu_single_parent']) ? $conf['og_menu_single_parent'] : 0),
        '#description' => t('Select.which parent item to display items below.'),
      );
    }
  }
  else {
    drupal_set_message(t('Unable to fetch an active group.'), 'error');
  }
  return $form;
}