Skip to content
Snippets Groups Projects
Commit 78594ab6 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2229181 by pwolanin, Berdir, fago: MapItem::propertyDefinitions()...

Issue #2229181 by pwolanin, Berdir, fago: MapItem::propertyDefinitions() claims it has a static value property, which is wrong.
parent 902098c7
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -27,10 +27,8 @@ class MapItem extends FieldItemBase { ...@@ -27,10 +27,8 @@ class MapItem extends FieldItemBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) { public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['value'] = DataDefinition::create('string') // The properties are dynamic and can not be defined statically.
->setLabel(t('Serialized values')); return array();
return $properties;
} }
/** /**
...@@ -48,6 +46,15 @@ public static function schema(FieldStorageDefinitionInterface $field_definition) ...@@ -48,6 +46,15 @@ public static function schema(FieldStorageDefinitionInterface $field_definition)
); );
} }
/**
* {@inheritdoc}
*/
public function toArray() {
// The default implementation of toArray() only returns known properties.
// For a map, return everything as the properties are not pre-defined.
return $this->getValue();
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment