You are here

public function SamlSpConfig::submitForm in SAML Service Provider 4.x

Same name and namespace in other branches
  1. 8.3 src/Form/SamlSpConfig.php \Drupal\saml_sp\Form\SamlSpConfig::submitForm()
  2. 8.2 src/Form/SamlSpConfig.php \Drupal\saml_sp\Form\SamlSpConfig::submitForm()
  3. 3.x src/Form/SamlSpConfig.php \Drupal\saml_sp\Form\SamlSpConfig::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/SamlSpConfig.php, line 61

Class

SamlSpConfig
Provides the configuration form.

Namespace

Drupal\saml_sp\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('saml_sp.settings');
  $values = $form_state
    ->getValues();
  $this
    ->configRecurse($config, $values['contact'], 'contact');
  $this
    ->configRecurse($config, $values['organization'], 'organization');
  $this
    ->configRecurse($config, $values['security'], 'security');
  if (!$this
    ->isOverridden('strict')) {
    $config
      ->set('strict', (bool) $values['strict']);
  }
  if (!$this
    ->isOverridden('debug')) {
    $config
      ->set('debug', (bool) $values['debug']);
  }
  if (!$this
    ->isOverridden('key_location')) {
    $config
      ->set('key_location', $values['key_location']);
  }
  if (!$this
    ->isOverridden('cert_location')) {
    $config
      ->set('cert_location', $values['cert_location']);
  }
  if (!$this
    ->isOverridden('new_cert_location')) {
    $config
      ->set('new_cert_location', $values['new_cert_location']);
  }
  if (!$this
    ->isOverridden('entity_id')) {
    $config
      ->set('entity_id', $values['entity_id']);
  }
  if (!$this
    ->isOverridden('assertion_urls')) {
    $config
      ->set('assertion_urls', $values['assertion_urls']);
  }
  $config
    ->save();
  if (method_exists($this, '_submitForm')) {
    $this
      ->_submitForm($form, $form_state);
  }
  parent::submitForm($form, $form_state);
}