public BookSettingsForm::validateForm(array &$form, FormStateInterface $form_state)
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 56
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); }
Please login to continue.