function Map::getValue

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

Overrides TypedData::getValue

4 calls to Map::getValue()
MapItem::toArray in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/MapItem.php
Returns an array of all property values.
MultiValueTestItem::isEmpty in core/modules/system/tests/modules/entity_test_update/src/Plugin/Field/FieldType/MultiValueTestItem.php
Determines whether the data structure is empty.
ShapeItem::isEmpty in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItem.php
Determines whether the data structure is empty.
UriItem::isEmpty in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php
Determines whether the data structure is empty.

File

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

Class

Map
The "map" data type.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function getValue() {
    // Update the values and return them.
    foreach ($this->properties as $name => $property) {
        $definition = $property->getDataDefinition();
        if (!$definition->isComputed()) {
            $value = $property->getValue();
            // Only write NULL values if the whole map is not NULL.
            if (isset($this->values) || isset($value)) {
                $this->values[$name] = $value;
            }
        }
    }
    return $this->values;
}

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