You are here

public function JquerySocialStreamAdminForm::submitForm in jQuery social stream 8.2

Same name and namespace in other branches
  1. 8 src/Form/JquerySocialStreamAdminForm.php \Drupal\jquery_social_stream\Form\JquerySocialStreamAdminForm::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/JquerySocialStreamAdminForm.php, line 165
Contains \Drupal\jquery_social_stream\Form\JquerySocialStreamAdminForm.

Class

JquerySocialStreamAdminForm

Namespace

Drupal\jquery_social_stream\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('jquery_social_stream.settings');
  $providers = array(
    'twitter',
    'facebook',
    'google',
    'youtube',
    'instagram',
  );
  foreach ($providers as $provider) {
    foreach (Element::children($form[$provider]) as $variable) {
      $config
        ->set($variable, $form_state
        ->getValue($variable));
    }
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}