public static function OgRole::loadByGroupAndName in Organic groups 8
Returns the role represented by the given group and role name.
Parameters
\Drupal\Core\Entity\EntityInterface $group: The group for which to return the role.
string $name: The role name for which to return the role.
Return value
\Drupal\og\OgRoleInterface The role.
Overrides OgRoleInterface::loadByGroupAndName
6 calls to OgRole::loadByGroupAndName()
- GroupLevelAccessTest::setUp in tests/
src/ Kernel/ Access/ GroupLevelAccessTest.php - GroupLevelAccessTest::testUserAccessArbitraryPermissions in tests/
src/ Kernel/ Access/ GroupLevelAccessTest.php - Test access to an arbitrary permission.
- OgAccess::userAccess in src/
OgAccess.php - Determines whether a user has a group permission in a given group.
- OgGroupContentOperationAccessTest::setUp in tests/
src/ Kernel/ Access/ OgGroupContentOperationAccessTest.php - OgMembershipTest::testSaveMembershipWithInvalidRoles in tests/
src/ Kernel/ Entity/ OgMembershipTest.php - Tests an exception is thrown when saving a membership with invalid roles.
File
- src/
Entity/ OgRole.php, line 167
Class
- OgRole
- Defines the OG user role entity class.
Namespace
Drupal\og\EntityCode
public static function loadByGroupAndName(EntityInterface $group, $name) {
$role_id = "{$group->getEntityTypeId()}-{$group->bundle()}-{$name}";
return self::load($role_id);
}