1 admin_bar.inc admin_bar_theme_settings()

Form builder function for module settings.


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


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'),
    '#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),

  $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.');

  $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);