You are here

public function MergeForm::validateForm in Bibliography & Citation 8

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

Class

MergeForm
Merge bibliographic entities.

Namespace

Drupal\bibcite_entity\Form

Code

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