user_role_names function is deprecated in Drupal 10.2

Created on 6 April 2024, 3 months ago
Updated 24 April 2024, 2 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.69.0 2024