You are here

function _content_moderation_notifications_check in Content Moderation Notifications 8.2

Triggers the content moderation notification system.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity object.

2 calls to _content_moderation_notifications_check()
content_moderation_notifications_entity_insert in ./content_moderation_notifications.module
Implements hook_entity_update().
content_moderation_notifications_entity_update in ./content_moderation_notifications.module
Implements hook_entity_update().

File

./content_moderation_notifications.module, line 67
Hook implementations for the content moderation notifications module.

Code

function _content_moderation_notifications_check(EntityInterface $entity) {

  /** @var \Drupal\content_moderation_notifications\NotificationInformationInterface $notification_info */
  $notification_info = Drupal::service('content_moderation_notifications.notification_information');
  $notifications = $notification_info
    ->getNotifications($entity);
  if (!empty($notifications['notifications'])) {

    /** @var \Drupal\content_moderation_notifications\NotificationInterface $notification */
    $notification = Drupal::service('content_moderation_notifications.notification');
    $notification
      ->sendNotification($notifications['entity'], $notifications['notifications']);
  }
}