You are here

function hook_admin_content_notification_recipients_alter in Admin Content Notification 8.3

Allows to alter the recipients data before sending the mail.

Parameters

$value:

\Drupal\Core\Entity\EntityInterface $node:

1 invocation of hook_admin_content_notification_recipients_alter()
AdminContentNotificationService::sendMail in src/AdminContentNotificationService.php
Send Eamil.

File

./admin_content_notification.api.php, line 29
Hooks and API provided by the "Admin Content Notification" module.

Code

function hook_admin_content_notification_recipients_alter(&$recipients, EntityInterface $node) {

  // Add new recipient programmatically.
  if ($node
    ->hasField('field_your_email')) {
    $recipients = array_map('trim', explode(',', $recipients));
    $recipients[] = $node
      ->get('field_your_email')
      ->getString();
    $recipients = implode(',', $recipients);
  }
}