function user_role_load

Same name in other branches
  1. 7.x modules/user/user.module \user_role_load()

Fetches a user role by role ID.

Parameters

string $rid: A string representing the role ID.

Return value

\Drupal\user\RoleInterface|null A fully-loaded role object if a role with the given ID exists, or NULL otherwise.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\user\Entity\Role::load().

File

core/modules/user/user.module, line 1170

Code

function user_role_load($rid) {
    return Role::load($rid);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.