Hello!
Thank you for very good module!
I create clone of noderelationship_noderef view that should filter only nodes that are not refferenced yet. For some reason that should be very simple (but not clear for me) I can not see any back_reference fields in Relationships or in Filters part of View. How can I filter referenced nodes by back reference fileds in Views?

Comments

I'm afraid this is not possible from Views UI with current features of Node Relationships module. This needs coding.

A bit of explanation on where we are:

The Node Relationships module does not add CCK fields to duplicate back reference data like in Nodereferrer or BackReference modules.

The back references provided by Node Relationships module are just views that filter data from node reference fields to display a list of back references from referred nodes. You can customize this kind of views as CCK fields, but this is just to allow you place the rendered output of these views in the node view from the "Manage fields" page. These are not real CCK fields.

The dynamic customization of views used for "Search and reference" feature just add a couple of fields (nid and title) so that the jquery stuff in the modal frame dialog can build the value for the node reference field, and then a filter per node types is also added dynamically. You may want to add more filter here to suit your needs.

Arguments for noderelationship_noderef views are also built dynamically. We are using the type of the referrer node (first argument) and the name of the nodereference field in the referrer type (second argument). These arguments are needed for all these dynamic customizations to take place in real-time, when the view is executed.

All these dynamic customizations happen in noderelationships_customize_noderef_view() located in noderelationships.inc. Close to the end of this function there is a drupal_alter() that provides a method to further extend these dynamic customizations. The prototype of this hook looks like this:

<?php
/**
* Implementation of hook_noderelationships_view_alter().
*
* This hook allows you to alter the array of custom overrides that are
* applied to noderelationship views in real-time.
*
* @param $view_overrides
*   An array of custom options to override the settings of the given view.
* @param $view
*   The view object.
* @param $display_id
*   The current display ID used for the view.
* @param $view_args
*   An array of the current view arguments.
*/
function MODULE_noderelationships_view_alter(&$view_overrides, $view, $display_id, $view_args) {
  switch (
$view->tag) {
    case
NODERELATIONSHIPS_BACKREF_VIEW_TAG:
     
// Customization of noderelationships_backref views.
      // See noderelationships_get_backref_view_overrides().
     
break;
    case
NODERELATIONSHIPS_NODEREF_VIEW_TAG:
     
// Customization of noderelationships_noderef views.
      // See noderelationships_get_noderef_view_overrides().
      //
      // Here's where you can add more filters to suit for needs.
      //
     
break;
  }
}
?>

So to solve this problem you need to code, and this is the hook that should allow you to do this. I hope that helps.

Markus,
Thank you!

Status:Active» Fixed

You're welcome.

I marking this fixed and I'll also add a link in the project page because this kind of documentation is not already provided.

Title:I can't see back refference fields in my viewHow to customize noderelationships views in real-time, when the view is executed
Component:Back references views» Documentation

Better title.

Title:How to customize noderelationships views in real-time, when the view is executedHow to customize noderelationships views in real-time, when these views are executed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Turns out the related issue above was user error ( my user error, to be exact ) due to not carefully reading the documentation on hook_noderelationships_view_alter.

To get things working, be sure to modify the $view_overrides argument passed into the hook, rather than trying to edit the view directly using the normal views API methods.