leaflet.install in Leaflet 7
Same filename and directory in other branches
Install, update, and uninstall functions for the leaflet module.
File
leaflet.installView source
<?php
/**
* @file
* Install, update, and uninstall functions for the leaflet module.
*/
/**
* Implements hook_requirements().
*/
function leaflet_requirements($phase) {
$requirements = array();
$t = get_t();
// Verify the Leaflet library is installed correctly.
if (in_array($phase, array(
'runtime',
'update',
))) {
$library = libraries_detect('leaflet');
$requirements['leaflet'] = array(
'title' => $t('Leaflet'),
);
if ($library['installed']) {
$requirements['leaflet'] += array(
'value' => $library['version'],
'description' => t('The Leaflet Javascript library is installed correctly. @maps available.', array(
'@maps' => format_plural(count(leaflet_map_get_info()), 'One map', '@count maps'),
)),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['leaflet'] += array(
'value' => $library['error'],
'description' => $library['error message'],
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}
Functions
Name | Description |
---|---|
leaflet_requirements | Implements hook_requirements(). |