You are here

public function SettingsForm::validateForm in Menu Link Weight 8

Same name and namespace in other branches
  1. 8.2 src/Form/SettingsForm.php \Drupal\menu_link_weight\Form\SettingsForm::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/SettingsForm.php, line 51

Class

SettingsForm
Configure menu link weight settings.

Namespace

Drupal\menu_link_weight\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('menu_parent_form_selector') === 'cshs' && !\Drupal::moduleHandler()
    ->moduleExists('cshs')) {
    $form_state
      ->setErrorByName('menu_parent_form_selector', t('You have to install <a href="https://www.drupal.org/project/cshs">Client-side hierarchical select</a> before you can use this option.'));
  }
}