Drupal - How to customize the user login form?
You can add placeholders in hook_form_alter().
/**
* Implements hook_form_alter().
* @param $form
* @param \Drupal\Core\Form\FormStateInterface $form_state
* @param $form_id
*/
function ThemeName_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
if ($form_id == 'user_login_form' ) {
// Add placeholders.
$form['name']['#attributes']['placeholder'] = t('User name');
$form['pass']['#attributes']['placeholder'] = t('Password');
}
}
Use the Devel module functions to print out the form using kint, this way you can visibly see the entire structure of the $form array.
https://www.drupal.org/project/simplelogin
It is a simple module for Customize Drupal Login, Password and Register pages with Background images.
Administrators can provide the ability to allow users to attach their own background images/ own background color to user login, password, registration pages. Better features including customize background color, image settings.
Features: Clean & Sleek Design, Customize background color, link color, submit button color, Customize image settings, Background image Opacity, Remove unwanted Css files from simplelogin pages, Login pages wrapper width, Mobile responsive,