You are here

public function TaxonomyViewsIntegratorSettingsForm::validateForm in Taxonomy Views Integrator 8

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/TaxonomyViewsIntegratorSettingsForm.php, line 173

Class

TaxonomyViewsIntegratorSettingsForm
TVI global settings form.

Namespace

Drupal\tvi\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  if ($values['enable_override']) {
    if (!mb_strlen($values['view'])) {
      $form_state
        ->setError($form['tvi']['view'], $this
        ->t('To override the term presentation, you must specify a view.'));
    }
    if (!mb_strlen($values['view_display'])) {
      $form_state
        ->setError($form['tvi']['view_display'], $this
        ->t('To override the term presentation, you must specify a view display.'));
    }
  }
}