You are here

public function EmailYamlFormHandler::postSave in YAML Form 8

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

Parameters

\Drupal\yamlform\YamlFormSubmissionInterface $yamlform_submission: A form submission.

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

Overrides YamlFormHandlerBase::postSave

File

src/Plugin/YamlFormHandler/EmailYamlFormHandler.php, line 461

Class

EmailYamlFormHandler
Emails a form submission.

Namespace

Drupal\yamlform\Plugin\YamlFormHandler

Code

public function postSave(YamlFormSubmissionInterface $yamlform_submission, $update = TRUE) {
  $is_results_disabled = $yamlform_submission
    ->getYamlForm()
    ->getSetting('results_disabled');
  $is_completed = $yamlform_submission
    ->getState() == YamlFormSubmissionInterface::STATE_COMPLETED;
  if ($is_results_disabled || $is_completed) {
    $message = $this
      ->getMessage($yamlform_submission);
    $this
      ->sendMessage($message);
  }
}