You are here

public static function OgRole::getRole in Organic groups 8

Get a role by the group's bundle and role name.

Parameters

string $entity_type_id: The group entity type ID.

string $bundle: The group bundle name.

string $role_name: The role name.

Return value

\Drupal\og\OgRoleInterface|null The OG role object, or NULL if a matching role was not found.

Overrides OgRoleInterface::getRole

11 calls to OgRole::getRole()
AccessByOgMembershipTest::setUp in tests/src/Kernel/Access/AccessByOgMembershipTest.php
AccessByOgMembershipTest::testNonMemberRoleMembershipSave in tests/src/Kernel/Access/AccessByOgMembershipTest.php
Tests exception is thrown when trying to save non-member role.
ActionTestBase::setUp in tests/src/Kernel/Action/ActionTestBase.php
GetUserGroupsTest::testGetGroupsByRoles in tests/src/Kernel/Entity/GetUserGroupsTest.php
Tests retrieval of groups filtered by roles.
GroupSubscribeFormatterTest::setUp in tests/src/Functional/GroupSubscribeFormatterTest.php

... See full list

File

src/Entity/OgRole.php, line 292

Class

OgRole
Defines the OG user role entity class.

Namespace

Drupal\og\Entity

Code

public static function getRole($entity_type_id, $bundle, $role_name) {
  return self::load($entity_type_id . '-' . $bundle . '-' . $role_name);
}