You are here

public function ConfigForm::submitForm in Color API 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/ConfigForm.php, line 137

Class

ConfigForm
Form definition for the Color API module configuration page.

Namespace

Drupal\colorapi\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->configFactory
    ->getEditable('colorapi.settings')
    ->set('enable_color_field', (int) $form_state
    ->getValue('enable_color_field'))
    ->set('enable_color_entity', (int) $form_state
    ->getValue('enable_color_entity'))
    ->save();

  // @todo - Find a less nuclear option, ideally invalidating cache tags.
  drupal_flush_all_caches();
  parent::submitForm($form, $form_state);
}