public function OpenlayersService::getMapConfig in Openlayers 8.4
File
- src/
OpenlayersService.php, line 312
Class
- OpenlayersService
- Provides an OpenlayersService class.
Namespace
Drupal\openlayersCode
public function getMapConfig($map_id) {
$map_config = \Drupal::config('openlayers.openlayers_map.' . $map_id);
$map_settings = [];
// get Layers settings
if ($map_config
->get('layers') != NULL) {
$layers = [];
foreach ($map_config
->get('layers') as $layer_id => $layer) {
if ($layer != FALSE) {
$layers[$layer_id] = $this
->getLayerConfig($layer_id);
}
}
$map_settings['layers'] = $layers;
}
// get Interactions settings
if ($map_config
->get('interactions') != NULL) {
$interactions = [];
foreach ($map_config
->get('interactions') as $key => $interaction) {
if ($interaction != FALSE) {
$interactions[$key] = $interaction;
}
}
$map_settings['interactions'] = $interactions;
}
// get Controls settings
if ($map_config
->get('controls') != NULL) {
$controls = [];
foreach ($map_config
->get('controls') as $key => $control) {
if ($control != FALSE) {
$controls[$key] = $control;
}
}
$map_settings['controls'] = $controls;
}
return $map_settings;
}