You are here

protected function MembershipManager::loadGroups in Organic groups 8

Loads the entities of an associative array of entity IDs.

Parameters

array[] $group_ids: An associative array of entity IDs indexed by their entity type ID.

Return value

\Drupal\Core\Entity\ContentEntityInterface[][] An associative array of entities indexed by their entity type ID.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException Thrown when the entity type definition of one or more of the passed in entity types is invalid.

\Drupal\Component\Plugin\Exception\PluginNotFoundException Thrown when one or more of the passed in entity types is not defined.

3 calls to MembershipManager::loadGroups()
MembershipManager::getGroups in src/MembershipManager.php
Returns all groups that are associated with the given group content entity.
MembershipManager::getUserGroups in src/MembershipManager.php
Returns all groups associated with the given user.
MembershipManager::getUserGroupsByRoleIds in src/MembershipManager.php
Returns an array of groups filtered by the OG roles of the user.

File

src/MembershipManager.php, line 491

Class

MembershipManager
Service for managing memberships and group content.

Namespace

Drupal\og

Code

protected function loadGroups(array $group_ids) : array {
  $groups = [];
  foreach ($group_ids as $entity_type => $ids) {
    $groups[$entity_type] = $this->entityTypeManager
      ->getStorage($entity_type)
      ->loadMultiple($ids);
  }
  return $groups;
}