gmap.api.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * @file
  4. * GMap plugin API.
  5. */
  6. /**
  7. * @addtogroup hooks
  8. * @{
  9. */
  10. /**
  11. * Change the way gmap works.
  12. *
  13. * @param string $op
  14. * The operation to be performed. Possible values:
  15. * - "macro": Add macro behaviors (Not well documented yet...)
  16. * - "pre_theme_map": A map is being themed. This is a good place to
  17. * drupal_add_js() any additional files needed to run the map in question.
  18. * - "macro_multiple": Add macro behaviors (Not well documented yet...)
  19. * - "behaviors": Define behavior flags used in your code.
  20. *
  21. * @param array $map
  22. * For the "pre_theme_map" operation, the map being themed. Not used in
  23. * other operations.
  24. *
  25. * @return array
  26. * This varies depending on the operation.
  27. * - "macro": An associative array. The keys are the macro keys, the values
  28. * are an array of flags for that macro key:
  29. * "multiple": This key can appear multiple times in a macro.
  30. * - "pre_theme_map": None.
  31. * - "macro_multiple": An array of macro keys that can appear multiple times.
  32. * (Oops, this appears to be redundant... Look into this. --Bdragon)
  33. * - "behaviors": An associative array. The keys are the names of the behavior
  34. * flags, and the values are associative arrays in the following format:
  35. * - "title": The title to show on the settings page.
  36. * - "default": The default state of the flag.
  37. * - "help": A description of the flag to show on the settings page.
  38. * - "internal": If TRUE, the flag will be marked as map specific, and
  39. * will not be stored in the defaults.
  40. */
  41. function hook_gmap($op, &$map) {
  42. switch ($op) {
  43. case 'macro':
  44. return array('feed' => array('multiple' => TRUE));
  45. case 'pre_theme_map':
  46. $path = drupal_get_path('module', 'gmap') . '/js/';
  47. if (is_array($map['feed'])) {
  48. drupal_add_js($path . 'markerloader_georss.js');
  49. }
  50. break;
  51. case 'macro_multiple':
  52. return array('feed');
  53. case 'behaviors':
  54. return array(
  55. 'nomousezoom' => array(
  56. 'title' => t('Disable mousezoom'),
  57. 'default' => FALSE,
  58. 'help' => t('Disable using the scroll wheel to zoom the map.'),
  59. ),
  60. );
  61. }
  62. }
  63. /**
  64. * @} End of "addtogroup hooks".
  65. */