function DataDefinition::getConstraints

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::getConstraints()
  2. 10 core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::getConstraints()
  3. 11.x core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::getConstraints()

Overrides DataDefinitionInterface::getConstraints

2 calls to DataDefinition::getConstraints()
DataDefinition::getConstraint in core/lib/Drupal/Core/TypedData/DataDefinition.php
Returns a validation constraint.
DataReferenceTargetDefinition::getConstraints in core/lib/Drupal/Core/TypedData/DataReferenceTargetDefinition.php
Returns an array of validation constraints.
1 method overrides DataDefinition::getConstraints()
DataReferenceTargetDefinition::getConstraints in core/lib/Drupal/Core/TypedData/DataReferenceTargetDefinition.php
Returns an array of validation constraints.

File

core/lib/Drupal/Core/TypedData/DataDefinition.php, line 261

Class

DataDefinition
A typed data definition class for defining data based on defined data types.

Namespace

Drupal\Core\TypedData

Code

public function getConstraints() {
    $constraints = isset($this->definition['constraints']) ? $this->definition['constraints'] : [];
    $constraints += $this->getTypedDataManager()
        ->getDefaultConstraints($this);
    return $constraints;
}

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