Skip to content

Instantly share code, notes, and snippets.

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 markconroy/e231d5d337a99f4c3a7bbd868ba389de to your computer and use it in GitHub Desktop.
Save markconroy/e231d5d337a99f4c3a7bbd868ba389de to your computer and use it in GitHub Desktop.
/**
* Implements hook_preprocess_HOOK() for paragraph--para-image-text.html.twig.
*/
function THEME_preprocess_paragraph__para_image_with_text(&$variables) {
$paragraph = $variables['paragraph'];
// Get the value of the image style and add it as a class on the image field.
$style_image = $paragraph->get('field_para_image_with_text_float')->value;
$variables['attributes']['class'][] = $style_image;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment