You are here

public function Cluster::optionsToObjects in Openlayers 7.3

Return a flat array containing Openlayers Objects from the options array.

Return value

ObjectInterface[] Return a list of objects.

Overrides Base::optionsToObjects

File

src/Plugin/Source/Cluster/Cluster.php, line 74
Source: Cluster.

Class

Cluster
Class Cluster.

Namespace

Drupal\openlayers\Plugin\Source\Cluster

Code

public function optionsToObjects() {
  $import = parent::optionsToObjects();
  if ($source = $this
    ->getOption('source')) {
    $source = Openlayers::load('source', $source);

    // This source is a dependency of the current one,
    // we need a lighter weight.
    $this
      ->setWeight($source
      ->getWeight() + 1);
    $import = array_merge($source
      ->getCollection()
      ->getFlatList(), $import);
  }
  return $import;
}