public ConstraintManager::create($name, $options)
Creates a validation constraint.
string $name: The name or plugin id of the constraint.
mixed $options: The options to pass to the constraint class. Required and supported options depend on the constraint class.
\Symfony\Component\Validator\Constraint A validation constraint plugin.
public function create($name, $options) { if (!is_array($options)) { // Plugins need an array as configuration, so make sure we have one. // The constraint classes support passing the options as part of the // 'value' key also. $options = isset($options) ? array('value' => $options) : array(); } return $this->createInstance($name, $options); }
© 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!lib!Drupal!Core!Validation!ConstraintManager.php/function/ConstraintManager::create/8.1.x