Created
January 17, 2014 20:16
-
-
Save heyMP/8480651 to your computer and use it in GitHub Desktop.
Add the View Mode to the classes_array within your entity template. This is so we can theme specific view modes so we can easily switch between different layouts for the same entity using entity view modes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function template_preprocess_entity(&$vars, $hook) { | |
// Add the View Mode class to the classes_array | |
if (isset($vars['elements']['#entity_view_mode']['view_mode'])) { | |
$view_mode = $vars['elements']['#entity_view_mode']['view_mode']; | |
$vars['classes_array'][] = 'view-mode-' . str_replace('_', '-', $view_mode); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment