Issue #2229181 by pwolanin, Berdir, fago: MapItem::propertyDefinitions() claims it has a static value property, which is wrong.

8.0.x
Alex Pott 2014-05-14 17:44:50 -05:00
parent 902098c765
commit 78594ab63c
1 changed files with 11 additions and 4 deletions

View File

@ -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 @@ class MapItem extends FieldItemBase {
); );
} }
/**
* {@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}
*/ */