You are here

public function PdbNg2Form::submitForm in Decoupled Blocks 8

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/pdb_ng2/src/Form/PdbNg2Form.php, line 46

Class

PdbNg2Form
Class PdbNg2Form.

Namespace

Drupal\pdb_ng2\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);

  // Set variables based on form values.
  $development_mode = $form_state
    ->getValue('development_mode');

  // Get the config object.
  $config = \Drupal::service('config.factory')
    ->getEditable('pdb_ng2.settings');

  // Set the values the user submitted in the form.
  $config
    ->set('development_mode', $development_mode);
  $config
    ->save();
}