You are here

public static function OgRole::getRoleTypeByName in Organic groups 8

Maps role names to role types.

The 'anonymous' and 'authenticated' roles should not be changed or deleted. All others are standard roles.

Parameters

string $role_name: The role name for which to return the type.

Return value

string The role type, either OgRoleInterface::ROLE_TYPE_REQUIRED or OgRoleInterface::ROLE_TYPE_STANDARD.

1 call to OgRole::getRoleTypeByName()
OgRole::isRequired in src/Entity/OgRole.php
Returns if this is a default role which is required and cannot be deleted.

File

src/Entity/OgRole.php, line 282

Class

OgRole
Defines the OG user role entity class.

Namespace

Drupal\og\Entity

Code

public static function getRoleTypeByName($role_name) {
  return in_array($role_name, [
    OgRoleInterface::ANONYMOUS,
    OgRoleInterface::AUTHENTICATED,
  ]) ? OgRoleInterface::ROLE_TYPE_REQUIRED : OgRoleInterface::ROLE_TYPE_STANDARD;
}