You are here

public function Snap::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/Interaction/Snap/Snap.php, line 45
Interaction: Snap.

Class

Snap
Class Snap.

Namespace

Drupal\openlayers\Plugin\Interaction\Snap

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;
}