Skip to content

Instantly share code, notes, and snippets.

@jameswilson
Created August 7, 2014 21:09
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 jameswilson/acacac8048c915a01694 to your computer and use it in GitHub Desktop.
Save jameswilson/acacac8048c915a01694 to your computer and use it in GitHub Desktop.
Cleanup bean classes.
<?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