Closed (won't fix)
Project:
GMap Module
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Dec 2009 at 11:14 UTC
Updated:
14 Apr 2013 at 23:19 UTC
Hello,
I tried to add a gmap card in my nodes with the combination of gmap and location. I implemented a node api this way and it works fine :
function gmap_node_nodeapi(&$node, $op){
if ($op == 'view'){
if (isset ($node->locations)){
// $info = array();
$info = array (
'#settings' => array(
'id' => 'auto1map',
'latitude' => $node->locations[0]['latitude'],
'longitude' => $node->locations[0]['longitude'],
),
);
foreach ($node->locations as $location){
$info['#settings']['markers'][] = array(
'latitude' => $location['latitude'],
'longitude' => $location['longitude'],
'markername'=>'small gray');
}
$output = theme ('gmap', $info);
$node->content['gmap']['#value'] = $output;
}
}
}
What do you think of this piece of code? I know thats there's still work to do in order to generise this features. Ideas are welcome.
Comments
Comment #1
As If commentedTypically the field will be called something like "field_location". But yes, this works.
Comment #2
johnvClosing this very old issue. Please reopen if it is still valid.