You are here

public function Map::getValue in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php \Drupal\Core\TypedData\Plugin\DataType\Map::getValue()
  2. 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php \Drupal\Core\TypedData\Plugin\DataType\Map::getValue()

Gets the data value.

Return value

mixed The data value.

Overrides TypedData::getValue

6 calls to Map::getValue()
EntityReferenceItem::getValue in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
Gets the data value.
FieldTestItem::mustResave in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/FieldTestItem.php
Checks whether the field item value should be resaved.
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.

... See full list

1 method overrides Map::getValue()
EntityReferenceItem::getValue in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
Gets the data value.

File

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

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