function openlayers_behaviors_process_draw_features in Openlayers 6
Callback for OpenLayers Behaviors (Draw Features)
Parameters
$behavior: Data about behavior
$map: Map array
Return value
Behavior array or FALSE if not valid
1 string reference to 'openlayers_behaviors_process_draw_features'
- openlayers_behaviors_openlayers_behaviors_info in modules/
openlayers_behaviors/ openlayers_behaviors.module - Implementation of hook_openlayers_behaviors_info().
File
- modules/
openlayers_behaviors/ includes/ openlayers_behaviors.behaviors.inc, line 144 - This file holds the main Drupal hook functions and private functions for the openlayers_behaviors module.
Code
function openlayers_behaviors_process_draw_features($behavior, &$map) {
// Check to make sure the layer attribute is properly set.
if ($behavior['layer'] && $map['layers'][$behavior['layer']]) {
// Add CSS
drupal_add_css(drupal_get_path('module', 'openlayers_behaviors') . '/openlayers_behaviors.css', 'module');
// Add mapReady Event
$map['events'] = $map['events'] ? $map['events'] : array();
$map['events']['mapReady'] = $map['events']['mapReady'] ? $map['events']['mapReady'] : array();
$map['events']['mapReady']['drawFeaturesMapReady'] = 'drawFeaturesMapReady';
// We can only ever have one map control - even if it handles multiple draw behaviors
return $behavior;
}
return FALSE;
}