Active
Project:
GMap Module
Version:
6.x-1.1-rc1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Feb 2010 at 01:20 UTC
Updated:
3 Nov 2012 at 21:53 UTC
Theming locations in the nodetype.tpl.php works great for all variables except $map_link. It's available in location.tpl.php but not passed to the node templates. Is there a way to access this variable through a function call? The gmap_simple_map function works great for embedding a map in the node but for directions I need to print out the link back to Google. This would be a helpful feature if not already implemented.
Comments
Comment #1
teodor.sandu commentedI see no-one helped you, did you reach a solution? If so, please share with the community.
What I'd suggest is to use template.php - create a theme_preprocess_node_type() function (with your own theme name and node type of course) to inject that variable in the .tpl file. The Theme Developer plugin will show you exactly what's the function name. Have a dpm() of your first argument to see what variables you do get and what you can use to get the data you want. Then save it in the argument (it's passed by reference) and you'll have it in the .tpl for use.
I hope that was clear enough.
Comment #2
leenwebb commentedIn case anyone else comes across this -- I was also able to put this into my node.tpl and display the map link:
Comment #3
brentratliff commentedThanks guys. I ended up creating a view with the node id as the default argument and then attaching it to the node with views attach. This way I could use Display Suite plugin to layout the bubble as well.
Comment #4
megan_m commentedIn Drupal 7, try:
or just:
print location_map_link($content['field_location'][0]['#location']);