Last active
October 24, 2016 11:40
-
-
Save normanlolx/ddc667c90c9c8e01efd3e0b70d5bf2cc to your computer and use it in GitHub Desktop.
Add class to paragraph
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 | |
if ($paragraph->getType() == 'teaser') { | |
$alignment = 'left'; | |
if ($paragraph->get('field_paragraphs_align')->first() !== NULL) { | |
$alignment = $paragraph->get('field_paragraphs_align')->first()->getString(); | |
} | |
$variables['attributes']['class'][] = $alignment; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment