You are here

function social_album_post_insert in Open Social 10.1.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_album/social_album.module \social_album_post_insert()
  2. 10.0.x modules/social_features/social_album/social_album.module \social_album_post_insert()
  3. 10.2.x modules/social_features/social_album/social_album.module \social_album_post_insert()

Implements hook_ENTITY_TYPE_insert().

File

modules/social_features/social_album/social_album.module, line 178
The Social Album module.

Code

function social_album_post_insert(EntityInterface $entity) {

  /** @var \Drupal\social_post\Entity\PostInterface $entity */
  if ($entity
    ->bundle() === 'photo' && !$entity->field_album
    ->isEmpty()) {
    \Drupal::service('cache_tags.invalidator')
      ->invalidateTags([
      'node:' . $entity->field_album->entity
        ->id(),
      'user:' . $entity
        ->getOwnerId(),
    ]);
  }
}