protected function ActionWebformHandler::executeAction in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformHandler/ActionWebformHandler.php \Drupal\webform\Plugin\WebformHandler\ActionWebformHandler::executeAction()
Execute this action.
Parameters
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
1 call to ActionWebformHandler::executeAction()
- ActionWebformHandler::postSave in src/
Plugin/ WebformHandler/ ActionWebformHandler.php - Acts on a saved webform submission before the insert or update hook is invoked.
File
- src/
Plugin/ WebformHandler/ ActionWebformHandler.php, line 272
Class
- ActionWebformHandler
- Webform submission action handler.
Namespace
Drupal\webform\Plugin\WebformHandlerCode
protected function executeAction(WebformSubmissionInterface $webform_submission) {
// Set sticky.
if ($this->configuration['sticky'] !== NULL) {
$webform_submission
->setSticky($this->configuration['sticky']);
}
// Set locked.
if ($this->configuration['locked'] !== NULL) {
$webform_submission
->setLocked($this->configuration['locked']);
}
// Append notes.
if ($this->configuration['notes']) {
$notes = rtrim($webform_submission
->getNotes());
$notes .= ($notes ? PHP_EOL . PHP_EOL : '') . $this
->replaceTokens($this->configuration['notes'], $webform_submission);
$webform_submission
->setNotes($notes);
}
// Set data.
if ($this->configuration['data']) {
$data = Yaml::decode($this->configuration['data']);
$data = $this
->replaceTokens($data, $webform_submission);
foreach ($data as $key => $value) {
$webform_submission
->setElementData($key, $value);
}
}
// Display message.
if ($this->configuration['message']) {
$message = WebformHtmlEditor::checkMarkup($this
->replaceTokens($this->configuration['message'], $webform_submission));
$message_type = $this->configuration['message_type'];
$this
->messenger()
->addMessage($this->renderer
->renderPlain($message), $message_type);
}
// Resave the webform submission without trigger any hooks or handlers.
$webform_submission
->resave();
// Display debugging information about the current action.
$this
->displayDebug($webform_submission);
}