You are here

public function SettingsForm::submitForm in Font Awesome Icons 8

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

src/Form/SettingsForm.php, line 112

Class

SettingsForm
Defines a form that configures fontawesome settings.

Namespace

Drupal\fontawesome\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();

  // Clear the library cache so we use the updated information.
  $this->libraryDiscovery
    ->clearCachedDefinitions();

  // Save the updated settings.
  $this
    ->config('fontawesome.settings')
    ->set('fontawesome_use_cdn', $values['fontawesome_use_cdn'])
    ->set('fontawesome_external_location', (string) $values['fontawesome_external_location'])
    ->save();
  parent::submitForm($form, $form_state);
}