You are here

function menu_block_split_settings in Menu Block Split 7.2

Same name and namespace in other branches
  1. 5.2 menu_block_split.module \menu_block_split_settings()
  2. 5 menu_block_split.module \menu_block_split_settings()
  3. 6.2 menu_block_split.module \menu_block_split_settings()
  4. 6 menu_block_split.module \menu_block_split_settings()

Settings form.

1 string reference to 'menu_block_split_settings'
menu_block_split_menu in ./menu_block_split.module
Implements hook_menu().

File

./menu_block_split.module, line 99
Allow a menu to be split over two blocks Developed by Robert Garrigos <robert@garrigos.cat> Modified for Drupal 6.x by Frank Meyerer <meyerer@digi-info.de> http://www.digi-info.de currently maintained by Bob Hutchinson…

Code

function menu_block_split_settings() {
  $level_options = range(0, 10);
  unset($level_options[0]);
  $form['menu_block_split_howmany'] = array(
    '#type' => 'select',
    '#title' => t('How many blocks with first level menu do you need?'),
    '#default_value' => variable_get('menu_block_split_howmany', 1),
    '#options' => $level_options,
    '#description' => t('Select how many first menu level blocks you need and click on the Save Configuration button to make the form available.'),
  );
  $menu_select_options = array();
  foreach (menu_get_menus() as $name => $title) {
    if (count(menu_navigation_links($name)) > 0) {
      $menu_select_options[$name] = $title;
    }
  }
  for ($i = 1; $i <= variable_get('menu_block_split_howmany', 1); $i++) {
    $form['menu_block_split_fieldset_' . $i] = array(
      '#type' => 'fieldset',
      '#title' => t('Menu Block Split !i', array(
        '!i' => $i,
      )),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    );
    $form['menu_block_split_fieldset_' . $i]['menu_block_split_' . $i] = array(
      '#type' => 'select',
      '#title' => t('Block!i', array(
        '!i' => $i,
      )),
      '#options' => $menu_select_options,
      '#default_value' => variable_get('menu_block_split_' . $i, ''),
      '#description' => t('Choose a block as first level menu to split.'),
    );
    $default = check_plain(variable_get('menu_block_splittitle_' . $i, ''));
    $form['menu_block_split_fieldset_' . $i]['menu_block_splittitle_' . $i] = array(
      '#type' => 'textfield',
      '#title' => t('Title !i', array(
        '!i' => $i,
      )),
      '#default_value' => $default,
      '#required' => FALSE,
      '#description' => t('Set the title of the resulting block.'),
    );
  }
  $form['#validate'][] = 'menu_block_split_settings_validate';
  return system_settings_form($form);
}