Download & Extend

Location tokens not rendering in TITLES

Project:Location
Version:6.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:auto_nodetitle, location compatibility with other modules, token

Issue Summary

The tokens aren't rendering for the title. They just show up as [something] and so on.

I am using the latest tokens and auto_nodetitle modules. No one at auto_nodetitle has even responded to my issue, so I'm a little nervous about meeting a deadline!

Comments

#1

I am using auto_nodetitles 6.x-1.0 and token 6.x-1.11

#2

Bump.

#3

Title:Location tokens not rendering to auto_nodetitle» Location tokens not rendering
Version:6.x-3.0-rc2» 5.x-3.1-rc1

I having a similar issue - my location tokens are not being parsed.

I have this pattern set for my "Property" node/content type:

property/[term-raw]/[location-street_N]-[location-additional_N]

When I save a Property node, I get this:

property/affordable-housing/[location-street_n]-[location-additional_n]

Taking Setzler's suggestion that the Automatic Nodetitles module was in conflict, I disabled that module, but the problem persists.

#4

Title:Location tokens not rendering» Location tokens not rendering in TITLES

Bump.

#5

tagging

maybe #165678: Token module integration has an idea in the last comment or two.

I'm not familiar with tokens, but take a look at these and see if any of them might serve as a duplicate of this issue, or might have a solution for you:
http://drupal.org/project/issues/search/location?text=token&assigned=&su...

#6

Version:5.x-3.1-rc1» 6.x-3.1-rc1
Issue tags:+auto_nodetitle, +token

I'm having a similar issue. I've got auto_nodetitle enabled, a content type that has a location field via CCK, and a pattern for the node titles that involves location tokens. The first time I save the node, it's given a blank title. If I go back and edit the node, blanking out the title so that auto_nodetitle has another shot at it, it then gets the correct title.

#7

Version:6.x-3.1-rc1» 6.x-3.x-dev

<?php
/**
* Implementation of hook_token_values().
*/
function _location_token_values($type, $object = NULL) {
  if (
$type == 'node' || $type == 'user') {
    if (!empty(
$object->locations)) {
     
// @@@ Strip virtual fields?
     
foreach ($object->locations as $key => $location) {
        foreach (
$location as $field => $value) {
          if (!
is_array($value)) {
           
$values["location-{$field}_{$key}"] = check_plain($value);
          }
        }
       
// Backwards compatibility.
       
$values["location-provincename_$key"] = $values["location-province_name_$key"];
       
$values["location-countryname_$key"] = $values["location-country_name_$key"];
      }
      return
$values;
    }
  }
}
?>

if (!empty($object->locations)) always fails because the $object never has the locations object/array inside of it. See for your self...

<?php
/**
* Implementation of hook_token_values().
*/
function _location_token_values($type, $object = NULL) {
  if (
$type == 'node' || $type == 'user') {
   
file_put_contents('object.txt', $type . "\n" . print_r($object, TRUE) . "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", FILE_APPEND);
    if (!empty(
$object->locations)) {
     
// @@@ Strip virtual fields?
     
foreach ($object->locations as $key => $location) {
        foreach (
$location as $field => $value) {
          if (!
is_array($value)) {
           
$values["location-{$field}_{$key}"] = check_plain($value);
          }
        }
       
// Backwards compatibility.
       
$values["location-provincename_$key"] = $values["location-province_name_$key"];
       
$values["location-countryname_$key"] = $values["location-country_name_$key"];
      }
      return
$values;
    }
  }
}
?>

The CCK Field is in there, but there is no location object.

#8

subscribing

#9

You may be entering the token incorrectly.

This is wrong:
property/[term-raw]/[location-street_N]-[location-additional_N]

N should be replaced with the location number you are trying to access. If you only have one location attached to a node, it would be
property/[term-raw]/[location-street_0]-[location-additional_0]

#10

You may be entering the token incorrectly.

This is wrong:
[location-street_N] [location-additional_N] [location-city_N] [location-province_N] [location-postal_code_N]

N should be replaced with the location number you are trying to access. If you only have one location attached to a node, it would be
[location-street_0] [location-additional_0] [location-city_0] [location-province_0] [location-postal_code_0]

#11

Having the same issue. Using location CCK. There are two sets of tokens for location. Does this apply to location CCK as well?

This is wrong:
[location-street_N] [location-additional_N] [location-city_N] [location-province_N] [location-postal_code_N]

N should be replaced with the location number you are trying to access. If you only have one location attached to a node, it would be
[location-street_0] [location-additional_0] [location-city_0] [location-province_0] [location-postal_code_0]

CCK location tokens
[field_home_address-name]
[field_home_address-street]
[field_home_address-additional]
[field_home_address-city]
[field_home_address-province]
[field_home_address-postal_code]
[field_home_address-country] Country
[field_home_address-province_name]
[field_home_address-country_name]
[field_home_address-map_link]
[field_home_address-coords]

Location tokens
[location-name_N]
[location-street_N]
[location-additional_N]
[location-city_N]
[location-province_N]
[location-province_name_N]
[location-postal_code_N]
[location-latitude_N]
[location-longitude_N]
[location-country_N]
[location-country_name_N]

#12

For Location CCK tokens, see the comment here:
http://drupal.org/node/383244#comment-2252516

Works for me.

#13

There's also #322328: patch to fix location country name token does not work with pathauto which seems like a duplicate and has a patch rather than code in comment bodies.

#14

I'm seeing a problem with:
[location-province_N] - generates the full state name
[location-province_name_N] - generates nothing

How do you get the State abbreviation?

#15

@#14: I just fixed this in #322328.

#16

Still broken.
It is not taking pre-save validated and passing that to title, only reading (past) location saved to DB.
Might be node_autotitle which is not working properly with Location.

#17

Priority:critical» normal
Status:active» postponed (maintainer needs more info)

Could you please clarify?

Also, try the newest dev release, on a clean test site and write down exactly the steps to reproduce the error. Thanks.

#18

i'm trying to get location tokens for path settings and get just the raw token string...

for example i have a CCK image field where i want the file path (ie within files dir) to be /files/[postal_code_0]/THE_FILE_NAME using tokens, and this produces a folder literally called "[postal_code_0]" to be created in files directory... so the token isn't rendering (other tokens work fine)

using 6.x-3.x-dev

i've rummaged around and this seems to be a recurrent problem buts still no fix... any ideas at all?

#19

i've had the same problem but solved it, by removing the location as a cck field and instead used the location configuration in the content type configuration.

#20

Status:postponed (maintainer needs more info)» closed (fixed)

No response, so closing. Please post back and set status to active if there is still a problem.

(also try searching for token, probably a duplicate issue)
http://drupal.org/project/issues/location?order=last_comment_timestamp&s...

#21

#19 worked for me:

- Enable the "Node Locations" module
- Edit the content type you're using... There is a fieldgroup for "Locative Information"

nobody click here