Tokens for CCK fields within a node reference

andrewsuth - June 5, 2009 - 16:49
Project:Token
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed
Description

I didn't find anything about this topic yet, so here we go:

Here is my scenario:

2 x Content Types:
1) Venue with a CCK Location field
2) Event with a CCK node reference field --> Venue

In Node Path Settings I'd like to be able to create a path for Event that includes the node reference CCK Location field from the Venue content type. Like what can be done using Views 2 and setting up relationships.

As far as I know, only the Referenced node ID and Referenced node title tokens are available to the pathauto module.

Perhaps a relationship could be created like this:
[field_venue_id-nid]#[location-city_0]/event

Which would allow for any relational tokens to also be added to the path. If not, the only other viable scenario that I can see is to add a location to the Events content type.

#1

greggles - June 6, 2009 - 13:45
Title:Pathauto for CCK fields within a node reference» Tokens for CCK fields within a node reference
Project:Pathauto» Content Construction Kit (CCK)
Version:6.x-1.1» 6.x-2.x-dev
Component:Code» General

This is not really about Pathauto, but about Tokens provided by other modules.

For what it's worth, I don't think it makes sense to create tokens for every field of a referenced node - the performance could get painful. Instead, I suggest some custom code in a token starterkit #437842: create a token starterkit module and documentation so people know how to use it.

#2

andrewsuth - June 6, 2009 - 14:07

Maybe I'm wrong, but my scenario described above doesn't need new tokens for the modules; the tokens already exist. It's about creating a method to make a relationship to a referenced node so that the already existent tokens can be used in pathauto.

Eg. [reference_node_id]#[description-raw]
Where [description-raw] already exists. As it stands, [description-raw] is currently inaccessible to pathauto because it's a token from a referenced node.

I see this as being a very powerful feature for the module which would add a whole new level of flexibility, like what Relationships added to Views 2.

#3

greggles - June 6, 2009 - 14:15
Project:Content Construction Kit (CCK)» Token
Version:6.x-2.x-dev» 6.x-1.x-dev
Component:General» Code
Status:active» postponed

OK, then. Creating a relationship between tokens should be up to token module and is postponed for "token 2.0" does it's lazy loading of tokens.

#4

andrewsuth - June 6, 2009 - 15:05

You're right, Token would be the module for adding this feature.

I'm not familiar with the code behind Token but if you could give me any ideas of how this feature should be implemented I can see about getting a patch up for it.

#5

hackersword - June 10, 2009 - 15:15

subscribe

#6

Parkes Design - August 21, 2009 - 01:41

hey andrewsuth, I was after similar functionality as well and came up with a long winded codeless way of doing it.

I used the rules module http://drupal.org/project/rules to load the reference node within the child node(action). Once I did this then I created another action to set content title. Now "Replacement patterns for Referenced content" within the token settings is available, where you can grab the required field from the referred content and populate the content title pattern.

Maybe this process can help you with your pathauto situation?

Anyway I'm subscribing to this because the functionality would be awesome without the rules workaround.

#7

ISPTraderChris - October 23, 2009 - 04:24

I'm trying to expose tokens from another content-type via nodereference. I was hoping to do this with a bit of code within a Computed Field.

I can load the reference node via node_load($node->field_nodereference[0]['nid']), but I'm not sure what to then do with it so that the Token module can 'see' it and resolve its tokens.

Any pointers would be greatly appreciated.

#8

BarisW - November 27, 2009 - 15:28

I have the same problem. Would love to have Token inherit all fields from its parent node(s).
Subscribing!

#9

mitkoru - November 27, 2009 - 17:35

subscribe

#10

petasques - December 6, 2009 - 09:33

subscribe!

#11

H-BES - December 7, 2009 - 12:57

subscribe

 
 

Drupal is a registered trademark of Dries Buytaert.