Commit 94b0b70f authored by alexpott's avatar alexpott

Issue #2018323 by effulgentsia, yched: Make TypedData implement PluginInspectionInterface.

parent 9ee90ca1
...@@ -7,13 +7,15 @@ ...@@ -7,13 +7,15 @@
namespace Drupal\Core\TypedData; namespace Drupal\Core\TypedData;
use Drupal\Component\Plugin\PluginInspectionInterface;
/** /**
* The abstract base class for typed data. * The abstract base class for typed data.
* *
* Classes deriving from this base class have to declare $value * Classes deriving from this base class have to declare $value
* or override getValue() or setValue(). * or override getValue() or setValue().
*/ */
abstract class TypedData implements TypedDataInterface { abstract class TypedData implements TypedDataInterface, PluginInspectionInterface {
/** /**
* The data definition. * The data definition.
...@@ -63,6 +65,20 @@ public function getType() { ...@@ -63,6 +65,20 @@ public function getType() {
return $this->definition['type']; 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(). * Implements \Drupal\Core\TypedData\TypedDataInterface::getDefinition().
*/ */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment