Issue #3485903: password_confirm form element #title property is hardcoded
1 unresolved thread
Closes #3485903
If #title is provided in the form element, pass1 does not get an extra title. If #title is not provided, it defaults to "Password" as before.
Merge request reports
Activity
69 69 public static function processPasswordConfirm(&$element, FormStateInterface $form_state, &$complete_form) { 70 70 $element['pass1'] = [ 71 71 '#type' => 'password', 72 '#title' => t('Password'), 72 '#title' => empty($element['#title']) ? t('Password') : NULL, @smustgrave if a custom form with password_confirm has title, then that title would be displayed. Inorder to avoid duplicates, here we are checking if
$element['#title']
is empty. if$element['#title']
is empty, default title 'password' would be displayed. Else the title from custom form will be used.Kindly let me know If there is a concern here
How about the following?
'#title' => empty($element['#title']) ? t('Password') : $element['#title'],
Edited by Sivaji Ganesh Jojodae@sivaji Then $element['#title'] appears twice.
changed this line in version 4 of the diff
added 1 commit
- 8317072f - Adding custom title for password and confirm password fields
Please register or sign in to reply