You are here

function contact_emails_entity_insert in Contact Emails 8

Implements hook_entity_insert().

File

./contact_emails.module, line 153
Contains contact_emails.module..

Code

function contact_emails_entity_insert(EntityInterface $entity) {
  if ($entity
    ->getEntityTypeId() !== 'contact_message') {
    return;
  }
  $emailer = \Drupal::service('contact_emails.emailer');
  $emailer
    ->setContactMessage($entity);
  $emailer
    ->sendEmails();
}