Download & Extend

Using custom field for Marker Field results in markername getting set to the node id

Project:GMap Module
Version:7.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

I'm using Views 3 to display nodes on a gmap. I'm trying to use a custom field created with the Field module to set the markername property. So in the View's Gmap Settings, I have the Marker Handling set to "Use marker field". Then Marker Field set to "Content: Custom_Field".

With those settings, the markername gets set to the node id. As a result, I get the javascript pop-up: "Request for invalid marker set 71!". 71 is the node id of the node that was supposed to get plotted on the gmap.

If I use a native node field like the "Title", then markername gets set properly.

Comments

#1

Any progress on this bug? Do you need any more info from me?

#2

related to http://drupal.org/node/1326176

I'll make a patch for it.

#3

Patched!

AttachmentSizeStatusTest resultOperations
gmap_fix_for_field_marker.patch1.03 KBIgnored: Check issue status.NoneNone

#4

Status:active» needs review

#5

@ brunogoossens Thanks for the patch. It's working for me. I sure appreciate it.

#6

Version:7.x-1.x-dev» 7.x-2.x-dev

git apply --check gmap_fix_for_field_marker.patch
fatal: corrupt patch at line 26

#3 needs reroll against latest head

#7

Status:needs review» needs work

status

#8

Don't know if this is the case, but as in http://drupal.org/node/1153032, someone is using 'field_' . $marker_field_obj->field to search for the chosen field, instead of using $marker_field_obj->field_alias;

In Views 3.5 this does not work at all: the field result empty.

So change

<?php
~129
   
// Determine fieldname for marker field.
   
if ($this->options['markers'] == 'field') {
     
$marker_field_obj = $this->view->display_handler->get_handler('field', $this->options['markerfield']);
-     
$marker_field = 'field_' . $marker_field_obj->field;
+   
$marker_field = $marker_field_obj->field_alias;
    }
?>

and

<?php
~256
if (!empty($row->{$marker_field})) {
-             
$markername = $row->{$marker_field}[0]['raw']['value'];
+             
$markername = $row->{$marker_field};
}
?>

With those changes I am now able to choose the markername field in my view.

#9

#8 - can You provide a patch against dev for testing?

nobody click here