W3cubDocs

/Drupal 8

function hook_validation_constraint_alter

hook_validation_constraint_alter(array &$definitions)

Alter validation constraint plugin definitions.

Parameters

array[] $definitions: The array of validation constraint definitions, keyed by plugin ID.

See also

\Drupal\Core\Validation\ConstraintManager

\Drupal\Core\Validation\Annotation\Constraint

Related topics

Hooks
Define functions that alter the behavior of Drupal core.

File

core/core.api.php, line 2234
Documentation landing page and topics, plus core library hooks.

Code

function hook_validation_constraint_alter(array &$definitions) {
  $definitions['Null']['class'] = '\Drupal\mymodule\Validator\Constraints\MyClass';
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!core.api.php/function/hook_validation_constraint_alter/8.1.x