public function PasswordStrengthSettingsForm::buildForm in Password Strength 8.2
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ PasswordStrengthSettingsForm.php, line 32
Class
Namespace
Drupal\password_strength\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = \Drupal::config('password_strength.settings');
$form = array();
//matchers
$plugin_manager = \Drupal::service('plugin.manager.password_strength.password_strength_matcher');
$all_plugins = $plugin_manager
->getDefinitions();
$all_matchers = array();
foreach ($all_plugins as $plugin) {
$id = $plugin['id'];
$all_matchers[$id] = $plugin['title'];
}
$form['matchers'] = array(
'#title' => 'Matchers',
'#type' => 'checkboxes',
'#options' => $all_matchers,
'#default_value' => $config
->get('enabled_matchers'),
'#required' => TRUE,
);
return parent::buildForm($form, $form_state);
}