You are here

public function MergeMultipleForm::validateForm in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/Form/MergeMultipleForm.php \Drupal\bibcite_entity\Form\MergeMultipleForm::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

modules/bibcite_entity/src/Form/MergeMultipleForm.php, line 146

Class

MergeMultipleForm
Merge multiple bibliographic entities into one.

Namespace

Drupal\bibcite_entity\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  if (isset($this->entityInfo[$form_state
    ->getValue('target')])) {
    $form_state
      ->setErrorByName('target', $this
      ->t('@label cannot be merged into oneself', [
      '@label' => $this->entityInfo[$form_state
        ->getValue('target')],
    ]));
  }
}