Issue by effulgentsia, yched: Make TypedData implement PluginInspectionInterface.

8.0.x
Alex Pott 2013-06-18 00:33:02 +02:00
parent 9ee90ca16d
commit 94b0b70f93
1 changed files with 17 additions and 1 deletions
core/lib/Drupal/Core/TypedData

View File

@ -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 @@ abstract class TypedData implements TypedDataInterface {
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().
*/