D7 Note Currently, what with how Drupal 7's fields are written in a way so you can't really tell how to get at the data, and with Corresponding Node Reference already having a successful D7 port, there are no plans to update Backreference to Drupal 7. If you plan to upgrade, I suggest changing your Drupal 6 site to use Corresponding Node Reference, and then update.
Backreference Module provides a nodeapi interface to maintain 1-1 relationships between all shared instances of a nodereference field. This means that given a field instance of field_reference1, if you add a reference to NodeBeta to NodeAlpha's field_reference1 and NodeBeta has an instance of field_reference1, then NodeAlpha will be added to NodeBeta's instance of field_reference1.
There are other similar modules out there that do similar work, such as NodeReferrer and Node Relationships. In their cases they use views or similar queries to query for the nodes that are pointing to module B, where BR writes to a CCK Nodereference field. This has some advantages:
- Where other modules allow you to link A->B and then display the nodes linking to B on B's node page, this module writes A->B and B->A, which means that if another module needs to know about B->A it will see the data there, where others would need to know how to read further information.
- The cardinality of B to A is enforced - if your B module is only supposed to have one link to another node, Backreference will go with that where other modules may not.
- The link is symmetrical - you can go into A to link it to B, or go into B to link it to A.
Along the same lines is Corresponding Node References, which seems to work similarly to BackReference. The main difference between the two seems to be with handling single-value or fixed-number value fields, which CNR does not seem to handle well. As always, when choosing a module for your project, look over the existing options and choose the one that matches what your requirements need.
Note that this code grew out of the backreference module that user dopry stowed in his sandbox on cvs two years ago. Although we've made changes since then, we're grateful for the foundation he provided.
This code contains a number of SimpleTest tests which seem to cover all of the situations I could think of - if you find a bug and patch it, please provide a test that detects the original problem and agrees that your fix works.
This code was created with the financial support of pingVision