You are here

public function ShurlyAnalyticsSettingsForm::submitForm in ShURLy 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

shurly_analytics/src/Form/ShurlyAnalyticsSettingsForm.php, line 52

Class

ShurlyAnalyticsSettingsForm

Namespace

Drupal\shurly_analytics\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('shurly_analytics.settings');
  foreach (Element::children($form) as $variable) {
    $config
      ->set($variable, $form_state
      ->getValue($form[$variable]['#parents']));
  }
  $config
    ->save();
  if (method_exists($this, '_submitForm')) {
    $this
      ->_submitForm($form, $form_state);
  }
  parent::submitForm($form, $form_state);
}