You are here

public function RenderExampleDemoForm::submitForm in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 render_example/src/Form/RenderExampleDemoForm.php \Drupal\render_example\Form\RenderExampleDemoForm::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

modules/render_example/src/Form/RenderExampleDemoForm.php, line 272

Class

RenderExampleDemoForm
Provides the form for toggling module features on and off.

Namespace

Drupal\render_example\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $config = $this
    ->config('render_example.settings');
  $config
    ->set('show_block', $values['render_example_show_block'])
    ->save();
  $config
    ->set('show_page', $values['render_example_show_page'])
    ->save();
  $config
    ->set('move_breadcrumbs', $values['render_example_move_breadcrumbs'])
    ->save();
  $config
    ->set('reverse_sidebar', $values['render_example_reverse_sidebar'])
    ->save();
  $config
    ->set('wrap_blocks', $values['render_example_wrap_blocks'])
    ->save();
  parent::submitForm($form, $form_state);
}