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.
| Attachment | Size |
|---|---|
| patch.txt | 233 bytes |

#1
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
actually this problem seems to have been fixed for me in the dev version. I'll report back if it pops up again.
#3
nevermind. Still a problem in CVS. I reapplied this patch.
#4
further improvement. the original made it so titles would only be set properly on update, not creation.
#5
Maybe you want to consider http://drupal.org/node/629650.
Marking this as duplicate.