function hook_openlayers_behaviors_info in Openlayers 6
OpenLayers Behaviors Info
This hook tells OpenLayers about the available behaviors that can be used by name in maps.
Return value
Return a nested associative array with the top level being a unique string identifier, and the nested array containing the following key/pairs:
- "name": Translated name of the behavior.
- "description": Translates description.
- "file": The Drupal path for where the PHP callback is stored
- "callback": The name of the PHP function that will be called when the behavior is rendered
- "js_file": The Drupal path for where the JS callback is stored
- "js_callback": The name of the JS function that will be called when the behavior is rendered. This will be a function of the OL.Behaviors object
1 function implements hook_openlayers_behaviors_info()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- openlayers_behaviors_openlayers_behaviors_info in modules/
openlayers_behaviors/ openlayers_behaviors.module - Implementation of hook_openlayers_behaviors_info().
1 invocation of hook_openlayers_behaviors_info()
- openlayers_behaviors_get_info in ./
openlayers.module - Get Behavior Info
File
- docs/
openlayers.api.php, line 133 - Hooks provided by the OpenLayers suite of modules.
Code
function hook_openlayers_behaviors_info() {
// Taken from openlayers_behaviors.module
$file = drupal_get_path('module', 'openlayers_behaviors') . '/includes/openlayers_behaviors.behaviors.inc';
$js_file = drupal_get_path('module', 'openlayers_behaviors') . '/js/openlayers_behaviors.behaviors.js';
$info = array();
// Define info array
$info['openlayers_behaviors_zoom_to_layer'] = array(
'name' => t('Zoom to Layer'),
'description' => t('When the map is finished loading, zoom to the features contained within the given layer'),
'file' => $file,
'callback' => 'openlayers_behaviors_process_zoom_to_layer',
'js_file' => $js_file,
'js_callback' => 'zoomToLayer',
);
return $info;
}