WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

Twig templates, and Getting variable names from twig and printing content

Submitted by barnettech on Wed, 07/10/2019 - 17:53

Twig templates https://www.drupal.org/docs/8/theming/twig/twig-template-naming-convent…

text from content:  {{ content.field_slideshow1_text1 }}
kint output:  {{ dump(_context|keys) }}
kint output:  {{ kint(items) }}

https://www.drupal.org/docs/8/theming/twig/discovering-and-inspecting-v…

PHP

$awesome_array = array(
  'a_key' => 'a_value',
  'another_key' => array(
    'foo' => 'bar',
  ),
);


Twig

{{ awesome_array.a_key }} # returns 'a_value'
{{ awesome_array.another_key.foo }} # returns 'bar'

https://sqndr.github.io/d8-theming-guide/twig/twig-basics.html

https://blog.usejournal.com/getting-drupal-8-field-values-in-twig-22b80…