function openlayers_get_preset in Openlayers 6
OpenLayers Get Preset
Given an a string or integer, get full preset array
Parameters
$name: Name of preset
$reset: Boolean whether to reset cache
Return value
Array of preset data
Related topics
9 calls to openlayers_get_preset()
- openlayers_delete_preset in includes/
openlayers.features.inc - openlayers_features_export_render in includes/
openlayers.features.inc - Implementation of hook_features_export_render().
- openlayers_get_default_map in ./
openlayers.module - Get Default Map
- openlayers_get_map in ./
openlayers.module - OpenLayers Get Map
- openlayers_presets_ui_presets_manage_add_validate in modules/
openlayers_presets_ui/ includes/ openlayers_presets_ui.ui.inc - OpenLayers Preset Form Validate
File
- ./
openlayers.module, line 377 - Main OpenLayers API File
Code
function openlayers_get_preset($name = '', $reset = FALSE) {
$preset = array();
// Check for value
if (empty($name)) {
return $preset;
}
// Get presets
$presets = openlayers_get_presets('full', $reset);
$preset = $presets[$name];
if (empty($preset)) {
return array();
}
// Manipulate map
if (!is_array($preset['preset_data'])) {
$preset['preset_data'] = unserialize($preset['preset_data']);
}
// Put preset name into map array for safe keeping
$preset['preset_data']['preset_name'] = $preset['preset_name'];
// Remove any map id or errors
unset($preset['preset_data']['id']);
unset($preset['preset_data']['errors']);
return $preset;
}