You are here

public function ItemList::getString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php \Drupal\Core\TypedData\Plugin\DataType\ItemList::getString()

Returns a string representation of the data.

Return value

string

Overrides TypedData::getString

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php, line 89
Contains \Drupal\Core\TypedData\Plugin\DataType\ItemList.

Class

ItemList
A generic list class.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function getString() {
  $strings = array();
  foreach ($this->list as $item) {
    $strings[] = $item
      ->getString();
  }

  // Remove any empty strings resulting from empty items.
  return implode(', ', array_filter($strings, '\\Drupal\\Component\\Utility\\Unicode::strlen'));
}