Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DanLaufer/e298835dfc6d523cc05ef56db0c3c197 to your computer and use it in GitHub Desktop.
Save DanLaufer/e298835dfc6d523cc05ef56db0c3c197 to your computer and use it in GitHub Desktop.
Drupal 8 - Twig - Get an Alternating Class from Paragraphs in Twig
{% set alternating_class = (_context.elements['#paragraph']._referringItem.getName()) % 2 ? ' teaser__container--inverse' : '' %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment