Problem/Motivation
Drupal user_role_names() function is deprecated in Drupal 10.2.0 and will be removed in Drupal 11.
See the change log for more details.
https://www.drupal.org/node/3349759
The deprecated function is called in the following places.
- https://git.drupalcode.org/project/webform/-/blob/6.2.x/src/Plugin/Webfo...
- https://git.drupalcode.org/project/webform/-/blob/6.2.x/src/Element/Webf...
- https://git.drupalcode.org/project/webform/-/blob/6.2.x/webform.tokens.i...
Steps to reproduce
- Enable this module in a Drupal 10.2.0 installation.
- Create a Webform.
- Config the email handler for this Webform.
- Or use token for this Webform.
- An PHP warning message occured in the logs said 'the user_role_names() deprecated in 10.2 and removed in 11.0'.
Proposed resolution
Replaced with array_map() withing result of Role::loadMultiple().
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 8-3412458.patch | 3.56 KB | samir_shukla |
Issue fork webform-3412458
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mingsongComment #3
atul_ghate commentedI will work on this issue.
Comment #4
atul_ghate commentedComment #5
samir_shuklaHi, I have created patch for the issue. Please review.
Comment #6
samir_shuklaComment #7
samir_shuklaHi, there was few more change to be done, so attached new patch for that. Sorry for the inconvenience. Please review this patch
Comment #8
liam morlandInstead of having the code three times, perhaps there should be a function which does the
array_map(), etc.Comment #10
jrockowitz commentedSince we need this code in 3 places, we should create a reusable helper method.
Comment #12
jrockowitz commentedComment #14
jrockowitz commented