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.

Steps to reproduce

  1. Enable this module in a Drupal 10.2.0 installation.
  2. Create a Webform.
  3. Config the email handler for this Webform.
  4. Or use token for this Webform.
  5. 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().

CommentFileSizeAuthor
#7 8-3412458.patch3.56 KBsamir_shukla
#5 5-3412458.patch3.53 KBsamir_shukla

Issue fork webform-3412458

Command icon 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

Mingsong created an issue. See original summary.

mingsong’s picture

Issue summary: View changes
atul_ghate’s picture

Assigned: Unassigned » atul_ghate

I will work on this issue.

atul_ghate’s picture

Assigned: atul_ghate » Unassigned
samir_shukla’s picture

StatusFileSize
new3.53 KB

Hi, I have created patch for the issue. Please review.

samir_shukla’s picture

Status: Active » Needs review
samir_shukla’s picture

StatusFileSize
new3.56 KB

Hi, there was few more change to be done, so attached new patch for that. Sorry for the inconvenience. Please review this patch

liam morland’s picture

Instead of having the code three times, perhaps there should be a function which does the array_map(), etc.

jrockowitz made their first commit to this issue’s fork.

jrockowitz’s picture

Since we need this code in 3 places, we should create a reusable helper method.

jrockowitz’s picture

  • jrockowitz committed 1cf03415 on 6.2.x
    Issue #3412458 by samir_shukla, jrockowitz, Liam Morland, Mingsong,...
jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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