diff --git a/core/lib/Drupal/Core/TypedData/TypedDataManager.php b/core/lib/Drupal/Core/TypedData/TypedDataManager.php index f12c31e..2b9d8dd 100644 --- a/core/lib/Drupal/Core/TypedData/TypedDataManager.php +++ b/core/lib/Drupal/Core/TypedData/TypedDataManager.php @@ -374,14 +374,6 @@ public function getConstraints($definition) { $constraints[] = $validation_manager->create('NotNull', array()); } - // If the definition does not provide a class use the class from the type - // definition for performing interface checks. - $class = isset($definition['class']) ? $definition['class'] : $type_definition['class']; - // Check if the class provides allowed values. - if (array_key_exists('Drupal\Core\TypedData\AllowedValuesInterface', class_implements($class)) && array_key_exists('Drupal\Core\TypedData\PrimitiveInterface', class_implements($class))) { - $constraints[] = $validation_manager->create('AllowedValues', array()); - } - return $constraints; } } diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php index 30dd181..ac4c3d1 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php @@ -12,8 +12,8 @@ /** * A common base class for configurable entity reference fields. * - * Extends the Core 'entity_reference_field' entity field item with common methods - * used in general configurable entity reference field. + * Extends the Core 'entity_reference_field' entity field item with common + * methods used in general configurable entity reference field. * * Required settings (below the definition's 'settings' key) are: * - target_type: The entity type to reference. diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/DataType/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Plugin/DataType/FilterFormat.php index 23b3b84..3fc45eb 100644 --- a/core/modules/filter/lib/Drupal/filter/Plugin/DataType/FilterFormat.php +++ b/core/modules/filter/lib/Drupal/filter/Plugin/DataType/FilterFormat.php @@ -51,4 +51,14 @@ public function getSettableOptions(AccountInterface $account = NULL) { // @todo: Avoid calling functions but move to injected dependencies. return array_map(function ($format) { return $format->label(); }, filter_formats($account)); } + + /** + * {@inheritdoc} + */ + public function getConstraints() { + $constraint_manager = \Drupal::typedData()->getValidationConstraintManager(); + $constraints = parent::getConstraints(); + $constraints[] = $constraint_manager->create('AllowedValues', array()); + return $constraints; + } }