You are here

public function Group::getContentEntities in Group 8

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

Retrieves all group content for the group.

Unlike GroupInterface::getContent(), this function actually returns the entities that were added to the group through GroupContent entities.

Parameters

string $plugin_id: (optional) A content enabler plugin ID to filter on.

array $filters: (optional) An associative array of extra filters where the keys are property or field names and the values are the value to filter on.

Return value

\Drupal\Core\Entity\EntityInterface[] A list of entities matching the criteria. This list does not have keys that represent the entity IDs as we could have collisions that way.

Overrides GroupInterface::getContentEntities

See also

\Drupal\group\Entity\GroupInterface::getContent()

File

src/Entity/Group.php, line 177

Class

Group
Defines the Group entity.

Namespace

Drupal\group\Entity

Code

public function getContentEntities($plugin_id = NULL, $filters = []) {
  $entities = [];
  foreach ($this
    ->getContent($plugin_id, $filters) as $group_content) {
    $entities[] = $group_content
      ->getEntity();
  }
  return $entities;
}