How to change the form label from Password
to New Password
and Confirm password
to New Confirm password
on THEME_form_user_form_alter
(without changing any twig
files)? I had tried kint($form['account']['pass'])
to see any possible way, no clue...
Current Change Password Form
Current password
|||||||||||||||||
Password (to New Password)
|||||||||||||||||
Confirm password (to New Confirm password)
|||||||||||||||||
function THEME_form_user_form_alter(&$form, $form_state) {
kint($form['account']);
}
There are no #title
element on pass
field.
current_pass
must be coming from a custom or contrib module, as mine doesn't have that.#title
s are defined in/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php
. It looks complicated to change, you might have to just do it via javascript/jQuery.