adding token hooks for location
khoogheem - September 5, 2007 - 21:43
| Project: | Location |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Description
I have created a pathnode_auto_location.inc file with:
function pathauto_node_location_token_list($type = 'all') {
if ($type == 'node' || $type == 'all') {
$tokens['node']['countrycode'] = t("Two Letter Country Code.");
$tokens['node']['countryname'] = t("English country name.");
return $tokens;
}
}
/*
* Implementation of hook_token_values()
*/
function pathauto_node_location_token_values($type, $object = NULL) {
if ($type == 'node') {
$countries = _location_get_iso3166_list();
$tokens['countrycode'] = $location['country'];
$tokens['countryname'] = pathauto_cleanstring($countries[$location['country']]);
return $tokens;
}
}However nothing shows up. I have some nodes with country location stored and want to get pathauto to generate urls that would be such http://www.example.com/netherlands/blah such that when multiple titles might have the same name it will be easy to tell that it is assigned to that country.
what am I missing?
thanks for the help

#1
Here are some token hooks for location module. This will enable use of Location with modules like pathauto, auto node title, custom breadcrumbs, etc. Seems really handy to me. If one or two other people could test them to make sure it works then I think we can commit it.
#2
Thanks..
They show up in pathauto as an option but when I put them into my video nodes
[countryname]/[title]
I still only get [title]
I tried even putting it into the catchall and that still only sets it to [title]
#3
Tracking.
#4
http://drupal.org/node/165678
#5
There's a bug in greggles patch.
The line:
if (isset($node->location)) {
should read:
if (isset($object->location)) {