function BookSettingsForm::submitForm

Same name and namespace in other branches
  1. 9 core/modules/book/src/Form/BookSettingsForm.php \Drupal\book\Form\BookSettingsForm::submitForm()

Overrides ConfigFormBase::submitForm

File

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

Class

BookSettingsForm
Configure book settings for this site.

Namespace

Drupal\book\Form

Code

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);
}

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