You are here

public function EmailWebformHandler::postSave in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformHandler/EmailWebformHandler.php \Drupal\webform\Plugin\WebformHandler\EmailWebformHandler::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 WebformHandlerBase::postSave

1 method overrides EmailWebformHandler::postSave()
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

src/Plugin/WebformHandler/EmailWebformHandler.php, line 852

Class

EmailWebformHandler
Emails a webform submission.

Namespace

Drupal\webform\Plugin\WebformHandler

Code

public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) {
  $state = $webform_submission
    ->getWebform()
    ->getSetting('results_disabled') ? WebformSubmissionInterface::STATE_COMPLETED : $webform_submission
    ->getState();
  if ($this->configuration['states'] && in_array($state, $this->configuration['states'])) {
    $message = $this
      ->getMessage($webform_submission);
    $this
      ->sendMessage($webform_submission, $message);
  }
}