You are here

public function ConstraintManager::registerDefinitions in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Validation/ConstraintManager.php \Drupal\Core\Validation\ConstraintManager::registerDefinitions()

Callback for registering definitions for constraints shipped with Symfony.

See also

ConstraintManager::__construct()

File

core/lib/Drupal/Core/Validation/ConstraintManager.php, line 87

Class

ConstraintManager
Constraint plugin manager.

Namespace

Drupal\Core\Validation

Code

public function registerDefinitions() {
  $this
    ->getDiscovery()
    ->setDefinition('Callback', [
    'label' => new TranslatableMarkup('Callback'),
    'class' => '\\Symfony\\Component\\Validator\\Constraints\\Callback',
    'type' => FALSE,
  ]);
  $this
    ->getDiscovery()
    ->setDefinition('Blank', [
    'label' => new TranslatableMarkup('Blank'),
    'class' => '\\Symfony\\Component\\Validator\\Constraints\\Blank',
    'type' => FALSE,
  ]);
  $this
    ->getDiscovery()
    ->setDefinition('NotBlank', [
    'label' => new TranslatableMarkup('Not blank'),
    'class' => '\\Symfony\\Component\\Validator\\Constraints\\NotBlank',
    'type' => FALSE,
  ]);
  $this
    ->getDiscovery()
    ->setDefinition('Email', [
    'label' => new TranslatableMarkup('Email'),
    'class' => '\\Drupal\\Core\\Validation\\Plugin\\Validation\\Constraint\\EmailConstraint',
    'type' => [
      'string',
    ],
  ]);
}