You are here

public function WebformSubmissionsPurgeForm::buildForm in Webform 6.x

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

File

src/Form/WebformSubmissionsPurgeForm.php, line 30

Class

WebformSubmissionsPurgeForm
Webform for webform submission purge webform.

Namespace

Drupal\webform\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $submission_total = $this
    ->getSubmissionTotal();
  if ($submission_total) {
    return parent::buildForm($form, $form_state);
  }
  else {
    $form['message'] = [
      '#type' => 'webform_message',
      '#message_type' => 'error',
      '#message_message' => $this
        ->t('There are no webform submissions.'),
    ];
    return $form;
  }
}