Issue #2018323 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

View File

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