« Newer Snippets
Older Snippets »
1 total  XML / RSS feed 

Gmap Module patch

// How to use Views to display Gmap of nodes of node-type?
// http://drupal.org/node/73420
// http://drupal.org/files/issues/gmap_view.patch

--- gmap.module  2006-07-15 12:23:18.000000000 -0700
+++ gmap.module.new   2006-07-15 12:22:42.000000000 -0700
@@ -1191,20 +1191,21 @@
  */
 function theme_views_view_gmap($view, $nodes) {
   $fields = _views_get_fields();
+       $markers = array();
   foreach ($nodes as $node) {
     $node_data = node_load(array("nid"=>$node->nid));
     $location = $node_data->location;
-    if (strlen($location['lat'])>0 && strlen($location['lon']>0)) {
-      $newmarker['label'] = '';
+    if (($location['lat']) && ($location['lon'])) {
+                       $marker_label = "";
       foreach ($view->field as $field) {
-        $newmarker['label'] .= "

" . views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node) . "</p>"; + $marker_label .= "<p>" . views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node) . "p>"; } - $newmarker['point']= $location['lat'] . ',' . $location['lon']; - $newmarker['markername']='drupal_view'; - $thismap['markers'][]= $newmarker; + $markers[] = array('markername'=>'view', + 'label' => $marker_label, + 'point' =>$location['lat'] . ',' . $location['lon']); } } + $thismap = array('id' => 'view_gmap', 'markers' => $markers); $output .= gmap_draw_map($thismap); return $output; } -

« Newer Snippets
Older Snippets »
1 total  XML / RSS feed