Closed (won't fix)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.x-dev
Component:
nodereference.module
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
18 Feb 2008 at 00:35 UTC
Updated:
9 Dec 2009 at 21:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
gordon commentedFound a small bug in the setting for the option.
Comment #2
manimal commentedthe patch fails for me, I can't get it to work.
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 37.
Hunk #3 FAILED at 87.
Hunk #4 FAILED at 130.
Hunk #5 FAILED at 581.
Comment #3
gordon commentedI have checked it and other than the first hunk with is the $Id$ it patches fine.
Make sure that you are applying it to the correct version.
Comment #4
onefeatureman commentedsubscribing
Comment #5
onefeatureman commentedTell me - what I need to have in the referenced node for the bi-directional reference to work? A counter-reference? How the patch is applying the reference?
thanks
nikola
Comment #6
gordon commentedBasically it looks on the referenced nodes for the same field and then adds the reference back to the current node.
If you are referencing a different node type then you need to share this field onto the other node type.
Comment #7
onefeatureman commentedOk, I see the point.
I expected it to behave differently, mainly because of my use for it.
I have a content type music holding an mp3, and there I have an array of nodereference to musician content type.
I thought it would be great if when I reference musician with musician nodereference - in the same time musician references music with MUSIC nodereference. (where I can define which fields are to be appended to automatically - in this case the MUSIC nodereference field)
This way I could keep it organized and clear for everybody.
Why? I have more than one node reference field in every content type, and so they have specialized names and usages. If the bidirectional reference will force me to use the same field for the two contents (of which the referenced one do not even need this kind of field, because the whole node is about the field - that's why I am referencing it :) ) it will make a mess in my plan...
Maybe its pointless from Your point of view, but is it possible to code a widget to choose a field to back-reference in the referenced node in the field options?
Comment #8
Mac Clemmens commented@onefeatureman -- Interesting point #7 - I was wondering the same thing...
-subscribing-
Comment #9
dsel commentedsubscribing
Comment #10
dsel commentedsubscribing
Comment #11
dan_aka_jack commentedthis sounds like a very useful feature. Subscribing.
Comment #12
Anonymous (not verified) commented+1 subscribe
Would love this as a standard feature. Especially for the 6.X version....
Comment #13
chaps2 commentedHere's a way to do this in 6.x. It uses the rules module and doesn't require any patching. I used the latest dev version of rules (dated march 31). I'll try to check with the latest release.
Basically you need to set up two triggered rules that update the nodereference field on the referenced node to the nid of the node that is referring to it. Two rules because I couldn't find a single event that would work for both node creation and node update.
Node creation rule
return array(0 => array('nid' => null));This condition will return TRUE when the nodereference field has been set. Save.
return array(0 => array('nid' => $node->nid));Set weight to 1. Double check the content drop-down select is set to 'Referenced node' as it may reset itself. Save.
Node update rule
And that should do it.
Comment #14
alanburke commentedCould you export those rules.. Would be useful to make a start.
Comment #15
chaps2 commented@alanburke - If you think it would help...
The attached contains the exported rules (2 of them) created as per #13 for a 'Person' content type with type name 'nu_profile'. The rules maintain bi-directionality for the node reference field called 'field_spouse_partner' (which refers to content of the same type selected from a view).
If you had a similar requirement you could do a search/replace and import but it's pretty easy to do from scratch via the UI.
Comment #16
alanburke commented@chap2 - Thanks.
I managed to get it working from the UI.
It was taking me a while to get my head around the Rules modules,
but is so powerful.
[In much the same way that 'views is the answer' to many Drupal questions,
I anticipate that 'Rules is the answer' will become a common answer in the future!]
Comment #17
gagarine commentedtracking
Comment #18
soulston commentedDoes this need the token module installed to funciton?
I have tried to get this to work but no links are placed in the nodes that I am referencing
Comment #19
chaps2 commentedIf you haven't already, try enabling the core module "PHP filter". On each rules action configuration form there should be a "PHP Evaluation" section that lists the variables that you can use.
Comment #20
alanburke commentedNew module which promises this functionality.
http://drupal.org/project/cnr
Comment #21
soulston commentedI tried this out and it seems to work fine. I have it set with three different content types which each reference each other.
Has anyone tried to use this for a large number of nodes?
I need to implement something with maybe 1000 nodes and up to 250 bidirectional links. I see the usage stats is at 18 as of now.
Is this kind of use going to create a performance hit and if so should I be looking for a better solution?
Comment #22
extect commentedThere is one problem with the solution in #13: When you delete your nodereference, it does not automatically delete the reverse nodereference on the referenced node as well. Any idea how to solve this?
Comment #23
nickbn commentedWill the rules method above work with multiple node references? For example, a node that references any number of other nodes?
Comment #24
markus_petrux commentedThis pattern duplicates information in the database which is redundant and is prone to create integrity issues. On the other hand, it is not so complex to create a view that displays back references doing the proper join with the node reference field and the node data of the referred node. But this probably requires Views, and I believe it is a complex goal at this point in time for CCK in D6. Hence, I would say "won't fix" or "postponed" here. IMHO, at least in D6, this needs to be resolved by contrib modules.
I'm sure there are a few solutions in contrib to resolve this, but I think they also duplicate data to get the back references. So I have written a module that, among a few other things, provides back reference views automatically, where views can be easily adapted. These back references can then be rendered using several methods in the node view.
http://drupal.org/project/noderelationships
Comment #25
markus_petrux commentedWell, I think this won't get in.
You may wish to check out the following issue for follow ups on the reverse node reference feature, which is something that will be possible in contrib as well.
#241078: Reverse node-reference views relationship
Comment #26
neil.brown commentedSubscribing.
Comment #27
Anonymous (not verified) commented/me sub
Comment #28
Gabriel R. commentedI am a bit torn between the various solutions provided here.
Comment #29
quinn-2 commentedsub