Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh
Category:

Question

how to add placeholders to password_confirm element?

Solution


 
use Drupal\Core\Form\FormStateInterface;


/**
 * Implements hook_element_info_alter().
 */

function mymodule_element_info_alter(array &$types) {
    $types['password_confirm']['#process'][] = "_add_pass_confirm_placeholders";
}

function _add_pass_confirm_placeholders(&$element, FormStateInterface $form_state, &$complete_form) {
    $element['pass1']['#placeholder'] = t('Password');
    $element['pass2']['#placeholder'] = t('Confirm password');

    return $element;
}
password placeholder

 

Tags :

Comments

Add new comment

Restricted HTML

Search

Page Facebook

Become a patron

If you need some help or you search a Drupal freelancer don't hesitate to contact us.

 

Contact Us

All the content is FREE but I still need your help

 

Become a patreon