Created
September 25, 2023 11:36
-
-
Save plepe/c860cc2f9f5d2d8d4ea35e3a31a09f91 to your computer and use it in GitHub Desktop.
Revisions
-
plepe created this gist
Sep 25, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ I couldn't find any documentation about Twig Fields using Display Suite, so I decided to create one on my own. You are very welcome to add more information. Adding a Twig field in Drupal Display Suite, you can use the following syntaxes: Render the ID of the current entity: ```twig {{ entity.id }} ``` Render the value of a text field (called 'Foo'): ```twig {{ entity.field_foo[0].value }} ``` This does not work (it will only generate "`{}`"): ```twig {{ entity.field_foo|json_encode }} ```