function PreprocessHooks::preprocessFormElementPassword
Same name and namespace in other branches
- 11.x core/themes/default_admin/src/Hook/PreprocessHooks.php \Drupal\default_admin\Hook\PreprocessHooks::preprocessFormElementPassword()
Implements hook_preprocess_HOOK() for form_element__password.
Attributes
#[Hook('preprocess_form_element__password')]
File
-
core/
themes/ default_admin/ src/ Hook/ PreprocessHooks.php, line 561
Class
- PreprocessHooks
- Provides preprocess implementations.
Namespace
Drupal\default_admin\HookCode
public function preprocessFormElementPassword(array &$variables) : void {
if (!empty($variables['element']['#array_parents']) && in_array('pass1', $variables['element']['#array_parents'], TRUE)) {
// This is the main password form element.
$variables['attributes']['class'][] = 'password-confirm__password';
}
if (!empty($variables['element']['#array_parents']) && in_array('pass2', $variables['element']['#array_parents'], TRUE)) {
// This is the password confirm form element.
$variables['attributes']['class'][] = 'password-confirm__confirm';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.