You are here

public function TweetbuttonSettingsForm::submitForm in Tweet Button 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

lib/Drupal/tweetbutton/Form/TweetbuttonSettingsForm.php, line 166
Contains \Drupal\tweetbutton\Form\TweetbuttonSettingsForm.

Class

TweetbuttonSettingsForm
Provides a configuration form for tweetbutton.

Namespace

Drupal\tweetbutton\Form

Code

public function submitForm(array &$form, array &$form_state) {
  $values = $form_state['values'];
  $this
    ->config('tweetbutton.settings')
    ->set('tweetbutton_tweet_text', $values['tweetbutton_tweet_text'])
    ->set('tweetbutton_size', $values['tweetbutton_size'])
    ->set('tweetbutton_hashtags', $values['tweetbutton_hashtags'])
    ->set('tweetbutton_language', $values['tweetbutton_language'])
    ->set('tweetbutton_account', $values['tweetbutton_account'])
    ->set('tweetbutton_rel_account_name', $values['tweetbutton_rel_account_name'])
    ->set('tweetbutton_rel_account_description', $values['tweetbutton_rel_account_description'])
    ->set('tweetbutton_follow_screen_name', $values['tweetbutton_follow_screen_name']);
  if ($this->moduleHandler
    ->moduleExists('shorten')) {
    $this->configFactory
      ->get('tweetbutton.settings')
      ->set('tweetbutton_shorten_service', $values['tweetbutton_shorten_service']);
  }
  $this
    ->config('tweetbutton.settings')
    ->save();
  parent::submitForm($form, $form_state);
}