summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gmap.module36
1 files changed, 25 insertions, 11 deletions
diff --git a/gmap.module b/gmap.module
index 2d99654..14d4556 100644
--- a/gmap.module
+++ b/gmap.module
@@ -499,9 +499,19 @@ function gmap_regenerate_markers() {
$contents .= "// GMap marker image data.\n";
$contents .= "Drupal.gmap.iconpath = ". drupal_to_js(base_path() . drupal_get_path('module', 'gmap') .'/markers') .";\n";
- $contents .= "Drupal.gmap.icondata = ". drupal_to_js(gmap_get_icondata()) .";\n";
+ $contents .= "Drupal.gmap.icondata = ". drupal_to_js(gmap_get_icondata(TRUE)) .";\n";
file_save_data($contents, "$jspath/gmap_markers.js", FILE_EXISTS_REPLACE);
+
+ // Also regenerate the cached marker titles array
+ gmap_get_marker_titles(TRUE);
+}
+
+/**
+ * Implementation of hook_flush_caches().
+ */
+function gmap_flush_caches() {
+ gmap_regenerate_markers();
}
/**
@@ -973,19 +983,23 @@ function gmap_get_auto_mapid() {
*/
function gmap_get_marker_titles($reset = FALSE) {
static $titles;
- if (is_array($titles) && !$reset) {
- return $titles;
- }
- $titles = cache_get('gmap_marker_titles');
- if ($titles) {
- $titles = $titles->data;
- }
+ if (!reset) {
+ if (is_array($titles)) {
+ return $titles;
+ }
- if ($reset || !$titles) {
- require_once(drupal_get_path('module', 'gmap') .'/gmap_markerinfo.inc');
- $titles = _gmap_get_marker_titles();
+ $cached = cache_get('gmap_marker_titles', 'cache');
+ if (!empty($cached)) {
+ $titles = $cached->data;
+ if (is_array($titles)) {
+ return $titles;
+ }
+ }
}
+
+ require_once(drupal_get_path('module', 'gmap') .'/gmap_markerinfo.inc');
+ $titles = _gmap_get_marker_titles();
cache_set('gmap_marker_titles', $titles, 'cache');
return $titles;
}