From 94b0b70f93d4d0ecf72a79214f7dcac7800e5b37 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 18 Jun 2013 00:33:02 +0200 Subject: [PATCH] Issue #2018323 by effulgentsia, yched: Make TypedData implement PluginInspectionInterface. --- core/lib/Drupal/Core/TypedData/TypedData.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/core/lib/Drupal/Core/TypedData/TypedData.php b/core/lib/Drupal/Core/TypedData/TypedData.php index 7ea33f062f..62fb8d95cd 100644 --- a/core/lib/Drupal/Core/TypedData/TypedData.php +++ b/core/lib/Drupal/Core/TypedData/TypedData.php @@ -7,13 +7,15 @@ namespace Drupal\Core\TypedData; +use Drupal\Component\Plugin\PluginInspectionInterface; + /** * The abstract base class for typed data. * * Classes deriving from this base class have to declare $value * or override getValue() or setValue(). */ -abstract class TypedData implements TypedDataInterface { +abstract class TypedData implements TypedDataInterface, PluginInspectionInterface { /** * The data definition. @@ -63,6 +65,20 @@ public function getType() { return $this->definition['type']; } + /** + * {@inheritdoc} + */ + public function getPluginId() { + return $this->definition['type']; + } + + /** + * {@inheritdoc} + */ + public function getPluginDefinition() { + return \Drupal::typedData()->getDefinition($this->definition['type']); + } + /** * Implements \Drupal\Core\TypedData\TypedDataInterface::getDefinition(). */ -- GitLab