When viewing a webform (e.g http://website.localhost/form/webform-name), I would like to display the webform's title as a page title above the form.

I was hoping to be able to achieve this by theming block.html.twig but the configuration object is populated as follows:

'id' => string(17) "system_main_block"
'label' => string(17) "Main page content"
'provider' => string(6) "system"
'label_display' => string(1) "0"

Is there a way I can access the webform's title so I can theme it on the page?

Thanks

Comments

danjordan created an issue. See original summary.

jrockowitz’s picture

Status: Active » Needs review

This is not really a Webform specific question. There are many ways to alter a page title in Drupal.

If a form is the main output on a page, you can set the $form['#title'] property. Otherwise, you will need to Google other solutions like altering the title block.

This is a good question for https://drupal.stackexchange.com/questions/tagged/webform.

Once you have solved this issue, you should give back to the community write a recipe that contains your solution.

danjordan’s picture

Thanks Jacob for the direction. The issue ended up being more generic that just a webform page title issue and was resolved by editing the page.html.twig template.

jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.