You are here

protected function ScheduleEmailWebformHandler::unscheduleMessage in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_scheduled_email/src/Plugin/WebformHandler/ScheduleEmailWebformHandler.php \Drupal\webform_scheduled_email\Plugin\WebformHandler\ScheduleEmailWebformHandler::unscheduleMessage()

Unschedule the sending of an email.

Parameters

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

2 calls to ScheduleEmailWebformHandler::unscheduleMessage()
ScheduleEmailWebformHandler::postDelete in modules/webform_scheduled_email/src/Plugin/WebformHandler/ScheduleEmailWebformHandler.php
Acts on deleted a webform submission before the delete hook is invoked.
ScheduleEmailWebformHandler::postSave in modules/webform_scheduled_email/src/Plugin/WebformHandler/ScheduleEmailWebformHandler.php
Acts on a saved webform submission before the insert or update hook is invoked.

File

modules/webform_scheduled_email/src/Plugin/WebformHandler/ScheduleEmailWebformHandler.php, line 485

Class

ScheduleEmailWebformHandler
Schedules a webform submission's email.

Namespace

Drupal\webform_scheduled_email\Plugin\WebformHandler

Code

protected function unscheduleMessage(WebformSubmissionInterface $webform_submission) {
  if ($this->scheduledEmailManager
    ->hasScheduledEmail($webform_submission, $this
    ->getHandlerId())) {
    $this->scheduledEmailManager
      ->unschedule($webform_submission, $this
      ->getHandlerId());
    if ($this->configuration['debug']) {
      $t_args = [
        '%submission' => $webform_submission
          ->label(),
        '%handler' => $this
          ->label(),
      ];
      $this
        ->messenger()
        ->addWarning($this
        ->t('%submission: Email <b>unscheduled</b> for %handler handler.', $t_args), TRUE);
    }
  }
}