UserNameUnique.php

Same filename and directory in other branches
  1. 11.x core/modules/user/src/Plugin/Validation/Constraint/UserNameUnique.php
  2. 10 core/modules/user/src/Plugin/Validation/Constraint/UserNameUnique.php
  3. 9 core/modules/user/src/Plugin/Validation/Constraint/UserNameUnique.php
  4. 8.9.x core/modules/user/src/Plugin/Validation/Constraint/UserNameUnique.php

Namespace

Drupal\user\Plugin\Validation\Constraint

File

core/modules/user/src/Plugin/Validation/Constraint/UserNameUnique.php

View source
<?php

namespace Drupal\user\Plugin\Validation\Constraint;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Drupal\Core\Validation\Plugin\Validation\Constraint\UniqueFieldConstraint;
use Symfony\Component\Validator\Attribute\HasNamedArguments;

/**
 * Checks if a user name is unique on the site.
 */
class UserNameUnique extends UniqueFieldConstraint {
  public function __construct(mixed $options = NULL, ?bool $caseSensitive = NULL, $message = 'The username %value is already taken.', ?array $groups = NULL, mixed $payload = NULL) {
    parent::__construct($options, $caseSensitive, $message, $groups, $payload);
  }

}

Classes

Title Deprecated Summary
UserNameUnique Checks if a user name is unique on the site.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.