You are here

public function SimpleForm::submitForm in Admin CSS 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/SimpleForm.php, line 91

Class

SimpleForm
SimpleForm with some custom functions and settings.

Namespace

Drupal\admin_css\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('admin_css.settings');
  $custom_css = $form_state
    ->getValue('custom_css');
  $config
    ->set('custom_css', $custom_css);
  $config
    ->save();
  if (file_save_data($custom_css, 'public://admin-style.css', FileSystemInterface::EXISTS_REPLACE)) {

    // Flush the css/js asset cache.
    $this
      ->flushAssetCache();
  }
  parent::submitForm($form, $form_state);
}