public function Vector::getJS in Openlayers 7.3
!Attention! This function will remove any option that is named after a plugin type e.g.: layers, controls, styles, interactions, components .
Overrides Base::getJS
File
- src/
Plugin/ Layer/ Vector/ Vector.php, line 42 - Layer: Vector.
Class
- Vector
- Class Vector.
Namespace
Drupal\openlayers\Plugin\Layer\VectorCode
public function getJS() {
$js = parent::getJS();
// Ensure we've sane zoom levels.
if (!empty($js['opt']['zoomActivity'])) {
$js['opt']['zoomActivity'] = array_map('intval', explode("\n", $js['opt']['zoomActivity']));
// Ensure the values are sorted.
sort($js['opt']['zoomActivity']);
// Ensure the zoom levels are also used as keys.
$js['opt']['zoomActivity'] = array_combine($js['opt']['zoomActivity'], $js['opt']['zoomActivity']);
}
return $js;
}