You are here

public function WebformEntitySettingsConfirmationForm::buildForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/EntitySettings/WebformEntitySettingsConfirmationForm.php \Drupal\webform\EntitySettings\WebformEntitySettingsConfirmationForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides EntityForm::buildForm

File

src/EntitySettings/WebformEntitySettingsConfirmationForm.php, line 33

Class

WebformEntitySettingsConfirmationForm
Webform confirmation settings.

Namespace

Drupal\webform\EntitySettings

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\webform\WebformInterface $webform */
  $webform = $this->entity;
  $elements = $webform
    ->getElementsDecoded();
  if (!empty($elements['#method'])) {
    $this
      ->messenger()
      ->addWarning($this
      ->t('Form is being posted using a custom method. Confirmation page must be handled by the <a href=":href">custom form action</a>.', [
      ':href' => $webform
        ->toUrl('settings-form')
        ->toString(),
    ]));
    return $form;
  }
  return parent::buildForm($form, $form_state);
}