You are here

public function Map::getString 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::getString()
  2. 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php \Drupal\Core\TypedData\Plugin\DataType\Map::getString()

Returns a string representation of the data.

Return value

string The string representation of the data.

Overrides TypedData::getString

File

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

Class

Map
The "map" data type.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function getString() {
  $strings = [];
  foreach ($this
    ->getProperties() as $property) {
    $strings[] = $property
      ->getString();
  }

  // Remove any empty strings resulting from empty items.
  return implode(', ', array_filter($strings, 'mb_strlen'));
}