You are here

public function TwitterSettingsForm::submitForm in Twitter 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/TwitterSettingsForm.php, line 104

Class

TwitterSettingsForm
Configure twitter settings for this site.

Namespace

Drupal\twitter\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $twitter_config = $this->configFactory
    ->getEditable('twitter.settings');
  $twitter_config
    ->set('import', $form_state
    ->getValue('import'))
    ->set('expire', $form_state
    ->getValue('expire'))
    ->set('consumer_key', $form_state
    ->getValue('consumer_key'))
    ->set('consumer_secret', $form_state
    ->getValue('consumer_secret'))
    ->set('host', $form_state
    ->getValue('host'))
    ->set('api', $form_state
    ->getValue('api'))
    ->set('search', $form_state
    ->getValue('search'))
    ->set('tinyurl', $form_state
    ->getValue('tinyurl'))
    ->save();
  parent::submitForm($form, $form_state);
}