You are here

public function Collection::getAttached in Openlayers 7.3

Returns an array with all the attachments of the collection objects.

Return value

array Array with all the attachments of the collection objects.

File

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

Class

Collection
Class Collection.

Namespace

Drupal\openlayers\Types

Code

public function getAttached() {
  $attached = array();
  foreach ($this
    ->getFlatList() as $object) {
    $object_attached = $object
      ->attached() + array(
      'js' => array(),
      'css' => array(),
      'library' => array(),
      'libraries_load' => array(),
    );
    foreach (array(
      'js',
      'css',
      'library',
      'libraries_load',
    ) as $type) {
      foreach ($object_attached[$type] as $data) {
        if (isset($attached[$type])) {
          array_unshift($attached[$type], $data);
        }
        else {
          $attached[$type] = array(
            $data,
          );
        }
      }
    }
  }
  return $attached;
}