public function Collection::getFlatList in Openlayers 7.3
Return an array with all the collection objects.
Parameters
array $types: Array of type to filter for. If set, only a list with objects of this type is returned.
Return value
\Drupal\openlayers\Types\ObjectInterface[] List of objects of this collection or list of a specific type of objects.
5 calls to Collection::getFlatList()
- Collection::getAttached in src/
Types/ Collection.php - Returns an array with all the attachments of the collection objects.
- Collection::getExport in src/
Types/ Collection.php - Get the collection as an export array with id's instead of objects.
- Collection::getJS in src/
Types/ Collection.php - Array with all the JS settings of the collection objects.
- Collection::getObjectById in src/
Types/ Collection.php - Return an object given an ID.
- Collection::getObjects in src/
Types/ Collection.php - Array with all the collection objects.
File
- src/
Types/ Collection.php, line 55 - Class Collection.
Class
- Collection
- Class Collection.
Namespace
Drupal\openlayers\TypesCode
public function getFlatList(array $types = array()) {
$list = $this->objects;
if (!empty($types)) {
$types = array_values($types);
array_walk($types, function (&$value) {
$value = drupal_strtolower($value);
});
$list = array_filter($this->objects, function ($obj) use ($types) {
/** @var Object $obj */
return in_array($obj
->getType(), $types);
});
}
uasort($list, function ($a, $b) {
return strnatcmp($a
->getWeight(), $b
->getWeight());
});
return $list;
}