You are here

public static function GroupContent::loadByEntity in Group 8

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

Loads group content entities which reference a given entity.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: An entity which may be within one or more groups.

Return value

\Drupal\group\Entity\GroupContentInterface[] An array of group content entities which reference the given entity.

Overrides GroupContentInterface::loadByEntity

1 call to GroupContent::loadByEntity()
group_entity_delete in ./group.module
Implements hook_entity_delete().

File

src/Entity/GroupContent.php, line 122

Class

GroupContent
Defines the Group content entity.

Namespace

Drupal\group\Entity

Code

public static function loadByEntity(ContentEntityInterface $entity) {

  /** @var \Drupal\group\Entity\Storage\GroupContentStorageInterface $storage */
  $storage = \Drupal::entityTypeManager()
    ->getStorage('group_content');
  return $storage
    ->loadByEntity($entity);
}