You are here

public function ContributorRoleDeleteForm::validateForm in Bibliography & Citation 8

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

Class

ContributorRoleDeleteForm
Builds the form to delete Contributor role entities.

Namespace

Drupal\bibcite_entity\Form

Code

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