Skip to content

Instantly share code, notes, and snippets.

@tsi
Created October 17, 2012 19:20
Show Gist options
  • Save tsi/3907538 to your computer and use it in GitHub Desktop.
Save tsi/3907538 to your computer and use it in GitHub Desktop.
Add role based calsses to <body>
function THEME_preprocess_html(&$vars) {
if ($vars['user']) {
foreach($vars['user']->roles as $key => $role){
$vars['classes_array'][] = 'role-' . drupal_html_class($role);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment