How can I use Twig Tweak to show a token in a Webform template in Drupal 8 I have a Webform form (formerly the YAMLForm module) on which I need to show the title of the form. The template I am using is based on page.html.twig (because of twig debug suggestion) page--webform--stories-submission.html.twig.

According to the tokens listed in both in the form creation area and in admin/help/token, I have several tokens available including [webform:title], [webform:url], and [webform:id] to name a few.

When I use 

    {{ drupal_token('webform:title') }}


on my template, all that prints out on the page is [webform:title].

Just to make sure I'm doing it right, I put all of the following smack into the middle of my template:

    {{ drupal_token('current-date:long') }}
    {{ drupal_token('site:name') }}
    {{ drupal_token('webform:title') }}
    {{ drupal_token('webform:id') }}


I get this in return:

Wednesday, January 18, 2017 - 09:00 ECLKC [webform:title] [webform:id]

The first two prove that Twig Tweak is a wonderful thing, and the second two prove that I'm still not doing it right.

Can anyone recommend a next step for me? 

If I can't get Tweak working, I guess I might need to preprocess myself a variable? Kint says that my title is right there as a page variable:

'page' =&gt; array(25)
~
  '#title' =&gt; string(29) "Submit your Head Start Story!"


In that case, I think I would need to follow this advice:  How do I add a variable for a Twig template in my preprocess function?

To sum up:


Can I get Twig Tweak to show my title for me?
If not, should I use that advice about adding a variable to my template preprocess?
Currently, it looks like the Twig Tweak module's drupal_token Twig function does not support passing in the $data argument, which would contain the webform entity.

You might want to create an issue in the Twig Tweak module's issue queue.