You are here

function gmap_taxonomy_get_markers in GMap Module 7.2

Same name and namespace in other branches
  1. 7 gmap_taxonomy.module \gmap_taxonomy_get_markers()

Get all gmap taxonomy markers.

@todo move this to GmapTaxonomyCRUDi class Helper function to return cached version of gmap taxonomy markers from the database.

Return value

array Associative array of tid => marker.

1 call to gmap_taxonomy_get_markers()
gmap_taxonomy_node_update in ./gmap_taxonomy.module
Implements hook_node_update().

File

./gmap_taxonomy.module, line 280
GMap Taxonomy Markers

Code

function gmap_taxonomy_get_markers() {
  $gmap_taxonomy_markers =& drupal_static(__FUNCTION__);
  if (!isset($gmap_taxonomy_markers)) {
    if ($cache = cache_get('gmap_taxonomy_markers_data')) {
      $gmap_taxonomy_markers = $cache->data;
    }
    else {
      $gmap_taxonomy_markers = db_query('SELECT tid, marker FROM {gmap_taxonomy_term}')
        ->fetchAllKeyed();
      cache_set('gmap_taxonomy_markers_data', $gmap_taxonomy_markers, 'cache', CACHE_TEMPORARY);
    }
  }
  return $gmap_taxonomy_markers;
}