You are here

public function MapItem::toArray in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/MapItem.php \Drupal\Core\Field\Plugin\Field\FieldType\MapItem::toArray()

Returns an array of all property values.

Gets an array of plain property values including all not-computed properties.

Return value

array An array of property values, keyed by property name.

Throws

\Drupal\Core\TypedData\Exception\MissingDataException If the complex data structure is unset and no property can be created.

Overrides Map::toArray

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldType/MapItem.php, line 47

Class

MapItem
Defines the 'map' entity field type.

Namespace

Drupal\Core\Field\Plugin\Field\FieldType

Code

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();
}