public function PasswordLength::validateConfigurationForm in Password Policy 8.3
Form validation handler.
Parameters
array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().
Overrides PasswordConstraintBase::validateConfigurationForm
File
- password_policy_length/
src/ Plugin/ PasswordConstraint/ PasswordLength.php, line 75
Class
- PasswordLength
- Enforces a specific character length for passwords.
Namespace
Drupal\password_policy_length\Plugin\PasswordConstraintCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
if (!is_numeric($form_state
->getValue('character_length')) or $form_state
->getValue('character_length') <= 0) {
$form_state
->setErrorByName('character_length', $this
->t('The character length must be a positive number.'));
}
}