You are here

public function PermissionEvent::getPermission in Organic groups 8

Returns the permission with the given name.

Parameters

string $name: The name of the permission to return.

Return value

\Drupal\og\PermissionInterface The permission.

Throws

\InvalidArgumentException Thrown when the permission with the given name does not exist.

Overrides PermissionEventInterface::getPermission

1 call to PermissionEvent::getPermission()
PermissionEvent::offsetGet in src/Event/PermissionEvent.php

File

src/Event/PermissionEvent.php, line 74

Class

PermissionEvent
Event that is fired when OG permissions are compiled.

Namespace

Drupal\og\Event

Code

public function getPermission($name) {
  if (!isset($this->permissions[$name])) {
    throw new \InvalidArgumentException("The '{$name}' permission does not exist.");
  }
  return $this->permissions[$name];
}