Closed (fixed)
Project:
Address field for CCK
Version:
5.x-2.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Jan 2008 at 05:21 UTC
Updated:
23 Jul 2009 at 03:31 UTC
Hello.
I would like to use the auto nodetitle module to create a title using the city and state values from the address field.
I tried using the tokens:
[field_facility_address_0_city-formatted]
[field_facility_address[0][city]-formatted]
[field_facility_address_0_city-raw]
[field_facility_address[0][city]-raw]
Unfortunately, none of those tokens work.
Has anyone tried to do this before?
Thanks.
-- Jason
Comments
Comment #1
rconstantine commentedI would like to know by what magic you are even coming up with those tokens since I have not implemented the token module hooks for this module.
I'm changing this to a feature request.
Comment #2
jsm174 commentedThe magic was just a pure "guess". My custom content type was called facility, and I was just using the format that other cck types use.
Anyway, I thought the module had token support and I was just missing something. I apologize.
I'll dig into the code and see if I can help out.
Comment #3
jsm174 commentedI added the token functions and it's working for what I need. I'd like to submit a patch, but I need to do more research on the process.
Here is the code:
Comment #4
rconstantine commentedDon't worry about a proper patch. Unlike some authors, I don't mind receiving clean code in the format you have presented. I am marking this post as patch (needs review) since I don't have time to look it over right now. Thanks for the contribution!
One thing you should do is to compare the code you wrote with that in my cck_fullname module which DOES have token support. There was a big stink a while ago about token hooks not being done properly which opened sites up to XSS issues. I think you may need to modify your cck_address_token_values function slightly by running the output through a filter IIRC.
Comment #5
jsm174 commentedGreat. Okay I added the check_plain() function. Thanks again!
Here is the updated code:
Comment #6
rconstantine commentedYep. That should do it. I'll put this in the next release. Thanks again.
Comment #7
NewZeal commentedAdded to code for next commit