openlayers/openlayers.module, line 122
- Versions
- 6
openlayers_intialize()
Intialize OpenLayers
Make sure that we have everything we need for OpenLayers
Parameters
$params Associative array of pamaters (none at the moment)
Return value
Boolean if intialization was succesful
Related topics
Code
<?php
function openlayers_intialize() {
$success = TRUE;
// Include the OpenLayers JS
// We need to check if it a local path or URL, but really only need to do it once.
static $included = FALSE;
if ($included == FALSE) {
$path = check_plain(variable_get('openlayers_source', 'http://openlayers.org/dev/OpenLayers.js'));
// Check for full URL
if (valid_url($path, TRUE)) {
// If URL, we have to manually include it in Drupal
drupal_set_html_head('<script src="'. check_url($path) .'" type="text/javascript"></script>');
}
else {
drupal_add_js($path);
}
// Add CSS
drupal_add_css(drupal_get_path('module', 'openlayers') .'/openlayers.css', 'module');
// Add base JS file
drupal_add_js(drupal_get_path('module', 'openlayers') .'/js/openlayers.js', 'module');
$included = TRUE;
}
return $success;
}
?> 