You are here

public function AccessTokenSettingsForm::buildForm in Simple OAuth (OAuth2) & OpenID Connect 8

Defines the settings form for Access Token entities.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array Form definition array.

Overrides FormInterface::buildForm

File

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

Class

AccessTokenSettingsForm
Class AccessTokenSettingsForm.

Namespace

Drupal\simple_oauth\Entity\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['expiration'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Expiration time'),
    '#description' => $this
      ->t('The default value, in seconds, to be used as expiration time when creating new tokens. This value may be overridden in the token generation form.'),
    '#default_value' => $this
      ->config('simple_oauth.settings')
      ->get('expiration'),
  ];
  $form['refresh_extension'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Refresh extension'),
    '#description' => $this
      ->t('The time a refresh token stays valid after the access token has expired.'),
    '#default_value' => $this
      ->config('simple_oauth.settings')
      ->get('refresh_extension'),
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Save'),
  ];
  return $form;
}