public function AppCredentialsConfigForm::buildForm in Apigee Edge 8
Form constructor.
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 The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ AppCredentialsConfigForm.php, line 34
Class
- AppCredentialsConfigForm
- Base config form for app credentials related settings.
Namespace
Drupal\apigee_edge\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config($this
->getConfigName());
$form['wrapper'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Credential lifetime'),
'#collapsible' => FALSE,
];
// The value of -1 indicates no set expiry. But the value of 0 is not
// acceptable by the server (InvalidValueForExpiresIn),
// so 0 is transformed to -1 while saving the developer app.
$form['wrapper']['credential_lifetime'] = [
'#type' => 'number',
'#title' => $this
->t('Default API key lifetime in days'),
'#default_value' => $config
->get('credential_lifetime'),
'#description' => $this
->t('When an app is newly-created, this is the default number of days until its API Key expires. A value of 0 indicates no set expiry.'),
'#min' => 0,
'#required' => TRUE,
];
return parent::buildForm($form, $form_state);
}