You are here

function hook_gmap in GMap Module 6.2

Same name and namespace in other branches
  1. 5 gmap.php \hook_gmap()
  2. 6 gmap.php \hook_gmap()
  3. 7.2 gmap.api.php \hook_gmap()
  4. 7 gmap.php \hook_gmap()

Change the way gmap works.

Parameters

$op: The operation to be performed. Possible values:

  • "macro": Add macro behaviors (Not well documented yet...)
  • "pre_theme_map": A map is being themed. This is a good place to drupal_add_js() any additional files needed to run the map in question.
  • "macro_multiple": Add macro behaviors (Not well documented yet...)
  • "behaviors": Define behavior flags used in your code.

$map: For the "pre_theme_map" operation, the map being themed. Not used in other operations.

Return value

This varies depending on the operation.

  • "macro": An associative array. The keys are the macro keys, the values are an array of flags for that macro key: "multiple": This key can appear multiple times in a macro.
  • "pre_theme_map": None.
  • "macro_multiple": An array of macro keys that can appear multiple times. (Oops, this appears to be redundant... Look into this. --Bdragon)
  • "behaviors": An associative array. The keys are the names of the behavior flags, and the values are associative arrays in the following format:

    • "title": The title to show on the settings page.
    • "default": The default state of the flag.
    • "help": A description of the flag to show on the settings page.
    • "internal": If TRUE, the flag will be marked as map specific, and will not be stored in the defaults.
3 functions implement hook_gmap()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

gmap_gmap in ./gmap.module
Implementation of hook_gmap().
template_preprocess_gmap_view_gmap in ./gmap.module
Preprocess function for theme_gmap_view_gmap().
theme_gmap in ./gmap.module
Gmap element theme hook
2 invocations of hook_gmap()
gmap_module_invoke in ./gmap.module
Invokes hook_gmap() in every module.
_gmap_parse_macro in ./gmap_parse_macro.inc

File

./gmap.php, line 42
GMap plugin API.

Code

function hook_gmap($op, &$map) {
  switch ($op) {
    case 'macro':
      return array(
        'feed' => array(
          'multiple' => TRUE,
        ),
      );
    case 'pre_theme_map':
      $path = drupal_get_path('module', 'gmap') . '/js/';
      if (is_array($map['feed'])) {
        drupal_add_js($path . 'markerloader_georss.js');
      }
      break;
    case 'macro_multiple':
      return array(
        'feed',
      );
    case 'behaviors':
      return array(
        'nomousezoom' => array(
          'title' => t('Disable mousezoom'),
          'default' => FALSE,
          'help' => t('Disable using the scroll wheel to zoom the map.'),
        ),
      );
  }
}