function openlayers_libraries_info in Openlayers 7.3
Same name and namespace in other branches
- 7.2 openlayers.module \openlayers_libraries_info()
Implements hook_libraries_info().
File
- ./
openlayers.module, line 205 - Openlayers module.
Code
function openlayers_libraries_info() {
// During an upgrade from Openlayers 7.x-2.x branch, the new registry_autoload
// dependency may not be enabled, which makes it impossible to use the new
// namespaced classes. So provide a fallback variable instead.
$js_css_group = 'openlayers';
if (class_exists('\\Drupal\\openlayers\\Config')) {
$js_css_group = \Drupal\openlayers\Config::get('openlayers.js_css.group');
}
$info = system_get_info('module', 'openlayers');
$version = $info['version'] ? $info['version'] : '7.x-3.x';
$module_path = drupal_get_path('module', 'openlayers');
$libraries['openlayers3_integration'] = array(
'name' => 'Openlayers 3 Drupal integration files',
'vendor url' => 'https://drupal.org/project/openlayers',
'download url' => 'https://drupal.org/project/openlayers',
'version' => $version,
'library path' => $module_path,
'files' => array(
'js' => array(
$module_path . '/js/openlayers.js' => array(
'data' => $module_path . '/js/openlayers.js',
'type' => 'file',
'weight' => 8,
'group' => $js_css_group,
),
$module_path . '/js/openlayers.pluginManager.js' => array(
'data' => $module_path . '/js/openlayers.pluginManager.js',
'type' => 'file',
'weight' => 12,
'group' => $js_css_group,
),
$module_path . '/js/openlayers.behaviors.js' => array(
'data' => $module_path . '/js/openlayers.behaviors.js',
'type' => 'file',
'weight' => 14,
'group' => $js_css_group,
),
),
'css' => array(
$module_path . '/css/openlayers.css' => array(
'data' => $module_path . '/css/openlayers.css',
'type' => 'file',
'weight' => 4,
'group' => $js_css_group,
),
),
),
'variants' => array(
'debug' => array(
'files' => array(
'js' => array(
'js/openlayers.js' => array(
'type' => 'file',
'weight' => 8,
'group' => $js_css_group,
),
'js/openlayers.pluginManager.js' => array(
'type' => 'file',
'weight' => 12,
'group' => $js_css_group,
),
'js/openlayers.behaviors.js' => array(
'type' => 'file',
'weight' => 14,
'group' => $js_css_group,
),
'js/openlayers.console.js' => array(
'type' => 'file',
'weight' => 16,
'group' => $js_css_group,
),
'js/openlayers.debug.js' => array(
'type' => 'file',
'weight' => 18,
'group' => $js_css_group,
),
),
'css' => array(
'css/openlayers.css' => array(
'type' => 'file',
'weight' => 4,
'group' => $js_css_group,
),
),
),
),
),
);
$libraries['openlayers3'] = array(
'name' => 'Openlayers 3',
'vendor url' => 'http://openlayers.org/',
'download url' => 'https://github.com/openlayers/ol3/releases/download/v3.11.2/v3.11.2.zip',
'version callback' => array(
'\\Drupal\\openlayers\\Openlayers',
'getLibraryVersion',
),
'version arguments' => array(),
'library path' => $module_path,
// This is taken in account if the module libraries_cdn is enabled.
'cdn' => array(
'aliases' => array(
'ol3',
),
'options' => array(
'weight' => 0,
'group' => $js_css_group,
),
'request' => array(
// Maximum 10 seconds for the http requests to CDNs.
'timeout' => 10,
),
),
'variants' => array(),
'dependencies' => array(
'openlayers3_integration',
),
);
if ($version = \Drupal\openlayers\Openlayers::getLocalLibraryVersion()) {
unset($libraries['openlayers3']['library path']);
$libraries['openlayers3']['variants']['local:' . $version] = array(
'name' => 'Openlayers ' . $version,
'files' => array(
'js' => array(
'build/ol.js' => array(
'type' => 'file',
'weight' => 6,
'group' => $js_css_group,
),
),
'css' => array(
'css/ol.css' => array(
'type' => 'file',
'weight' => 4,
'group' => $js_css_group,
),
),
),
);
}
return $libraries;
}