Last active
December 19, 2015 22:38
-
-
Save ccamara/6028592 to your computer and use it in GitHub Desktop.
Display Suite's output modification in order to add a new class under certain circumstances #drupal #displaysuite
This file contains hidden or 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
<?php | |
/** | |
* Implements hook_theme_registry_alter(). | |
*/ | |
function feature_blog_theme_registry_alter(&$theme_registry) { | |
$theme_registry['node']['preprocess functions'][] = 'onecolumn_class_node_preprocess'; | |
} | |
/* | |
* Preprocess function for node. | |
* Added in feature_blog_theme_registry_alter() | |
*/ | |
function onecolumn_class_node_preprocess(&$vars){ | |
// If there's no content on the left column, | |
// we'll add a class to the node, for special CSS. | |
if ($vars['type'] == 'blog' && $vars['view_mode'] == 'teaser' && !$vars['left']) { | |
$vars['classes_array'][] = 'onecolumn'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have to make sure that this module is loaded the last one in order to make sure that the new preprocess function gets loaded the last one.
This can be achieved by creating the following hook_update in module's module.install file: