You are here

protected function GroupMembershipLoader::wrapGroupContentEntities in Group 8

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

Wraps GroupContent entities in a GroupMembership object.

Parameters

\Drupal\group\Entity\GroupContentInterface[] $entities: An array of GroupContent entities to wrap.

Return value

\Drupal\group\GroupMembership[] A list of GroupMembership wrapper objects.

3 calls to GroupMembershipLoader::wrapGroupContentEntities()
GroupMembershipLoader::load in src/GroupMembershipLoader.php
Loads a membership by group and user.
GroupMembershipLoader::loadByGroup in src/GroupMembershipLoader.php
Loads all memberships for a group.
GroupMembershipLoader::loadByUser in src/GroupMembershipLoader.php
Loads all memberships for a user.

File

src/GroupMembershipLoader.php, line 69

Class

GroupMembershipLoader
Loader for wrapped GroupContent entities using the 'group_membership' plugin.

Namespace

Drupal\group

Code

protected function wrapGroupContentEntities($entities) {
  $group_memberships = [];
  foreach ($entities as $group_content) {
    $group_memberships[] = new GroupMembership($group_content);
  }
  return $group_memberships;
}