Closed (fixed)
Project:
Pathauto
Version:
5.x-2.0
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Jan 2008 at 19:11 UTC
Updated:
31 Oct 2008 at 22:34 UTC
I have a custom content type (hand-coded module, no CCK), and would like to use one of the fields it defines as a part of the url alias. Just entering the field name in the pattern for the content type does no good - I get the following error:
You are using the token [page_key] which is not valid within the scope of tokens where you are using it.
I looked around but can't find an answer to this, though I would have supposed it to be a (more or less) frequent situation.
Thanks for your help!
Comments
Comment #1
greggleshello solaas -
Essentially what you need to do is implement the hook_token_list and hook_token_values. Take a look at the token API.txt file for more details.
Comment #2
gregglesAnd of course let me know if you need more guidance.
Comment #3
solaas commentedThanks a lot, greggles.
I found in my situation it was a lot simpler to just call path_set_alias() on hook_insert - your module is wonderful but kinda overkill for me at the moment...
Hope to see ya again soon in Buenos Aires!
Comment #4
gregglessure.
Comment #5
doublejosh commentedHey, I'm using Feed API to create feeds and feed-items. I'd like to use pathauto to create alias for feed items and have the parent feed in that path i.e. www.mydomain.com/feeds/[feed-title]/[feed-item-title-raw].
I've read through the Token API so I see how to create a custom token BUT I'm not sure where to place that function.
Also, it's going to be a little fun to traverse up the nid chain to get that parent title, unless I can reveal it in the feed item (still have to put devel on this site.)
Thanks for any help!