I'm noticing a UX issue where users viewing multi-page forms on phone-sized devices have no good way of knowing the title (and thus the purpose) of the wizard page they're currently viewing. Page titles are still present in the wizard progress bar, but hidden due to lack of space for the words to fit, so editing the form's css to reveal them at mobile widths is not a solution.

Is there a way I can access the current wizard page's title and put it in a Computed Twig to display at mobile widths so my users know what the current wizard page is all about?

I can grab the current page's key using the following code:
{{ webform_token('[webform_submission:current-page]', webform_submission) }}

But this does not return the title property of the element as one might hope:
{{ webform_token('[webform_submission:current-page:title]', webform_submission) }}

I don't see the above possibility in the Tokens list and {{ current_page }} outputs nothing. Is there another way to get to the current page's "title" property?

CommentFileSizeAuthor
#5 2941067-3.patch1.36 KBjrockowitz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nodecode created an issue. See original summary.

jrockowitz’s picture

Right now you would have to write custom code.

We should add support for a [webform_submission:current-page:title] token.

nodecode’s picture

Category: Support request » Feature request

Right on, then I'll make this a feature request.

nodecode’s picture

Title: Current wizard page title available to Computed Twig? » Add current page Title token support
jrockowitz’s picture

Status: Active » Needs review
FileSize
1.36 KB

Please review the attached patch.

  • jrockowitz committed 1a20d4d on 8.x-5.x
    Issue #2941067 by jrockowitz: Add current page Title token support
    
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download the latest dev release to review.

nodecode’s picture

Works like a charm

Status: Fixed » Closed (fixed)

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