You are here

function genpass_add_samples in Generate Password 8

Same name and namespace in other branches
  1. 6 genpass.module \genpass_add_samples()
  2. 7 genpass.module \genpass_add_samples()

Adds some sample passwords to each module in an array.

1 call to genpass_add_samples()
genpass_form_alter in ./genpass.module
Implements hook_form_alter().

File

./genpass.module, line 353
Contains genpass.module.

Code

function genpass_add_samples($array, $length) {
  $return = [];
  foreach ($array as $module => $name) {
    $return[$module] = t('@module_machine_name (examples: <em>@password_eg1</em>, <em>@password_eg2</em>)', [
      '@module_machine_name' => $module,
      '@password_eg1' => Drupal::moduleHandler()
        ->invoke($module, 'password', [
        $length,
      ]),
      '@password_eg2' => Drupal::moduleHandler()
        ->invoke($module, 'password', [
        $length,
      ]),
    ]);
  }
  return $return;
}