You are here

public function AccessTokenSettingsForm::submitForm in Simple OAuth (OAuth2) & OpenID Connect 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 FormInterface::submitForm

File

src/Entity/Form/AccessTokenSettingsForm.php, line 34

Class

AccessTokenSettingsForm
Class AccessTokenSettingsForm.

Namespace

Drupal\simple_oauth\Entity\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $save = FALSE;
  $settings = $this
    ->configFactory()
    ->getEditable('simple_oauth.settings');
  if ($expiration = $form_state
    ->getValue('expiration')) {
    $settings
      ->set('expiration', $expiration);
    $save = TRUE;
  }
  if ($refresh_extension = $form_state
    ->getValue('refresh_extension')) {
    $settings
      ->set('refresh_extension', $refresh_extension);
    $save = TRUE;
  }
  if ($save) {
    $settings
      ->save();
  }
}