You are here

public function JquerySocialStreamAdminForm::submitForm in jQuery social stream 8

Same name and namespace in other branches
  1. 8.2 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 114
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');

  // Twitter.
  foreach (Element::children($form['twitter']) as $variable) {
    $config
      ->set($variable, $form_state
      ->getValue($variable));
  }

  // Google +.
  foreach (Element::children($form['google']) as $variable) {
    $config
      ->set($variable, $form_state
      ->getValue($variable));
  }

  // Instagram.
  foreach (Element::children($form['instagram']) as $variable) {
    $config
      ->set($variable, $form_state
      ->getValue($variable));
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}