function quickbar_preprocess_page in Quickbar 6
Implementation of hook_preprocess_page().
File
- ./
quickbar.module, line 176
Code
function quickbar_preprocess_page(&$vars, $hook) {
$body_classes = array(
$vars['body_classes'],
);
// Declare initial variables.
global $user;
// Need a serialized array for default value.
$roles = unserialize(variable_get('quickbar_role_weights', ''));
if (is_array($roles)) {
// Sort roles
asort($roles);
// Loop through the roles looking for a role that matches the current users
// role and also has a menu associated with it.
foreach ($roles as $rid => $weight) {
// If the toolbar should be sticky add a sticky class to the body.
if (variable_get('quickbar_sticky_' . $rid, FALSE)) {
$body_classes[] = 'quickbar-sticky';
}
// Add the new body classes to the existing variable and
// push back into the default variable used in theme creation.
$vars['body_classes'] = implode(' ', $body_classes);
// If the user has the current role don't proceed any further
if (isset($user->roles[$rid])) {
break;
}
}
}
}