user_role_load

user_role_load($rid)

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.x, will be removed before Drupal 9.0. Use \Drupal\user\Entity\Role::load().

File

core/modules/user/user.module, line 1081
Enables the user registration and login system.

Code

function user_role_load($rid) {
  return Role::load($rid);
}
doc_Drupal
2016-10-29 09:53:19
Comments
Leave a Comment

Please login to continue.