You are here

public function ShieldSettingsForm::submitForm in Shield 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/ShieldSettingsForm.php, line 215

Class

ShieldSettingsForm
Configure site information settings for this site.

Namespace

Drupal\shield\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $shield_config = $this
    ->config('shield.settings');
  $credential_provider = $form_state
    ->getValue([
    'credentials',
    'credential_provider',
  ]);
  $shield_config
    ->set('allow_cli', $form_state
    ->getValue([
    'general',
    'shield_allow_cli',
  ]))
    ->set('shield_enable', $form_state
    ->getValue([
    'general',
    'shield_enable',
  ]))
    ->set('whitelist', $form_state
    ->getValue([
    'general',
    'whitelist',
  ]))
    ->set('domains', $form_state
    ->getValue([
    'general',
    'shield_domains',
  ]))
    ->set('print', $form_state
    ->getValue('shield_print'))
    ->set('credential_provider', $credential_provider);
  $credentials = $form_state
    ->getValue([
    'credentials',
    'providers',
    $credential_provider,
  ]);
  $shield_config
    ->set('credentials', [
    $credential_provider => $credentials,
  ]);
  $shield_config
    ->save();
  parent::submitForm($form, $form_state);
}