You are here

public function WebformDeleteFormBase::buildForm in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Form/WebformDeleteFormBase.php \Drupal\webform\Form\WebformDeleteFormBase::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 ConfirmFormBase::buildForm

6 calls to WebformDeleteFormBase::buildForm()
WebformHandlerDeleteForm::buildForm in src/Form/WebformHandlerDeleteForm.php
Form constructor.
WebformResultsClearForm::buildForm in src/Form/WebformResultsClearForm.php
Form constructor.
WebformSubmissionsPurgeForm::buildForm in src/Form/WebformSubmissionsPurgeForm.php
Form constructor.
WebformUiElementDeleteForm::buildForm in modules/webform_ui/src/Form/WebformUiElementDeleteForm.php
Form constructor.
WebformVariantApplyForm::buildForm in src/Form/WebformVariantApplyForm.php
Form constructor.

... See full list

6 methods override WebformDeleteFormBase::buildForm()
WebformHandlerDeleteForm::buildForm in src/Form/WebformHandlerDeleteForm.php
Form constructor.
WebformResultsClearForm::buildForm in src/Form/WebformResultsClearForm.php
Form constructor.
WebformSubmissionsPurgeForm::buildForm in src/Form/WebformSubmissionsPurgeForm.php
Form constructor.
WebformUiElementDeleteForm::buildForm in modules/webform_ui/src/Form/WebformUiElementDeleteForm.php
Form constructor.
WebformVariantApplyForm::buildForm in src/Form/WebformVariantApplyForm.php
Form constructor.

... See full list

File

src/Form/WebformDeleteFormBase.php, line 26

Class

WebformDeleteFormBase
Provides a generic base class for a webform deletion form.

Namespace

Drupal\webform\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['#attributes']['class'][] = 'confirmation';
  $form['#theme'] = 'confirm_form';
  $form[$this
    ->getFormName()] = [
    '#type' => 'hidden',
    '#value' => 1,
  ];

  // Title.
  $form['#title'] = $this
    ->getQuestion();

  // Warning.
  $form['warning'] = $this
    ->getWarning();

  // Description.
  $form['description'] = $this
    ->getDescription();

  // Details and confirm input.
  $details = $this
    ->getDetails();
  $confirm_input = $this
    ->getConfirmInput();
  if ($details) {
    $form['details'] = $details;
  }
  if (!$details && $confirm_input) {
    $form['hr'] = [
      '#markup' => '<p><hr/></p>',
    ];
  }
  if ($confirm_input) {
    $form['confirm'] = $confirm_input;
  }

  // Actions.
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->getConfirmText(),
    '#button_type' => 'primary',
  ];
  $form['actions']['cancel'] = ConfirmFormHelper::buildCancelLink($this, $this
    ->getRequest());
  return $this
    ->buildDialogConfirmForm($form, $form_state);
}