You are here

public function Random::optionsToObjects in Openlayers 7.3

Same name in this branch
  1. 7.3 modules/openlayers_library/src/Plugin/Style/Random/Random.php \Drupal\openlayers_library\Plugin\Style\Random\Random::optionsToObjects()
  2. 7.3 modules/openlayers_library/src/Plugin/Source/Random/Random.php \Drupal\openlayers_library\Plugin\Source\Random\Random::optionsToObjects()

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

Return value

ObjectInterface[] Return a list of objects.

Overrides Base::optionsToObjects

File

modules/openlayers_library/src/Plugin/Style/Random/Random.php, line 39
Style: Random.

Class

Random
Class Random.

Namespace

Drupal\openlayers_library\Plugin\Style\Random

Code

public function optionsToObjects() {
  $import = parent::optionsToObjects();
  if ($styles = $this
    ->getOption('style', array())) {
    foreach ($styles as $style) {
      $style = Openlayers::load('style', $style);

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