Skip to content

Instantly share code, notes, and snippets.

@marcusx
Created December 11, 2013 10:57
Show Gist options
  • Save marcusx/7908499 to your computer and use it in GitHub Desktop.
Save marcusx/7908499 to your computer and use it in GitHub Desktop.
How to add a class around.
function hook_preprocess_entity(&$variables) {
if ($variables['content_element']->type == 'tour_item') {
$content_element_wrapper = entity_metadata_wrapper('content_element', $variables['content_element']);
$value = $content_element_wrapper->field_text_position->value();
// Add some class to the tour item wrapper. Decide dependent on the value above.
$variables['classes_array'][] = 'text-left';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment