function Map::toArray

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php \Drupal\Core\TypedData\Plugin\DataType\Map::toArray()
  2. 8.9.x core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php \Drupal\Core\TypedData\Plugin\DataType\Map::toArray()
  3. 11.x core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php \Drupal\Core\TypedData\Plugin\DataType\Map::toArray()

Overrides ComplexDataInterface::toArray

1 method overrides Map::toArray()
MapItem::toArray in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/MapItem.php
Returns an array of all property values.

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php, line 175

Class

Map
The "map" data type.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function toArray() {
    $values = [];
    foreach ($this->getProperties() as $name => $property) {
        $values[$name] = $property->getValue();
    }
    return $values;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.