Skip to content

Instantly share code, notes, and snippets.

@Greg-Boggs
Created February 19, 2014 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Greg-Boggs/9096857 to your computer and use it in GitHub Desktop.
Save Greg-Boggs/9096857 to your computer and use it in GitHub Desktop.
Add class to a view mode in a preprocess
<?php
if ($vars['view_mode'] != 'teaser') {
$view_mode = str_replace('_', '-', $vars['view_mode']);
$vars['attributes_array']['class'][] = 'node-' . $view_mode;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment