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

Riadh Rahmi

Senior Web Developer (Drupal & Laravel)

I am a senior web developer, I have experience in planning and developing large scale dynamic web applications especially in Drupal and Laravel.

Web Posts

Search

Page Facebook