Hi all,
I was working on a views override for the default review view that is provided and noticed there was no relationship provided by the nodereview module so I went ahead and updated the code. This allowed me to pull in information about the node that was reviewed when listing all of my reviews.

A good example of when you need to do this could be changing the reviews path from node/[nid]/reviews to businesses/b/belyea-brothers/reviews - where the b and belyea-brothers are wildcards taken from the node title that was reviewed.

here is the code, sorry I didn't make it a patch but just paste it into nodereview.views.inc from line 17 onwards:

$data['nodereview']['reviewed_nid'] = array(
    'title' => t('Reviewed Node'),
    'help' => t('The node which is reviewed.'),
    'relationship' => array ( //this creates the relationship with node reviewed linking all available fields from the node table
      'base' => 'node',
      'field' => 'nid',
      'handler' => 'views_handler_relationship',
      'label' => t('Reviewed Node'),
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
      'numeric' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
      'numeric' => TRUE,
    ),
  );
  return $data;
}

Comments

danielhonrade’s picture

Status: Active » Closed (fixed)

just committed this patch to dev