You are here

public function WebformEntitySettingsSubmissionsForm::buildForm in Webform 6.x

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

Class

WebformEntitySettingsSubmissionsForm
Webform submissions settings.

Namespace

Drupal\webform\EntitySettings

Code

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

  /** @var \Drupal\webform\WebformInterface $webform */
  $webform = $this->entity;

  // Display warning and disable the submission form.
  if ($webform
    ->isResultsDisabled()) {
    $this
      ->messenger()
      ->addWarning($this
      ->t('Saving of submissions is disabled, submission settings, submission limits, purging and the saving of drafts is disabled. Submissions must be sent via an email or handled using a <a href=":href">custom webform handler</a>.', [
      ':href' => $webform
        ->toUrl('handlers')
        ->toString(),
    ]));
    return $form;
  }
  return parent::buildForm($form, $form_state);
}