1 admin_bar.inc admin_bar_theme_settings()

Form builder function for module settings.

File

core/modules/admin_bar/admin_bar.inc, line 787
Menu builder functions for Administration bar.

Code

function admin_bar_theme_settings() {
  $config = config('admin_bar.settings');
  $form['#config'] = 'admin_bar.settings';
  $form['margin_top'] = array(
    '#type' => 'checkbox',
    '#title' => t('Adjust top margin'),
    '#default_value' => $config->get('margin_top'),
    '#description' => t('Shifts the entire site content down to make room for the administration bar. If disabled, absolute- or fixed-positioned page elements may be covered by the administration bar.'),
  );
  $form['position_fixed'] = array(
    '#type' => 'checkbox',
    '#title' => t('Keep bar at top of page'),
    '#default_value' => $config->get('position_fixed'),
    '#description' => t('Displays the administration bar always at the top of the browser viewport, even when scrolling the page.'),
  );

  $form['components'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Enabled components'),
    '#options' => array(
      'admin_bar.icon' => t('Icon menu'),
      'admin_bar.back_to_site_link' => t('Back to site link'),
      'admin_bar.menu' => t('Management menu'),
      'admin_bar.search' => t('Search bar'),
      'admin_bar.page' => t('Page links'),
      'admin_bar.users' => t('User counts'),
      'admin_bar.account' => t('Account links'),
      'admin_bar.locale' => t('Language switcher'),
    ),
    '#default_value' => $config->get('components'),
    '#description' => t('These features will be enabled/visible in the administration bar. Untick the boxes to disable/hide them.'),
    'admin_bar.back_to_site_link' => array(
      '#states' => array(
        'visible' => array(
          ':input[name="components[admin_bar.icon]"]' => array('checked' => TRUE),
        ),
      ),
    ),
    'admin_bar.search' => array(
      '#states' => array(
        'visible' => array(
          ':input[name="components[admin_bar.menu]"]' => array('checked' => TRUE),
        ),
      ),
    ),
    'admin_bar.locale' => array(
      '#disabled' => !module_exists('locale'),
    ),
  );

  $form['components']['admin_bar.icon']['#description'] = t('A specialized menu that links to the home page and provides links to perform various other admin tasks (e.g.: clear caches, run cron, etc.).');
  $form['components']['admin_bar.back_to_site_link']['#description'] = t('Replaces the "Home" link with a "Back to site" link that returns to the last non-admin page visited.');
  $form['components']['admin_bar.menu']['#description'] = t('Displays the various administrative menu options in the admin bar.');
  $form['components']['admin_bar.search']['#description'] = t('A search box for quickly finding specific items in the Administration Menu.');
  $form['components']['admin_bar.page']['#description'] = t('Links to edit items that make up the current page (e.g. layout, theme).');
  $form['components']['admin_bar.users']['#description'] = t('A count of the people currently logged into the site.');
  $form['components']['admin_bar.account']['#description'] = t('Links to view and log out of the current user account.');
  $language_switcher_description = t('Links to switch the language of the user interface.');
  if (!(module_exists('locale'))) {
    if (user_access('administer modules')) {
      $language_switcher_description .= ' ' . t('This option is available only when the <a href="@link">Locale module</a> is enabled.', array('@link' => url('admin/modules', array('query' => array('search' => 'locale')))));
    }
    else {
      $language_switcher_description .= ' ' . t('This option is available only when the Locale module is enabled.');
    }

  }
  $form['components']['admin_bar.locale']['#description'] = $language_switcher_description;

  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );

  $form['#submit'] = array('admin_bar_theme_settings_submit');
  return system_settings_form($form);
}