You are here

public function ContributorCategoryDeleteForm::validateForm in Bibliography & Citation 2.0.x

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

Class

ContributorCategoryDeleteForm
Builds the form to delete Contributor category entities.

Namespace

Drupal\bibcite_entity\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if ($this->inUse) {
    $form_state
      ->setError($form, $this
      ->t('Category %name used in reference(s) and cannot be deleted.', [
      '%name' => $this->entity
        ->label(),
    ]));
  }
  parent::validateForm($form, $form_state);
}