Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
7.x-2.x-dev
Component:
nodereference.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Dec 2009 at 18:09 UTC
Updated:
3 Jan 2014 at 01:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
yched commentedFYI: I just committed an update of the noderef formatters after #652834: Field formatters as render arrays.
Not actually tested :-p.
Additional adjustments will be needed if / when #657828: Make hook_field_formatter() act on all field values lands.
I'd notably welcome anyone testing that the logic to prevent infinite recursion with 'display full node' formatter works fine:
1 references 2,
2 references 3,
3 references 1.
When useref is ported too, we'll need to also ensure 'cross entity types' cycles:
node 1 references user 1,
user 1 references user 2,
user 2 references node 1
Which means 'display actual object' formatters for userref / noderef / entityref fields need to cooperate somehow, probably by sharing the recursion queue. Interesting ;-)
Comment #2
fgmSlight misuse of DBTNG: fetchField works on a query result, not on the query object.
Comment #3
yched commentedRight. Committed an update after #657828: Make hook_field_formatter() act on all field values, and that part got heavily refactored anyway ;-).
The 'display as full/teaser node' formatters and the infinite loop protection seem to work OK.
Only problem: the node template doesn't display the node title.
That's a core bug, template_preprocessor_node() does
$variables['page'] = (bool)menu_get_object();, that's not specific enough.Comment #4
yched commentedCommitted an update after #639466: hook_options_list() + XSS filtering
Comment #5
yched commentedCore bug in #3 should be fixed now.
Comment #6
morbus iffLooks like noderef autocomplete is broken again:
* Autocomplete text widget doesn't work; no widget is displayed. Other widgets work fine.
* Switching to another widget, and saving the node, shows nothing displayed on node view.
Comment #7
fgmYes, it briefly worked after #2 and no longer at #3.
Comment #8
morbus iffYeah, this was broken by #658364. It's a simple tweak to get the above two things working again. Attached. RTBC.
Comment #9
morbus iffThere's still something wrong with saving values through taxonomy autocomplete, which I'm trying to debug.
a) Create a node. Make sure it has a double digits for nids (i.e. 31 in my test case).
---(This bug is NOT reproducible if your referenced node is a single digit.)
b) Create a node that node refs this. The autocomplete works properly (shows [nid:31]).
c) Save the node. The value stored in the database is "3", and the #default_value on edits shows " [nid:Array]".
More info:
* If your referenced node is nid 31, then make sure that nid 3 exists. If node 3 doesn't exist, then I can't reproduce the error.
* But, if you make a referenced node to 31, and then try to make ANOTHER node and reference 31 AGAIN, it fails (??).
Comment #11
yched commentedCommitted #8.
Bug in #9 looks like something wrong in node_reference_autocomplete_value(). That function could probably use a closer look, it doesn't really look like other form_type_*_value() value callbacks in core's form.inc.
No time for this tonight, unfortunately.
Comment #12
morbus iffComment #13
morbus iffRegarding #9 and #11, the first thing I noticed is:
$nid = $element['#default_value'];
but comes from node_reference_field_widget_form's $items['delta']. But the value of that is an array('nid' => 123), not just 123. So it seems, here, that $nid would be set to array('nid' => 123) and not 123. Switchiing to $element['#default_value']['nid'] didn't seem to help.
This function also, oddly, seems to prevent me from ever editing a nodereference, since the #default_value from a node's edit form will always be set, so we don't ever return anything but NULL?
Comment #14
dave reidAdding D7 porting tag...
Comment #15
litwol commentedsub
Comment #16
yched commentedI committed a fix that should let the autocomplete widget work as expected now.
@Morbus iff: can you confirm it works for you (including with 2 digit nids :-p) ?
Comment #17
morbus iffSeems to work, yeah - editing an existing noderef works, and it distinguishes between nids 1 and 11.
Comment #18
aren cambre commented#690478: Maintainer needed for D7 versions of nodereference / userreference
Comment #19
BenK commentedSubscribing...
Comment #20
jherencia commentedSubscribing...
Comment #21
pasqualleminor code style changes
and nodereference_field_widget_error function name fix
Comment #22
yched commentedCommitted #21 (with an additional fix for the new syntax for template suggestions).
Thanks !