function admin_get_settings in Admin 6.2
Same name and namespace in other branches
- 7.2 admin.module \admin_get_settings()
Get variable settings or fallback to defaults.
6 calls to admin_get_settings()
- admin_footer in ./
admin.module - Implementation of hook_footer().
- admin_preprocess_page in ./
admin.module - Implementation of hook_preprocess_page().
- admin_settings_form in ./
admin.admin.inc - System settings form for admin toolbar.
- admin_set_admin_blocks in ./
admin.module - Set static cache for blocks enabled for the admin toolbar.
- template_preprocess_admin_panes in theme/
theme.inc - Theme function for form API element '#type' => 'admin_panes'.
File
- ./
admin.module, line 312
Code
function admin_get_settings($key = NULL) {
static $settings;
if (!isset($settings)) {
// Try to gather what information we can from the cookie.
// Note that this information should not be trusted in any
// way for affecting *anything* but trivial changes to the site.
$cookie = array();
if (isset($_REQUEST['DrupalAdminToolbar'])) {
parse_str($_REQUEST['DrupalAdminToolbar'], $cookie);
}
$settings = variable_get('admin_toolbar', array()) + array(
'layout' => 'vertical',
'position' => 'nw',
'behavior' => 'df',
'blocks' => admin_get_default_blocks(),
'expanded' => isset($cookie['expanded']) ? check_plain($cookie['expanded']) : 0,
'active_tab' => isset($cookie['activeTab']) ? check_plain($cookie['activeTab']) : 0,
);
// Ensure that if behavior is set to autohide the toolbar is collapsed.
if ($settings['behavior'] === 'ah') {
$settings['expanded'] = 0;
}
}
if (isset($key)) {
return isset($settings[$key]) ? $settings[$key] : FALSE;
}
return $settings;
}