Tokens empty despite parent existence

basvredeling - September 5, 2009 - 16:22
Project:Node Relativity
Version:HEAD
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:duplicate
Issue tags:automatic node titles, token
Description

I use the parent tokens of node relativity in conjunction with automatic node titles to give children the title of the parent. If the node object sent to hook_token_values is not a complete node object (which it doesn't appear to be in automatic node titles) the $node->parent_id is not set and the parent tokens can't be retrieved. The attached patch fixes this issue.

AttachmentSize
patch.txt233 bytes

#1

slip - September 28, 2009 - 01:03
Status:active» needs review

This is bug I've just come across after an upgrade. This patch fixes the problem. As this function only seems to need $node->parent_node, maybe we could replace the node_load() in the patch with a quick query. Either way, +1

#2

slip - September 29, 2009 - 13:02

actually this problem seems to have been fixed for me in the dev version. I'll report back if it pops up again.

#3

slip - September 29, 2009 - 21:28

nevermind. Still a problem in CVS. I reapplied this patch.

#4

slip - September 30, 2009 - 17:53

further improvement. the original made it so titles would only be set properly on update, not creation.

AttachmentSize
relativity-569386-4.patch 637 bytes

#5

claudiu.cristea - November 11, 2009 - 12:36
Status:needs review» duplicate

Maybe you want to consider http://drupal.org/node/629650.

Marking this as duplicate.

 
 

Drupal is a registered trademark of Dries Buytaert.