You are here

public function GroupRoleSynchronizer::getGroupRoleIdsByUserRoles in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/GroupRoleSynchronizer.php \Drupal\group\GroupRoleSynchronizer::getGroupRoleIdsByUserRoles()

Retrieves all synchronized group role IDs for a list of user roles.

Parameters

string[] $role_ids: The IDs of the user roles the group role IDs should be retrieved for.

Return value

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

Overrides GroupRoleSynchronizerInterface::getGroupRoleIdsByUserRoles

1 call to GroupRoleSynchronizer::getGroupRoleIdsByUserRoles()
GroupRoleSynchronizer::getGroupRoleIdsByUserRole in src/GroupRoleSynchronizer.php
Retrieves all synchronized group role IDs for a user role.

File

src/GroupRoleSynchronizer.php, line 86

Class

GroupRoleSynchronizer
Synchronizes user roles to group roles.

Namespace

Drupal\group

Code

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