n Drupal 8 How to add “Remember me” checkbox to login form | CodimTh

Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh


How to add “Remember me” checkbox to login form in Drupal 8?


 * Implements hook_form_alter().
function mymodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
    if ($form_id == 'user_login_form') {
        $form['remember_me'] = [
            '#type'          => 'checkbox',
            '#title'         => t('Remember me'),
            '#default_value' => FALSE,


remember me login form


Riadh Rahmi

Senior Web Developer PHP/Drupal & Laravel

I am a senior web developer, I have experience in planning and developing large scale dynamic web solutions especially in Drupal & Laravel.

Web Posts


Page Facebook