summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/TypedData/TypedData.php
diff options
context:
space:
mode:
authoreffulgentsia2015-10-05 21:31:21 (GMT)
committereffulgentsia2015-10-05 21:31:21 (GMT)
commitb6707fca2eeb91bf96c3c652bef0ec39b21fec6e (patch)
tree8b31d733a93cd7b58fb84f52e6dad6584754e220 /core/lib/Drupal/Core/TypedData/TypedData.php
parent641eb3f8d74234757c07c4ffff2048b0cfbefdba (diff)
Issue #2488568 by Jose Reyero, alexpott, Gábor Hojtsy, tstoeckler: Add a TypedDataManagerInterface and use it for typed parameters
Diffstat (limited to 'core/lib/Drupal/Core/TypedData/TypedData.php')
-rw-r--r--core/lib/Drupal/Core/TypedData/TypedData.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/lib/Drupal/Core/TypedData/TypedData.php b/core/lib/Drupal/Core/TypedData/TypedData.php
index 92c8a89..a266daa 100644
--- a/core/lib/Drupal/Core/TypedData/TypedData.php
+++ b/core/lib/Drupal/Core/TypedData/TypedData.php
@@ -21,6 +21,7 @@ use Drupal\Core\StringTranslation\StringTranslationTrait;
abstract class TypedData implements TypedDataInterface, PluginInspectionInterface {
use StringTranslationTrait;
+ use TypedDataTrait;
/**
* The data definition.
@@ -85,7 +86,7 @@ abstract class TypedData implements TypedDataInterface, PluginInspectionInterfac
* {@inheritdoc}
*/
public function getPluginDefinition() {
- return \Drupal::typedDataManager()->getDefinition($this->definition->getDataType());
+ return $this->getTypedDataManager()->getDefinition($this->definition->getDataType());
}
/**
@@ -124,8 +125,7 @@ abstract class TypedData implements TypedDataInterface, PluginInspectionInterfac
* {@inheritdoc}
*/
public function getConstraints() {
- // @todo: Add the typed data manager as proper dependency.
- $constraint_manager = \Drupal::typedDataManager()->getValidationConstraintManager();
+ $constraint_manager = $this->getTypedDataManager()->getValidationConstraintManager();
$constraints = array();
foreach ($this->definition->getConstraints() as $name => $options) {
$constraints[] = $constraint_manager->create($name, $options);
@@ -137,8 +137,7 @@ abstract class TypedData implements TypedDataInterface, PluginInspectionInterfac
* {@inheritdoc}
*/
public function validate() {
- // @todo: Add the typed data manager as proper dependency.
- return \Drupal::typedDataManager()->getValidator()->validate($this);
+ return $this->getTypedDataManager()->getValidator()->validate($this);
}
/**