public function WebformSubmissionForm::confirmForm in Webform 6.x
Same name and namespace in other branches
- 8.5 src/WebformSubmissionForm.php \Drupal\webform\WebformSubmissionForm::confirmForm()
Webform confirm(ation) handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
1 call to WebformSubmissionForm::confirmForm()
- WebformSubmissionForm::wizardSubmit in src/
WebformSubmissionForm.php - Webform submission handler for the wizard submit action.
File
- src/
WebformSubmissionForm.php, line 1829
Class
- WebformSubmissionForm
- Provides a webform to collect and edit submissions.
Namespace
Drupal\webformCode
public function confirmForm(array &$form, FormStateInterface $form_state) {
$this
->setConfirmation($form_state);
/** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
$webform_submission = $this
->getEntity();
// Confirm webform via webform handler.
$this
->getWebform()
->invokeHandlers('confirmForm', $form, $form_state, $webform_submission);
// Get confirmation type and submission state.
$confirmation_type = $this
->getWebformSetting('confirmation_type');
$state = $webform_submission
->getState();
// Rebuild or reset the form if reloading the current form via AJAX.
if ($this
->isAjax()) {
// On update, rebuild and display message unless ?destination= is set.
// @see \Drupal\webform\WebformSubmissionForm::setConfirmation
if ($state === WebformSubmissionInterface::STATE_UPDATED) {
if (!$this
->getRequest()
->get('destination')) {
$this
->rebuild($form, $form_state);
}
}
elseif ($confirmation_type === WebformInterface::CONFIRMATION_MESSAGE || $confirmation_type === WebformInterface::CONFIRMATION_NONE) {
$this
->reset($form, $form_state);
}
}
// Always rebuild or reset the form to trigger a modal dialog.
if ($confirmation_type === WebformInterface::CONFIRMATION_MODAL) {
if ($state === WebformSubmissionInterface::STATE_UPDATED) {
$this
->rebuild($form, $form_state);
}
else {
$this
->reset($form, $form_state);
}
}
}