You are here

public function VueForm::submitForm in Decoupled Blocks: Vue.js 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

src/Form/VueForm.php, line 77

Class

VueForm
Class VueForm.

Namespace

Drupal\pdb_vue\Form

Code

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

  // Get the config object.
  $config = $this
    ->configFactory()
    ->getEditable('pdb_vue.settings');

  // Set the values the user submitted in the form.
  $config
    ->set('version', $form_state
    ->getValue('version'));
  $config
    ->set('development_mode', $form_state
    ->getValue('development_mode'));
  $config
    ->set('use_spa', $form_state
    ->getValue('use_spa'));
  $config
    ->set('spa_element', $form_state
    ->getValue('spa_element'));
  $config
    ->save();

  // Clear caches so that it will pick up the changes to vue library.
  $this
    ->flushCaches();
}