Created
July 29, 2016 12:06
-
-
Save annikaC/546198c3be67279dfae8f82428e3cff1 to your computer and use it in GitHub Desktop.
Drupal 8 add placeholders to password_confirm element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_element_info_alter(). | |
*/ | |
function module_element_info_alter(array &$types) { | |
// Add placeholders to password_confirm element. | |
$types['password_confirm']['#process'][] = "_module_add_pass_confirm_placeholders"; | |
} | |
function _module_add_pass_confirm_placeholders(&$element, FormStateInterface $form_state, &$complete_form) { | |
$element['pass1']['#placeholder'] = t('Password'); | |
$element['pass2']['#placeholder'] = t('Confirm password'); | |
return $element; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment