By Alvin Alexander. Last updated: July 29, 2017
As a quick note, the Drupal 8 Twig template ternary operator syntax looks like this:
{{ foo ? 'FOO IS TRUE' : 'FOO NOT TRUE' }}
You can test it like this in a Drupal 8 Twig template theme file if you’d like:
{% set foo = true %} {{ foo ? 'FOO IS TRUE' : 'FOO NOT TRUE' }}
That test will emit the string “FOO IS TRUE” to your web browser.
You can find more Twig information at this symfony.com page.