i have different nodes with getLocations field and a parent node in relation with
those locations.
I would like to attach a view/block to the parent node with predefined getDirection map
showing locations_via for all those points.
How to do it? I saw getDirection block but I able to use it only for location from/to.

i also would like to show only the map and not the direction information.

any help?
thanks

Comments

hutch’s picture

I think the only way to get this into a block would be to put some php code into the block. You will need "PHP filter" enabled under modules > core, then add a new block in which you could insert some code, something like this:

// a list of node ids
$list = "1,2,3,4,5";
// map size
$width = "200px";
$height = "200px";
$output = getdirections_setlocations_via($list, $width, $height);
$style = "<style>.getdirections-list {display: none;}</style>";
print $style;
print $output;

This has not been tested.
The directions are generated by google, so you can try to hide them with $style.

You can copy function theme_getdirections_show_locations_via() to your theme's template.php, renaming it of course and do further alterations there. For instance, to detect that you are coming from the block and not a regular page you could look at the $width and $height variables which presumably are different for the block.

leo82’s picture

thanks Hutch
it works and automatically show map without directions. I don't know how ;)

But i'm newbie of Drupal and I don't know how to keep child node ID instead of a predefined list of node
such as 1,2,3 ....

could you help me?

hutch’s picture

I'm not clear what you mean by "child node ID"

leo82’s picture

I have a content type "trip" that has a relation with content type "stop",
trip is composed by stop (having a location)

I would like to show the complete path (composed by stop) in content type "trip"
in the map.

I have associated the block to content type trip and put your code in the block.
But i don't know how to know the child node ID (ID of the stops that compose the route)

In view I managed it with contextual filter, in this way in each trip I can show the related stop

I hope this can clarify my doubt

hutch’s picture

You would need to write code to do the lookups in the database and that requires some expertise.