function _openlayers_styles_process in Openlayers 6
Same name and namespace in other branches
- 6.2 includes/openlayers.render.inc \_openlayers_styles_process()
- 7.2 includes/openlayers.render.inc \_openlayers_styles_process()
Process Styles
Get full data for any styles
Parameters
$styles: Array of styles to process
$map: Map array
Return value
Array of processed styles
1 call to _openlayers_styles_process()
- openlayers_render_map in ./
openlayers.module - Render Map
File
- includes/
openlayers.render.inc, line 166 - This file holds the functions the extra processing of rendering a map
Code
function _openlayers_styles_process($styles = array(), &$map = array()) {
// Check input
if (!is_array($styles)) {
$styles = array();
}
if (!is_array($map)) {
$map = array();
}
// Initialized variables
$processed = array();
// Get behavior info array
$styles_info = openlayers_styles_get_info();
// Go through styles
foreach ($styles as $k => $style) {
// Check if array, if array, just pass on
if (is_array($style)) {
$processed[$k] = $style;
}
else {
// If not array, we want to include the file and call the function
if (($info = $styles_info[$style]) && is_array($styles_info[$style])) {
// Check if file exists
if (is_file('./' . $info['file'])) {
require_once './' . $info['file'];
// Check for function
if (function_exists($info['callback'])) {
// Call function and give it the style name
$result = $info['callback']($style, $map);
// Check for result
if (isset($result) && is_array($result)) {
$processed[$k] = $result;
}
}
}
}
}
}
// Run through theme function
$processed = theme('openlayers_vector_styles', $processed, $map);
// Return processed
return $processed;
}