You are here

public function Collection::getObjects in Openlayers 7.3

Array with all the collection objects.

Parameters

string $type: Type to filter for. If set only a list with objects of this type is returned.

Return value

array|ObjectInterface[] List of objects of this collection or list of a specific type of objects.

File

src/Types/Collection.php, line 166
Class Collection.

Class

Collection
Class Collection.

Namespace

Drupal\openlayers\Types

Code

public function getObjects($type = NULL) {
  if ($type == NULL) {
    $list = array();
    foreach ($this
      ->getFlatList() as $object) {
      $list[$object
        ->getType()][] = $object;
    }
    return array_change_key_case($list, CASE_LOWER);
  }
  return $this
    ->getFlatList(array(
    $type,
  ));
}