You are here

function activity_send_email_activity_insert in Open Social 10.0.x

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  2. 8 modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  3. 8.2 modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  4. 8.3 modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  5. 8.4 modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  6. 8.5 modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  7. 8.6 modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  8. 8.7 modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  9. 8.8 modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  10. 10.3.x modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  11. 10.1.x modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()
  12. 10.2.x modules/custom/activity_send/modules/activity_send_email/activity_send_email.module \activity_send_email_activity_insert()

Implements hook_ENTITY_TYPE_insert().

File

modules/custom/activity_send/modules/activity_send_email/activity_send_email.module, line 304
Contains activity_basics.module..

Code

function activity_send_email_activity_insert(ActivityInterface $activity) {
  if (!in_array('email', $activity
    ->getDestinations())) {
    return;
  }

  /** @var \Drupal\activity_send\Plugin\ActivitySendManager $activity_send_factory */
  $activity_send_factory = \Drupal::service('plugin.manager.activity_send.processor');

  // Trigger the create action for entities.

  /** @var \Drupal\activity_send_email\Plugin\ActivitySend\EmailActivitySend $create_action */
  $create_action = $activity_send_factory
    ->createInstance('email_activity_send');
  $create_action
    ->create($activity);
}