function BookSettingsForm::validateForm

Same name in other branches
  1. 8.9.x core/modules/book/src/Form/BookSettingsForm.php \Drupal\book\Form\BookSettingsForm::validateForm()
  2. 10 core/modules/book/src/Form/BookSettingsForm.php \Drupal\book\Form\BookSettingsForm::validateForm()
  3. 11.x core/modules/book/src/Form/BookSettingsForm.php \Drupal\book\Form\BookSettingsForm::validateForm()

Overrides FormBase::validateForm

File

core/modules/book/src/Form/BookSettingsForm.php, line 57

Class

BookSettingsForm
Configure book settings for this site.

Namespace

Drupal\book\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
    $child_type = $form_state->getValue('book_child_type');
    if ($form_state->isValueEmpty([
        'book_allowed_types',
        $child_type,
    ])) {
        $form_state->setErrorByName('book_child_type', $this->t('The content type for the %add-child link must be one of those selected as an allowed book outline type.', [
            '%add-child' => $this->t('Add child page'),
        ]));
    }
    parent::validateForm($form, $form_state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.