You are here

public function AdminSettingsForm::submitForm in Sharerich 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/AdminSettingsForm.php, line 113
Contains \Drupal\sharerich\Form\AdminSettingsForm.

Class

AdminSettingsForm
Class AdminSettingsForm.

Namespace

Drupal\sharerich\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $this
    ->config('sharerich.settings')
    ->set('allowed_html', $form_state
    ->getValue('allowed_html'))
    ->set('facebook_app_id', $form_state
    ->getValue('facebook_app_id'))
    ->set('facebook_site_url', $form_state
    ->getValue('facebook_site_url'))
    ->set('youtube_username', $form_state
    ->getValue('youtube_username'))
    ->set('instagram_username', $form_state
    ->getValue('instagram_username'))
    ->set('github_username', $form_state
    ->getValue('github_username'))
    ->set('twitter_user', $form_state
    ->getValue('twitter_user'))
    ->save();

  // Clear block cache.
  Cache::invalidateTags(array(
    'block_view',
  ));
}