public function PersistentLoginSettingsForm::buildForm in Persistent Login 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/ PersistentLoginSettingsForm.php, line 32
Class
- PersistentLoginSettingsForm
- Form for editing Persistent Login module settings.
Namespace
Drupal\persistent_login\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('persistent_login.settings');
$form['lifetime'] = [
'#type' => 'number',
'#min' => 0,
'#step' => 1,
'#title' => $this
->t('Lifetime'),
'#description' => $this
->t('The maximum number of days for which a persistent login session is valid. Enter <em>0</em> for no expiration.'),
'#default_value' => $config
->get('lifetime'),
];
$form['max_tokens'] = [
'#type' => 'number',
'#min' => 0,
'#step' => 1,
'#title' => $this
->t('Maximum Tokens'),
'#description' => $this
->t('The maximum number of tokens per user. Enter <em>0</em> for no limit.'),
'#default_value' => $config
->get('max_tokens'),
];
$form['field_label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Form Label'),
'#description' => $this
->t('The login form field label.'),
'#default_value' => $config
->get('login_form.field_label'),
'#required' => TRUE,
];
$form['cookie_prefix'] = [
'#type' => 'textfield',
'#title' => $this
->t('Cookie Prefix'),
'#description' => $this
->t('A prefix for the persistent login cookie name. <br>Allowed characters are: ASCII letters ([A-Z], [a-z]), digits ([0-9]), hyphens ("-") or underscores ("_"). <br>This value will be prepended with \'S\' when the site is accessed over HTTPS to prevent a cookie collision. <br>All users will be required to login if this value is changed.'),
'#default_value' => $config
->get('cookie_prefix'),
'#required' => TRUE,
];
return parent::buildForm($form, $form_state);
}