You are here

public function GroupRoleSynchronizer::getGroupRoleIdsByGroupTypes in Group 8

Same name and namespace in other branches
  1. 2.0.x src/GroupRoleSynchronizer.php \Drupal\group\GroupRoleSynchronizer::getGroupRoleIdsByGroupTypes()

Retrieves all synchronized group role IDs for a list of group types.

Parameters

string[] $group_type_ids: The IDs of the group types the group role IDs should be retrieved for.

Return value

string[] The synchronized group role IDs for the given group type.

Overrides GroupRoleSynchronizerInterface::getGroupRoleIdsByGroupTypes

1 call to GroupRoleSynchronizer::getGroupRoleIdsByGroupTypes()
GroupRoleSynchronizer::getGroupRoleIdsByGroupType in src/GroupRoleSynchronizer.php
Retrieves all synchronized group role IDs for a group type.

File

src/GroupRoleSynchronizer.php, line 63

Class

GroupRoleSynchronizer
Synchronizes user roles to group roles.

Namespace

Drupal\group

Code

public function getGroupRoleIdsByGroupTypes($group_type_ids) {
  $group_role_ids = [];
  $role_ids = $this->entityTypeManager
    ->getStorage('user_role')
    ->getQuery()
    ->execute();
  foreach ($role_ids as $role_id) {
    foreach ($group_type_ids as $group_type_id) {
      $group_role_ids[] = $this
        ->getGroupRoleId($group_type_id, $role_id);
    }
  }
  return $group_role_ids;
}