You are here

public function AddthisSettingsForm::submitForm in Share Message 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/AddthisSettingsForm.php, line 108

Class

AddthisSettingsForm
Defines a form that configures Share Message settings.

Namespace

Drupal\sharemessage\Form

Code

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

  // If the profile id changes then we need to rebuild the library cache.
  Cache::invalidateTags([
    'library_info',
  ]);
  $this
    ->config('sharemessage.addthis')
    ->set('addthis_profile_id', $form_state
    ->getValue('addthis_profile_id'))
    ->set('services', $form_state
    ->getValue('default_services'))
    ->set('additional_services', $form_state
    ->getValue('default_additional_services'))
    ->set('counter', $form_state
    ->getValue('default_counter'))
    ->set('icon_style', $form_state
    ->getValue('default_icon_style'))
    ->set('local_services_definition', $form_state
    ->getValue('local_services_definition'))
    ->set('shared_video_width', $form_state
    ->getValue('shared_video_width'))
    ->set('shared_video_height', $form_state
    ->getValue('shared_video_height'))
    ->save();
}