You are here

function groupmedia_paragraphs_entity_insert in Group Media 8.2

Implements hook_entity_insert().

File

modules/groupmedia_paragraphs/groupmedia_paragraphs.module, line 16
Allows to associate media content from paragraphs to group.

Code

function groupmedia_paragraphs_entity_insert(EntityInterface $entity) {

  // In addition to groupmedia_entity_insert react on paragraphs insert, because
  // it can be related to parent entity that belongs to a group.
  if ($entity instanceof ParagraphInterface) {
    \Drupal::service('groupmedia.attach_group')
      ->attach($entity);
  }
}