You are here

public function OgRoleManager::removeRoles in Organic groups 8

Deletes the roles associated with a group type.

Parameters

string $entity_type_id: The entity type ID of the group for which to delete the roles.

string $bundle_id: The bundle ID of the group for which to delete the roles.

Overrides OgRoleManagerInterface::removeRoles

File

src/OgRoleManager.php, line 169

Class

OgRoleManager
Defines a manager of an OG role.

Namespace

Drupal\og

Code

public function removeRoles($entity_type_id, $bundle_id) {
  $properties = [
    'group_type' => $entity_type_id,
    'group_bundle' => $bundle_id,
  ];
  foreach ($this
    ->ogRoleStorage()
    ->loadByProperties($properties) as $role) {
    $role
      ->delete();
  }
}