leaflet.install 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @file
  4. * Install, update, and uninstall functions for the leaflet module.
  5. */
  6. /**
  7. * Implements hook_requirements().
  8. */
  9. function leaflet_requirements($phase) {
  10. $requirements = array();
  11. $t = get_t();
  12. // Verify the Leaflet library is installed correctly.
  13. if (in_array($phase, array('runtime', 'update'))) {
  14. $library = libraries_detect('leaflet');
  15. $requirements['leaflet'] = array(
  16. 'title' => $t('Leaflet'),
  17. );
  18. if ($library['installed']) {
  19. $requirements['leaflet'] += array(
  20. 'value' => $library['version'],
  21. 'description' => t('The Leaflet Javascript library is installed correctly. @maps available.', array(
  22. '@maps' => format_plural(count(leaflet_map_get_info()),'One map', '@count maps'))),
  23. 'severity' => REQUIREMENT_OK,
  24. );
  25. }
  26. else {
  27. $requirements['leaflet'] += array(
  28. 'value' => $library['error'],
  29. 'description' => $library['error message'],
  30. 'severity' => REQUIREMENT_ERROR,
  31. );
  32. }
  33. }
  34. return $requirements;
  35. }