Problem: webform_submissions:state tokens don't return what they should.

I use [webform_submissions:state] in my webform email subject line and I get the machine name ('raw') value instead of the state label.

  • [webform_submissions:state] : webform_token_info() description indicates it will return label but in webform_tokens() it returns raw.
  • [webform_submissions:state:raw] : webform_token_info() description indicates it will return the raw value but returns nothing because it is missing from webform_tokens()
  • [webform_submissions:state:label] is missing from webform_token_info() but included in webform_tokens()

Proposed resolution:

I would lean toward webform_submissions:state returning the label and webform_submissions:raw should return the raw value.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

derekw created an issue. See original summary.

jrockowitz’s picture

Version: 6.0.0-beta2 » 8.x-5.x-dev
jrockowitz’s picture

Status: Active » Needs review
FileSize
1.06 KB

I am inclined to just fix the descriptions and change [webform_submission:state:raw] to [webform_submission:state:label].

The [webform_submission:state:raw] is not working so it can be removed.

jrockowitz’s picture

If we change the output of [webform_submissions:state] it will break people's existing code.

derekw’s picture

In your patch I think you meant to also change $webform_submission['state:raw'] to $webform_submission['state:label'], yes?

jrockowitz’s picture

derekw’s picture

Works for me, using Webform 6.x for Drupal 8/9. Thank you!

jrockowitz’s picture

Status: Needs review » Fixed

  • jrockowitz authored 66d38af on 8.x-5.x
    Issue #3189118 by jrockowitz: webform_submission:state tokens missing/...

  • jrockowitz authored 66d38af on 6.x
    Issue #3189118 by jrockowitz: webform_submission:state tokens missing/...

Status: Fixed » Closed (fixed)

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