[Drupal 11] user_role_names() deprecated in 10.2 and removed in 11.0

Created on 5 January 2024, 6 months ago
Updated 24 May 2024, about 1 month ago

Problem/Motivation

user_role_names() has been deprecated in Drupal 10.2.0 and will be removed in Drupal 11. See user_roles() and user_role_names() are deprecated → for more details.

Line 73 in the UserMatcher.php file calls the deprecated function.

Steps to reproduce

  1. Enable this module in a Drupal 10.2.0 installation.
  2. Config Linkit plugin for a editor.
  3. An php warning message occured in the log said user_role_names() function is deprecated.

Proposed resolution

Replaced the function code with code that passes the value returned from Role::loadMultiple() to array_map() to build the option array for $form['role_restrictions']['roles'].

📌 Task
Status

Fixed

Version

7.0

Component

Code

Created by

🇦🇺Australia Mingsong 🇦🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024