You are here

protected function CslStyleForm::validateUnique in Bibliography & Citation 2.0.x

Same name and namespace in other branches
  1. 8 src/Form/CslStyleForm.php \Drupal\bibcite\Form\CslStyleForm::validateUnique()

Validate unique URl ID property.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

string $url_id: URL ID property.

1 call to CslStyleForm::validateUnique()
CslStyleForm::validateForm in src/Form/CslStyleForm.php
Form validation handler.

File

src/Form/CslStyleForm.php, line 141

Class

CslStyleForm
Add/edit form for bibcite_csl_style entity.

Namespace

Drupal\bibcite\Form

Code

protected function validateUnique(array &$form, FormStateInterface $form_state, $url_id) {
  if ($result = $this
    ->findStyleByUrlId($url_id)) {
    $form_state
      ->setError($form, $this
      ->t('You are trying to save existing style. Check out style with this id: @id', [
      '@id' => reset($result),
    ]));
  }
}