You are here

public function DefaultRoleEvent::addRoles in Organic groups 8

Adds multiple default roles.

Parameters

\Drupal\og\Entity\OgRole[] $roles: An array of OgRole entities to add. These should be unsaved entities that don't have the group entity type and bundle IDs set.

Overrides DefaultRoleEventInterface::addRoles

File

src/Event/DefaultRoleEvent.php, line 59

Class

DefaultRoleEvent
Event that is fired when default roles are compiled.

Namespace

Drupal\og\Event

Code

public function addRoles(array $roles) {
  foreach ($roles as $role) {
    $this
      ->addRole($role);
  }
}