You are here

public function WebformSubmissionResendForm::submitForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Form/WebformSubmissionResendForm.php \Drupal\webform\Form\WebformSubmissionResendForm::submitForm()

Form submission 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.

Overrides FormInterface::submitForm

File

src/Form/WebformSubmissionResendForm.php, line 153

Class

WebformSubmissionResendForm
Defines a webform that resends webform submission.

Namespace

Drupal\webform\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $params = $form_state
    ->getValue('message');

  // Add webform submission.
  $params['webform_submission'] = $this->webformSubmission;
  $message_handler_id = $form_state
    ->getValue('message_handler_id');
  $message_handler = $this->webformSubmission
    ->getWebform()
    ->getHandler($message_handler_id);
  $message_handler
    ->sendMessage($this->webformSubmission, $params);
  $t_args = [
    '%label' => $message_handler
      ->label(),
  ];
  $this
    ->messenger()
    ->addStatus($this
    ->t('Successfully re-sent %label.', $t_args));
}