Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#6 | 3189118-5.patch | 1.1 KB | jrockowitz |
| |||
#3 | 3189118-3.patch | 1.06 KB | jrockowitz |
|
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #3
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI 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.Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedIf we change the output of
[webform_submissions:state]
it will break people's existing code.Comment #5
derekw CreditAttribution: derekw commentedIn your patch I think you meant to also change $webform_submission['state:raw'] to $webform_submission['state:label'], yes?
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedYes
Comment #7
derekw CreditAttribution: derekw commentedWorks for me, using Webform 6.x for Drupal 8/9. Thank you!
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented