When you're using the node reference title token value, it displays a view of the node instead of the title. This patch fixes it.

CommentFileSizeAuthor
token_nodereference_title.patch765 bytesrobloach

Comments

robloach’s picture

Oh, this was happening because I'm having the node reference widget display a teaser view instead of just the title, so when Token asks for the view field of the node, it outputs the teaser. The patch still applies.

TBarregren’s picture

I have reviewed the patch and it both looks and works great. I would say it is RTBC.

mlsamuelson’s picture

I've successfully applied the patch. Have not tested for the issue Rob Loach mentions, however the patch does resolve an issue I experienced where the node reference title was double-encoded (and thus displaying incorrectly).

rwd’s picture

The patch works for me, resolving a similar issue where the node reference title token would return an empty value if the node reference field was set to be hidden in the full display of the custom content type nodes. This was leading to an omitted path component when the token was used in pathauto.

robloach’s picture

Status: Needs review » Reviewed & tested by the community
greggles’s picture

Project: Token » Content Construction Kit (CCK)
Version: 5.x-1.x-dev » 6.x-1.x-dev
Component: Code » nodereference.module
Status: Reviewed & tested by the community » Needs work

@all - thanks for the code and reviews.

We haven't had a great history providing tokens for cck within the token module itself (see date module...).

I'd rather this were added to the cck module in 6.x.

karens’s picture

Status: Needs work » Active

CCK D6 already has content.token.inc, so this is already done. Are you proposing to move the D5 code?

karens’s picture

Status: Active » Postponed (maintainer needs more info)
greggles’s picture

@KarenS - no, I believe this is an additional feature that is missing from content.token.inc But I haven't investigated too closely.

karens’s picture

I'm confused. You have a patch for the D5 version of Token and you've moved it to the D6 version of CCK. You're either suggesting we put something (all token code?) into both the D5 and D6 versions of CCK or you're suggesting we port the patch to D6 and put it in the D6 version of CCK, but if you're keeping the D5 code in Token, you still have to add this patch to the Token module, not to CCK.

So, as I say, I'm confused about what you want to do :)

greggles’s picture

Ok, sorry for the confusion.

I don't want to add new features to the 5.x branch of token, but the idea seems reasonable to me.

If you feel this makes sense to have it, then it should be ported to the 6.x branch and implemented in cck module.

Does that make sense?

dzazi’s picture

I think this patch fixes an unexpected behaviour... when i use the [referenced_field-title] token, i would expect it to return the title of the node, not the view of it... can we get this committed?

I'm not ready to move D6 yet.

epikur79’s picture

With CCK 6.x-2.0-rc6 i still have the issue, that except for [field_reference-nid] all tokens (i.e. -title], -url], ...) seem to fail when
field_reference is hidden. The patch above fixes this, whithout any sideeffect visible to me. I'd like to see the fix in the next CCK release.

karens’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

There's a more current issue and patch for this at #312349: token for titles for node references don't work.