public function DefaultRoleEvent::getRole in Organic groups 8
Returns a single default role.
Parameters
string $name: The name of the role to return.
Return value
\Drupal\og\OgRoleInterface The OgRole entity.
Throws
\InvalidArgumentException Thrown when the role with the given name does not exist.
Overrides DefaultRoleEventInterface::getRole
1 call to DefaultRoleEvent::getRole()
- DefaultRoleEvent::offsetGet in src/
Event/ DefaultRoleEvent.php
File
- src/
Event/ DefaultRoleEvent.php, line 29
Class
- DefaultRoleEvent
- Event that is fired when default roles are compiled.
Namespace
Drupal\og\EventCode
public function getRole($name) {
if (!isset($this->roles[$name])) {
throw new \InvalidArgumentException("The '{$name}' role does not exist.'");
}
return $this->roles[$name];
}