view_password.module in View Password 8.5
Same filename and directory in other branches
Contains \Drupal\view_password\view_password.module.
File
view_password.moduleView source
<?php
/**
* @file
* Contains \Drupal\view_password\view_password.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function view_password_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.view_password':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('View Password module will help the user to see what password they entered.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_form_alter().
*/
function view_password_form_alter(&$form, &$form_state, $form_id) {
$form_ids = \Drupal::config('view_password.settings')
->get('form_ids');
$frm_id = explode(',', $form_ids);
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';
}
}
}
Functions
Name![]() |
Description |
---|---|
view_password_form_alter | Implements hook_form_alter(). |
view_password_help | Implements hook_help(). |