You are here

public function GeofieldWidget::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

modules/openlayers_geofield/src/Plugin/Component/GeofieldWidget/GeofieldWidget.php, line 100
Component: GeofieldWidget.

Class

GeofieldWidget
Class GeofieldWidget.

Namespace

Drupal\openlayers_geofield\Plugin\Component\GeofieldWidget

Code

public function optionsToObjects() {
  $import = parent::optionsToObjects();
  if ($style = $this
    ->getOption('editStyle')) {
    $style = Openlayers::load('style', $style);
    $this
      ->setWeight($style
      ->getWeight() + 1);
    $import = array_merge($style
      ->getCollection()
      ->getFlatList(), $import);
  }
  if ($layer = $this
    ->getOption('editLayer')) {
    $layer = Openlayers::load('layer', $layer);
    $import = array_merge($layer
      ->getCollection()
      ->getFlatList(), $import);
  }
  if ($control = $this
    ->getOption('editControl')) {
    $control = Openlayers::load('control', $control);
    $import = array_merge($control
      ->getCollection()
      ->getFlatList(), $import);
  }
  return $import;
}