function view_password_form_alter in View Password 8.4
Same name and namespace in other branches
- 8.5 view_password.module \view_password_form_alter()
- 6.0.x view_password.module \view_password_form_alter()
Implements hook_form_alter().
File
- ./
view_password.module, line 29 - Contains \Drupal\view_password\view_password.module.
Code
function view_password_form_alter(&$form, &$form_state, $form_id) {
$config = \Drupal::service('config.factory')
->getEditable('pwd.settings');
$pwd_id[] = $config
->get('pwd.form_id_pwd');
$frm_id = explode(',', $pwd_id[0]);
foreach ($frm_id as $frmid) {
if ($form_id == $frmid) {
// Adding a class else the js is adding to all forms.
$form['#attributes']['class'][] = 'pwd-see';
// Adding js to the form that has the id in the config form.
$form['#attached']['library'][] = 'view_password/pwd_lb';
}
}
}