Skip to content

Instantly share code, notes, and snippets.

@jenter
Created November 29, 2016 15:12
Show Gist options
  • Save jenter/ab92f58b46ce9854f46d459c423b1ca1 to your computer and use it in GitHub Desktop.
Save jenter/ab92f58b46ce9854f46d459c423b1ca1 to your computer and use it in GitHub Desktop.
/**
* Implements hook_preprocess_html().
*/
function MYTHEME_preprocess_html(&$variables) {
// Body classes for auth roles.
if ($variables['logged_in']) {
$user_roles = user_role_names(TRUE);
foreach ($user_roles as $role => $title) {
$variables['attributes']['class'][] = Html::cleanCssIdentifier('role--' . $role);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment