Closed (fixed)
Project:
References
Version:
7.x-2.x-dev
Component:
Code: node_reference
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Dec 2010 at 10:47 UTC
Updated:
25 Feb 2012 at 02:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
DjebbZ commentedI confirm that the actual dev doesn't work, and that the patch solves the problem. I referenced a node from another, with the formatter "Rendered node", and was able to create a 'node--reference.tpl.php' file in my theme that worked as intented.
Marking the issue as "needs work", as it needs testing now.
Comment #2
DjebbZ commentedJust corrected suggestions name to correspond to Drupal convientions (1 hyphen to separate words, 2 to separate suggestions groups.)
Comment #3
DjebbZ commentedBasic instructions for the test.
Comment #4
yched commentedCommitted #2. Thanks !
Comment #5
Jeff Burnz commentedHi, I was working on this for someone trying to debug why the suggestions were not kicking in, I could only get it to work by declaring the preprocess function in hook_theme, I think this is a bug in D7 #939462: Specific preprocess functions for theme hook suggestions are not invoked ?
Comment #6
betarobot commentedThat was me Jeff was helping to debug :) Maybe it's just a temporary fix, but can confirm #5 worked for me.
Comment #7
alan d. commentedIn regards to #5: Yep, this is a core requirement. From the poll module that implements one of these theme suggestions.
A bit of a wtf moment working this out for the first time!
Comment #8
tommychris#5 works for me, please add to git!
Comment #9
stevectorThe $field variable in node_reference_preprocess_node() is not an array, just a string.
node_reference_field_formatter_view() only adds the the field_name to the node object.
The result is that only the first letter in the field name is added. So the theme_hook_suggestions array looks like this
instead of this:
The fix is relatively small.
Comment #10
stevectorRe-reading this, I didn't really address the issue brought up in #5. Would it make more sense to start all of these with node__node_reference instead of node_reference?
Comment #11
larowlanThis one does away with the node_reference suggestion, instead reusing the node theme hook, and offering this as a suggestion to compliment that.
So your file names are:
node--node-reference.tpl.php
node--node-reference-field-foo.tpl.php
node--node-reference-page.tpl.php
node--node-reference-field-foo-page.tpl.php
So doesn't need hook_theme implementation.
Comment #12
apemantus commentedI can confirm that the patch in #11 works. I've just spent an annoying hour or two cursing devel_themer and not understanding why node-reference.tpl.php wasn't being picked up. With this patch, node--node-reference.tpl.php does get picked up.
Comment #13
j0rd commentedI've just ran into the bug, which patch #11 seems to fix. This should probably get committed and a new version made from it.
Comment #14
j0rd commentedMarking this as reviewed. We've got two patched confirmations, that it does what it's supposed to.
Comment #15
yched commentedSorry for letting this drop off my radar.
I think the new template names in @larowlan's proposal in #11 make more sense. This feature never really worked, so I guess we can change the names :-/.
We need to use double '_' to separate the name parts, though.
Committed the attached patch.