By kim.pepper on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.3.x
Introduced in version:
10.3.0
Issue links:
Description:
user_validate_name() is deprecated and replaced with the \Drupal\user\UserNameValidator service that returns a constraint violation list \Symfony\Component\Validator\ConstraintViolationListInterface.
Before:
$error_message = user_validate_name('foo');
After:
$violations = \Drupal::service('user.name_validator')->validateName('foo');
if (count($violations) > 0) {
$error_message = $violations[0]->getMessage();
}
Impacts:
Module developers