Created
August 7, 2014 21:09
-
-
Save jameswilson/acacac8048c915a01694 to your computer and use it in GitHub Desktop.
Cleanup bean classes.
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_preprocess_block(). | |
*/ | |
function mymodule_preprocess_entity(&$variables) { | |
// modify the classes on bean entities. | |
if ($variables['entity_type'] == 'bean') { | |
$variables['classes_array'] = array( | |
drupal_html_class($variables['bean']->type), | |
drupal_html_class($variables['bean']->type . '--' . $variables['bean']->delta), | |
); | |
if ($variables['view_mode'] != 'default') { | |
$variables['classes_array'][] = drupal_html_class($variables['bean']->type . '--' . $variables['view_mode']); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment