Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi. im trying to use view-mode slected to create some classes in body, but the code dont work and may be display suite is in game. So let me explain the problem
if do something like:
function mytheme_preprocess_html(&$variables) {
if ($variables['view_mode'] != 'teaser' ) {
$variables['classes_array'][]="nodeg-" . $variables['view_mode'];
}
}
The nodeg- create a new class.
But if I try to use a view mode create in display suite like:
function mytheme_preprocess_html(&$variables) {
if ($variables['view_mode'] == 'viewmode_displaysuite' ) {
$variables['classes_array'][]="nodeg-" . $variables['view_mode'];
}
}
Nothing happen. Like if there is no view mode selected. Only occurs with view mode create with display suite.
Any idea about it?
Comments