You are here

public function PagererPresetAddForm::validateForm in Pagerer 8

Same name and namespace in other branches
  1. 8.2 src/Form/PagererPresetAddForm.php \Drupal\pagerer\Form\PagererPresetAddForm::validateForm()

Form validation handler.

Parameters

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

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

Overrides FormBase::validateForm

File

src/Form/PagererPresetAddForm.php, line 31

Class

PagererPresetAddForm
Add a for Pagerer preset.

Namespace

Drupal\pagerer\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);

  // 'core' preset id is reserved.
  $id = $form_state
    ->getValue('id');
  if ($id == 'core') {
    $form_state
      ->setErrorByName('id', $this
      ->t("The pager id %preset_id is reserved for internal use.", [
      '%preset_id' => $id,
    ]));
  }
}