You are here

public function WebformResultsClearForm::buildForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Form/WebformResultsClearForm.php \Drupal\webform\Form\WebformResultsClearForm::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/WebformResultsClearForm.php, line 30

Class

WebformResultsClearForm
Webform for webform results clear 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 {
    $t_args = [
      '%label' => $this
        ->getLabel(),
    ];
    $form['message'] = [
      '#type' => 'webform_message',
      '#message_type' => 'error',
      '#message_message' => $this
        ->t('There are no %label submissions.', $t_args),
    ];
    return $form;
  }
}