You are here

function webmaster_menu_config_form in Webmaster menu 7

Configuration form for Webmaster menu.

1 string reference to 'webmaster_menu_config_form'
webmaster_menu_menu in ./webmaster_menu.module
Implements hook_menu().

File

./webmaster_menu.config_page.inc, line 11
Configuration page for Webmaster menu

Code

function webmaster_menu_config_form($form, &$form_state) {

  // Get menus for the menu dropdown.
  $result = db_select('menu_custom')
    ->fields('menu_custom', array(
    'menu_name',
    'title',
  ))
    ->orderBy('menu_name')
    ->execute();
  $menus = array();
  while ($record = $result
    ->fetchAssoc()) {
    $menus[$record['menu_name']] = $record['title'];
  }
  $form['menu'] = array(
    '#type' => 'select',
    '#title' => t('Menu to use for the Webmaster toolbar'),
    '#options' => $menus,
    '#default_value' => variable_get('webmaster_menu_menu', NULL),
  );
  $form['add_home'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add home link to the Webmaster toolbar'),
    '#default_value' => variable_get('webmaster_menu_add_home', TRUE),
  );
  $form['home_menu'] = array(
    '#type' => 'select',
    '#title' => t('Add menu to home link'),
    '#options' => array_merge(array(
      '_no_menu' => t('Do not add menu to home link'),
    ), $menus),
    '#default_value' => variable_get('webmaster_menu_home_menu', '_no_menu_'),
    '#states' => array(
      'invisible' => array(
        ':input[name="add_home"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  $form['add_logout'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add logout link to the Webmaster toolbar (will only show when user is logged in)'),
    '#default_value' => variable_get('webmaster_menu_add_logout', TRUE),
  );
  $form['extra_menu'] = array(
    '#type' => 'select',
    '#title' => t('Add an extra menu to the Webmaster toolbar'),
    '#options' => array_merge(array(
      '_no_menu' => t('Do not add extra menu to toolbar'),
    ), $menus),
    '#default_value' => variable_get('webmaster_menu_extra_menu', '_no_menu_'),
  );
  $form['roles'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Display the menu for the following roles:'),
    '#options' => array_map('check_plain', user_roles(FALSE)),
    '#default_value' => variable_get('webmaster_menu_roles', array()),
  );
  $form['show_root'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show for Root (User:1)'),
    '#default_value' => variable_get('webmaster_menu_show_root', FALSE),
  );
  $form['positioning'] = array(
    '#type' => 'radios',
    '#title' => t('Positioning'),
    '#options' => array(
      'relative' => t('Relative'),
      'fixed' => t('Fixed'),
    ),
    '#default_value' => variable_get('webmaster_menu_positioning', 'fixed'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  return $form;
}