BookSettingsForm::submitForm

public BookSettingsForm::submitForm(array &$form, FormStateInterface $form_state)

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 68

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')
    // Remove unchecked types.
    ->set('allowed_types', $allowed_types)
    ->set('child_type', $form_state->getValue('book_child_type'))
    ->save();

  parent::submitForm($form, $form_state);
}
doc_Drupal
2016-10-29 08:48:34
Comments
Leave a Comment

Please login to continue.