You are here

public function MergeTerms::validateForm in Term Merge 8

Plugin annotation

@SuppressWarnings(camelCase);

Overrides FormBase::validateForm

File

src/Form/MergeTerms.php, line 111

Class

MergeTerms
Term merge form.

Namespace

Drupal\term_merge\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  $selectedTerms = $form_state
    ->getValue('terms');
  if (empty($selectedTerms)) {
    $form_state
      ->setErrorByName('terms', 'At least one term must be selected.');
  }
}