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/Motivation
The token modules includes token validation handling via token_element_validate(). The UX for entering tokens would be significantly improved if we warned users about invalid tokens.
Proposed resolution
Apply token_element_validate() to all text-based elements for all forms that support tokens,
Remaining tasks
- Add public \Drupal\webform\WebformTokenManager::elementValidate($form, $form_state, $context); which adds 'token_element_validate' to all text-based inputs.
- Add protected \Drupal\webform\WebformTokenManager::elementValidateRecursive($element, $form_state, $context); which will recursively add 'token_element_validate' to all text-based inputs.
- Apply WebformTokenManager::elementValidate() to all element, handler, setting, and configuration forms.
- Write a very basic test that confirms token validation is working correctly. This will require adding the token.module as a 'test_dependencies'
User interface changes
Token validation error message will appear if the token.module is installed and someone enters an invalid token.
Forms that now support with token validation.
/admin/structure/webform/config
/admin/structure/webform/config/submissions
/admin/structure/webform/config/handlers
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#18 | 2945037-18.patch | 11.87 KB | jrockowitz |
| |||
#16 | 2945037-16.patch | 11.65 KB | jrockowitz |
#15 | 2945037-15.patch | 595 bytes | jrockowitz |
| |||
#11 | 2945037-11.patch | 34.07 KB | jrockowitz |
| |||
#9 | 2945037-8.patch | 31.15 KB | jrockowitz |
|
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThis patch is NOT ready for manual review. I just need to confirm all the tests are passing.
Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #11
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #14
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #15
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedMinor bug fix.
Comment #16
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #18
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #20
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #21
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented