public function EntityReferenceFieldItemList::getConstraints
public EntityReferenceFieldItemList::getConstraints()
Gets a list of validation constraints.
Return value
array Array of constraints, each being an instance of \Symfony\Component\Validator\Constraint.
Overrides FieldItemList::getConstraints
File
- core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php, line 16
Class
- EntityReferenceFieldItemList
- Defines a item list class for entity reference fields.
Namespace
Drupal\Core\FieldCode
public function getConstraints() { $constraints = parent::getConstraints(); $constraint_manager = $this->getTypedDataManager()->getValidationConstraintManager(); $constraints[] = $constraint_manager->create('ValidReference', []); return $constraints; }
© 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!Field!EntityReferenceFieldItemList.php/function/EntityReferenceFieldItemList::getConstraints/8.1.x