diff --git a/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php b/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php index 7ba7ea6..60df650 100644 --- a/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php +++ b/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php @@ -25,8 +25,8 @@ /** * Overrides \Drupal\Core\TypedData\TypedData::__construct(). */ - public function __construct(array $definition, $name = NULL, TypedDataInterface $parent = NULL) { - parent::__construct($definition, $name, $parent); + public function __construct(array $definition, $plugin_id, array $plugin_definition, $name = NULL, TypedDataInterface $parent = NULL) { + parent::__construct($definition, $plugin_id, $plugin_definition, $name, $parent); // Initialize computed properties by default, such that they get cloned // with the whole item. foreach ($this->getPropertyDefinitions() as $name => $definition) { diff --git a/core/lib/Drupal/Core/Entity/Field/Type/EntityWrapper.php b/core/lib/Drupal/Core/Entity/Field/Type/EntityWrapper.php index f6f224e..c819ead 100644 --- a/core/lib/Drupal/Core/Entity/Field/Type/EntityWrapper.php +++ b/core/lib/Drupal/Core/Entity/Field/Type/EntityWrapper.php @@ -61,8 +61,8 @@ class EntityWrapper extends TypedData implements IteratorAggregate, ComplexDataI /** * Overrides TypedData::__construct(). */ - public function __construct(array $definition, $name = NULL, TypedDataInterface $parent = NULL) { - parent::__construct($definition, $name, $parent); + public function __construct(array $definition, $plugin_id, array $plugin_definition, $name = NULL, TypedDataInterface $parent = NULL) { + parent::__construct($definition, $plugin_id, $plugin_definition, $name, $parent); $this->entityType = isset($this->definition['constraints']['EntityType']) ? $this->definition['constraints']['EntityType'] : NULL; } diff --git a/core/lib/Drupal/Core/Entity/Field/Type/Field.php b/core/lib/Drupal/Core/Entity/Field/Type/Field.php index af45ada..ecf0e8e 100644 --- a/core/lib/Drupal/Core/Entity/Field/Type/Field.php +++ b/core/lib/Drupal/Core/Entity/Field/Type/Field.php @@ -36,8 +36,8 @@ class Field extends ItemList implements FieldInterface { /** * Overrides TypedData::__construct(). */ - public function __construct(array $definition, $name = NULL, TypedDataInterface $parent = NULL) { - parent::__construct($definition, $name, $parent); + public function __construct(array $definition, $plugin_id, array $plugin_definition, $name = NULL, TypedDataInterface $parent = NULL) { + parent::__construct($definition, $plugin_id, $plugin_definition, $name, $parent); // Always initialize one empty item as most times a value for at least one // item will be present. That way prototypes created by // \Drupal\Core\TypedData\TypedDataManager::getPropertyInstance() will diff --git a/core/lib/Drupal/Core/TypedData/TypedData.php b/core/lib/Drupal/Core/TypedData/TypedData.php index 7ea33f0..1fcd55d 100644 --- a/core/lib/Drupal/Core/TypedData/TypedData.php +++ b/core/lib/Drupal/Core/TypedData/TypedData.php @@ -7,13 +7,16 @@ namespace Drupal\Core\TypedData; +use Drupal\Component\Plugin\PluginBase; +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 extends PluginBase implements TypedDataInterface, PluginInspectionInterface { /** * The data definition. @@ -41,6 +44,10 @@ * * @param array $definition * The data definition. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param array $plugin_definition + * The plugin implementation definition. * @param string $name * (optional) The name of the created property, or NULL if it is the root * of a typed data tree. Defaults to NULL. @@ -50,8 +57,10 @@ * * @see Drupal\Core\TypedData\TypedDataManager::create() */ - public function __construct(array $definition, $name = NULL, TypedDataInterface $parent = NULL) { + public function __construct(array $definition, $plugin_id, array $plugin_definition, $name = NULL, TypedDataInterface $parent = NULL) { $this->definition = $definition; + $this->pluginId = $plugin_id; + $this->pluginDefinition = $plugin_definition; $this->parent = $parent; $this->name = $name; } diff --git a/core/lib/Drupal/Core/TypedData/TypedDataFactory.php b/core/lib/Drupal/Core/TypedData/TypedDataFactory.php index ef67cf2..1521eff 100644 --- a/core/lib/Drupal/Core/TypedData/TypedDataFactory.php +++ b/core/lib/Drupal/Core/TypedData/TypedDataFactory.php @@ -57,6 +57,8 @@ public function createInstance($plugin_id, array $configuration, $name = NULL, $ if (!isset($class)) { throw new PluginException(sprintf('The plugin (%s) did not specify an instance class.', $plugin_id)); } - return new $class($configuration, $name, $parent); + + return new $class($configuration, $plugin_id, $type_definition, $name, $parent); } + } diff --git a/core/modules/locale/lib/Drupal/locale/LocaleTypedConfig.php b/core/modules/locale/lib/Drupal/locale/LocaleTypedConfig.php index 5d6b200..abb833b 100644 --- a/core/modules/locale/lib/Drupal/locale/LocaleTypedConfig.php +++ b/core/modules/locale/lib/Drupal/locale/LocaleTypedConfig.php @@ -50,8 +50,13 @@ class LocaleTypedConfig extends Element { * @param \Drupal\locale\LocaleConfigManager $localeConfig; * The locale configuration manager object. */ + // @todo Figure out signature. public function __construct(array $definition, $name, $langcode, \Drupal\locale\LocaleConfigManager $localeConfig) { - parent::__construct($definition, $name); + // @todo parent::__construct() needs a $plugin_id and $plugin_definition, + // but not sure how to get those. + $plugin_id = ''; + $plugin_definition = array(); + parent::__construct($definition, $plugin_id, $plugin_definition, $name); $this->langcode = $langcode; $this->localeConfig = $localeConfig; } diff --git a/core/modules/text/lib/Drupal/text/TextProcessed.php b/core/modules/text/lib/Drupal/text/TextProcessed.php index 3a44722..02e5883 100644 --- a/core/modules/text/lib/Drupal/text/TextProcessed.php +++ b/core/modules/text/lib/Drupal/text/TextProcessed.php @@ -37,8 +37,8 @@ class TextProcessed extends TypedData { /** * Overrides TypedData::__construct(). */ - public function __construct(array $definition, $name = NULL, TypedDataInterface $parent = NULL) { - parent::__construct($definition, $name, $parent); + public function __construct(array $definition, $plugin_id, array $plugin_definition, $name = NULL, TypedDataInterface $parent = NULL) { + parent::__construct($definition, $plugin_id, $plugin_definition, $name, $parent); if (!isset($definition['settings']['text source'])) { throw new InvalidArgumentException("The definition's 'source' key has to specify the name of the text property to be processed.");