You are here

public function Immediately::processItem in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  2. 8.2 modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  3. 8.3 modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  4. 8.4 modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  5. 8.5 modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  6. 8.6 modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  7. 8.7 modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  8. 8.8 modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  9. 10.3.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  10. 10.0.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  11. 10.1.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()
  12. 10.2.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php \Drupal\activity_send_email\Plugin\EmailFrequency\Immediately::processItem()

Processes an activity item.

Parameters

\Drupal\activity_creator\Entity\Activity $activity: The Activity object.

\Drupal\message\Entity\Message $message: The Message object.

\Drupal\user\Entity\User $target: The target user account.

Overrides EmailFrequencyBase::processItem

File

modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php, line 28

Class

Immediately
Define a concrete class for immediate emails.

Namespace

Drupal\activity_send_email\Plugin\EmailFrequency

Code

public function processItem(Activity $activity, Message $message, User $target) {

  // Continue if we have text to send and the user is currently offline.
  if (isset($activity->field_activity_output_text) && EmailActivityDestination::isUserOffline($target)) {
    $langcode = $target
      ->getPreferredLangcode();
    $body_text = EmailActivityDestination::getSendEmailOutputText($message, $langcode);
    if ($langcode && !empty($body_text)) {
      $this
        ->sendEmail($body_text, $langcode, $target);
    }
  }
}