You are here

public function Map::getProperties in Drupal 9

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

Gets an array of property objects.

Parameters

bool $include_computed: If set to TRUE, computed properties are included. Defaults to FALSE.

Return value

\Drupal\Core\TypedData\TypedDataInterface[] An array of property objects implementing the TypedDataInterface, keyed by property name.

Throws

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

Overrides ComplexDataInterface::getProperties

5 calls to Map::getProperties()
LayoutSectionItem::__get in core/modules/layout_builder/src/Plugin/Field/FieldType/LayoutSectionItem.php
Magic method: Gets a property value.
Map::applyDefaultValue in core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php
Applies the default value.
Map::getIterator in core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php
Map::getString in core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php
Returns a string representation of the data.
Map::toArray in core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php
Returns an array of all property values.

File

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

Class

Map
The "map" data type.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function getProperties($include_computed = FALSE) {
  $properties = [];
  foreach ($this->definition
    ->getPropertyDefinitions() as $name => $definition) {
    if ($include_computed || !$definition
      ->isComputed()) {
      $properties[$name] = $this
        ->get($name);
    }
  }
  return $properties;
}