You are here

public function BookSettingsForm::validateForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/book/src/Form/BookSettingsForm.php \Drupal\book\Form\BookSettingsForm::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

core/modules/book/src/Form/BookSettingsForm.php, line 61
Contains \Drupal\book\Form\BookSettingsForm.

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(array(
    '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.', array(
      '%add-child' => $this
        ->t('Add child page'),
    )));
  }
  parent::validateForm($form, $form_state);
}