public function BookSettingsForm::submitForm in Drupal 8
Same name and namespace in other branches
- 9 core/modules/book/src/Form/BookSettingsForm.php \Drupal\book\Form\BookSettingsForm::submitForm()
Form submission 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 ConfigFormBase::submitForm
File
- core/
modules/ book/ src/ Form/ BookSettingsForm.php, line 69
Class
- BookSettingsForm
- Configure book settings for this site.
Namespace
Drupal\book\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$allowed_types = array_filter($form_state
->getValue('book_allowed_types'));
// We need to save the allowed types in an array ordered by machine_name so
// that we can save them in the correct order if node type changes.
// @see book_node_type_update().
sort($allowed_types);
$this
->config('book.settings')
->set('allowed_types', $allowed_types)
->set('child_type', $form_state
->getValue('book_child_type'))
->save();
parent::submitForm($form, $form_state);
}