You are here

public function SettingsForm::submitForm in Twitter Profile Widget 8

Same name and namespace in other branches
  1. 8.2 src/Form/SettingsForm.php \Drupal\twitter_profile_widget\Form\SettingsForm::submitForm()
  2. 3.x src/Form/SettingsForm.php \Drupal\twitter_profile_widget\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 111

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\twitter_profile_widget\Form

Code

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

  // Invalidate cached Twitter data for widget views.
  Cache::invalidateTags([
    'twitter_widget_view',
  ]);
  $values = $form_state
    ->getValues();
  $this
    ->config('twitter_profile_widget.settings')
    ->set('integrate_blocks', $values['integrate_blocks'])
    ->set('expire_internal_cache', $values['expire_internal_cache'])
    ->set('twitter_widget_key', $values['twitter_widget_key'])
    ->set('twitter_widget_secret', $values['twitter_widget_secret'])
    ->set('twitter_widget_cache_time', $values['twitter_widget_cache_time'])
    ->set('twitter_widget_token', 'Credentials Valid')
    ->save();
  parent::submitForm($form, $form_state);
}