You are here

protected function CslStyleForm::validateParent in Bibliography & Citation 8

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

Validate existing of parent style.

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 $parent_url: URL ID of parent style.

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

File

src/Form/CslStyleForm.php, line 157

Class

CslStyleForm
Add/edit form for bibcite_csl_style entity.

Namespace

Drupal\bibcite\Form

Code

protected function validateParent(array &$form, FormStateInterface $form_state, $parent_url) {
  if (!$this
    ->findStyleByUrlId($parent_url)) {
    $message = $this
      ->t('You are trying to save dependent style without installed parent. You should install parent style first: @style', [
      '@style' => $parent_url,
    ]);
    $form_state
      ->setError($form, $message);
  }
}