You are here

function hook_gmap in GMap Module 7.2

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

Change the way gmap works.

Parameters

string $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.

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

Return value

array 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.
4 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
Implements hook_gmap().
gmap_style_bubbles_gmap in gmap_style_bubbles/gmap_style_bubbles.module
Enables 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.
4 invocations of hook_gmap()
GmapMacroToolbox::getParsedMacro in lib/Drupal/gmap/GmapMacroToolbox.php
Getting a parsed macro.
gmap_module_invoke in ./gmap.module
Invokes hook_gmap() in every module.
legacy_gmap_module_invoke in tests/inc/gmap_defaults.inc
Invokes hook_gmap() in every module.
legacy__gmap_parse_macro in tests/inc/gmap_parse_macro.inc

File

./gmap.api.php, line 44
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.'),
        ),
      );
  }
}