function getlocations_leaflet_requirements in Get Locations 7
Same name and namespace in other branches
- 7.2 modules/getlocations_leaflet/getlocations_leaflet.install \getlocations_leaflet_requirements()
Implements hook_requirements().
File
- modules/
getlocations_leaflet/ getlocations_leaflet.install, line 16 - getlocations_leaflet.install @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_leaflet_requirements($phase) {
$requirements = array();
// Ensure js library is available.
if ($phase != 'runtime') {
return $requirements;
}
// Ensure js library is installed. Show number of maps avaialble.
if (file_exists(libraries_get_path('leaflet') . '/leaflet.js')) {
$maps = getlocations_leaflet_map_get_info();
$version = getlocations_leaflet_library_version();
$requirements['leaflet'] = array(
'title' => t('Leaflet library'),
'value' => t('@v Installed. @maps available.', array(
'@v' => $version ? 'Version ' . $version : '',
'@maps' => format_plural(count($maps['Getlocations OSM']['map_layers']), 'One map', '@count maps'),
)),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['leaflet'] = array(
'title' => t('Leaflet library not found'),
'value' => t('The !leaflet javascript library was not found. Please !download it and unzip the files into <em>sites/all/libraries/leaflet</em>. You can also use "drush getlocations-leaflet".', array(
'!leaflet' => l('Leaflet', 'http://leafletjs.com'),
'!download' => l('download', 'http://leafletjs.com/download.html'),
)),
'severity' => REQUIREMENT_ERROR,
);
}
return $requirements;
}