user_role_names function is deprecated in Drupal 10.2

Created on 6 April 2024, 9 months ago
Updated 24 April 2024, 8 months ago

Problem/Motivation

user_role_names function is deprecated in Drupal 10.2 and will be removed in Drupal 11.

Proposed resolution

Replace user_role_names() call by the following code:

$roles = Role::loadMultiple();
unset($roles[RoleInterface::ANONYMOUS_ID]);
$role_names = array_map(function ($item) {
    return $item->label();
}, $roles);

Remaining tasks

MR done, needs review.

📌 Task
Status

Fixed

Version

3.1

Component

Code

Created by

🇫🇷France mably

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024