You are here

function _persistent_login_add_form_field in Persistent Login 8

Helper function to add persistent login checkbox to a form.

1 call to _persistent_login_add_form_field()
persistent_login_form_user_login_form_alter in ./persistent_login.module
Implements hook_form_FORM_ID_alter().

File

./persistent_login.module, line 20
Contains persistent_login.module.

Code

function _persistent_login_add_form_field(&$form, FormStateInterface $form_state) {
  $form['persistent_login'] = [
    '#type' => 'checkbox',
    '#title' => \Drupal::config('persistent_login.settings')
      ->get('login_form.field_label'),
    '#cache' => [
      'tags' => [
        'config:persistent_login.settings',
      ],
    ],
  ];
  $form['#submit'][] = 'persistent_login_user_login_form_submit';
}