You are here

public function ScheduleEmailWebformHandler::postSave in Webform 8.5

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

Acts on a saved webform submission before the insert or update hook is invoked.

Parameters

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

bool $update: TRUE if the entity has been updated, or FALSE if it has been inserted.

Overrides EmailWebformHandler::postSave

File

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

Class

ScheduleEmailWebformHandler
Schedules a webform submission's email.

Namespace

Drupal\webform_scheduled_email\Plugin\WebformHandler

Code

public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) {
  $state = $webform_submission
    ->getState();
  if (in_array($state, $this->configuration['states'])) {
    $this
      ->scheduleMessage($webform_submission);
  }
  elseif ($this->configuration['unschedule']) {
    $this
      ->unscheduleMessage($webform_submission);
  }
}