You are here

function groupmedia_entity_insert in Group Media 8.2

Implements hook_entity_insert().

File

./groupmedia.module, line 28
Allows to associate media content to group.

Code

function groupmedia_entity_insert(EntityInterface $entity) {

  // React only on Group Content insert, because adding other types do not add
  // group content. Group content will be available through getEntity() method.
  if ($entity instanceof GroupContentInterface) {
    \Drupal::service('groupmedia.attach_group')
      ->attach($entity);
  }
}