Adding styles to Beans

Here is an easy way to let the client choose a style for a Bean
Drupal article - Adding styles to Beans
Here is an easy way to let the client choose a style for a Bean by adding a class to it...
  1. add a select list "field_style" to the Bean.
  2. add this (or similar) preprocess function to your theme:
function MYTHEME_preprocess_entity(&$variables) {
  // I'm assuming this is where the entity type will be.
  if ($variables['elements']['#entity_type'] == 'bean') {
    // get entity from variables
    $entity = $variables['elements']['#entity'];
    // get wrapper from entity
    $entity_wrapper = entity_metadata_wrapper('bean', $entity);
    // get field value from wrapper
    $style = $entity_wrapper->field_style->value();
    // add field value as class on entity render
    $variables['classes_array'][] = 'style-' . $style;
  }
}