1 admin_bar.inc | admin_bar_theme_settings() |
Form builder function for module settings.
File
- core/
modules/ admin_bar/ admin_bar.inc, line 822 - Menu builder functions for Administration bar.
Code
function admin_bar_theme_settings() {
$config = config('admin_bar.settings');
$form['#config'] = 'admin_bar.settings';
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('Settings'),
);
$form['settings']['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['settings']['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['settings']['local_action_position'] = array(
'#type' => 'radios',
'#title' => t('Position of local action links'),
'#default_value' => $config->get('local_action_position'),
'#options' => array(
'top' => t('Top'),
'bottom' => t('Bottom'),
),
'#description' => t('Where to display local action links (e.g. "<em>Add [something]</em>") within their respective sub-menus.'),
);
$form['components'] = array(
'#type' => 'fieldset',
'#title' => t('Enabled components'),
'#description' => t('These features will be enabled/visible in the administration bar. Untick the boxes to disable/hide them.'),
'#tree' => TRUE,
);
$form['components']['options'] = array(
'#type' => 'checkboxes',
'#title' => t('Enabled components'),
'#title_display' => 'invisible',
'#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'),
'admin_bar.back_to_site_link' => array(
'#states' => array(
'visible' => array(
':input[name="components[options][admin_bar.icon]"]' => array('checked' => TRUE),
),
),
'#indentation' => 1,
),
'admin_bar.search' => array(
'#states' => array(
'visible' => array(
':input[name="components[options][admin_bar.menu]"]' => array('checked' => TRUE),
),
),
'#indentation' => 1,
),
'admin_bar.locale' => array(
'#disabled' => !module_exists('locale'),
),
);
$form['components']['options']['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']['options']['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']['options']['admin_bar.menu']['#description'] = t('Displays the various administrative menu options in the admin bar.');
$form['components']['options']['admin_bar.search']['#description'] = t('A search box for quickly finding specific items in the Administration Menu.');
$form['components']['options']['admin_bar.page']['#description'] = t('Links to edit items that make up the current page (e.g. layout, theme).');
$form['components']['options']['admin_bar.users']['#description'] = t('A count of the people currently logged into the site.');
$form['components']['options']['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']['options']['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);
}