You are here

public function SearchPageFormBase::validateForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/search/src/Form/SearchPageFormBase.php \Drupal\search\Form\SearchPageFormBase::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

core/modules/search/src/Form/SearchPageFormBase.php, line 148
Contains \Drupal\search\Form\SearchPageFormBase.

Class

SearchPageFormBase
Provides a base form for search pages.

Namespace

Drupal\search\Form

Code

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

  // Ensure each path is unique.
  $path = $this->entityQuery
    ->get('search_page')
    ->condition('path', $form_state
    ->getValue('path'))
    ->condition('id', $form_state
    ->getValue('id'), '<>')
    ->execute();
  if ($path) {
    $form_state
      ->setErrorByName('path', $this
      ->t('The search page path must be unique.'));
  }
  if ($this->plugin instanceof PluginFormInterface) {
    $this->plugin
      ->validateConfigurationForm($form, $form_state);
  }
}