Are Views Arguments Supported in Node Relativity 6.x?

Jboo - June 17, 2009 - 12:28
Project:Node Relativity
Version:6.x-1.2
Component:User interface
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi,

I'm looking to create a view with the child nodes and some CCK data to display on the parent node. However, there aren't any views argument settings relevant to this module in the version of Node Relativity i'm using. I've noticed other threads where people have created views with relativity arguments.

Am I missing something? I'd really appreciate it if someone could point out how I can do this.

Thanks in advance.

#1

Village Internet - August 23, 2009 - 16:54

I was able to get Parent ID into Views arguments by adding code to relativity.views.inc based on other modules:

function relativity_views_data() {
drupal_set_message('View hook called.');
$data['relativity']['table']['group'] = t('Node Relativity');

$data['relativity']['table']['base'] = array(
'field' => 'nid',
'title' => t('Node Relativity'),
'help' => t('Node Relativity for connecting content types to events.'),
);

$data['relativity']['table']['join'] = array(
'node' => array(
'left_field' => 'nid',
'field' => 'nid',
),
);

$data['relativity']['nid'] = array(
'title' => t('Child Node ID'),
'help' => t('The Node ID of the child node.'),
'field' => array(
'handler' => 'views_handler_field_node',
'click sortable' => TRUE,
),
'relationship' => array(
'base' => 'node',
'field' => 'nid',
'handler' => 'views_handler_relationship',
'label' => t('Child Node'),
),
);

$data['relativity']['parent_nid'] = array(
'title' => t('Parent Node ID'),
'help' => t('The Node ID of the parent node.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'relationship' => array(
'base' => 'node',
'field' => 'nid',
'handler' => 'views_handler_relationship',
'label' => t('Parent Node'),
),
'argument' => array(
'name' => t('Post: in specified parent'),
'name field' => 'title', // the field to display in the summary.
'validate type' => 'nid',
'handler' => 'views_handler_argument',
'help' => t('filter by parent'),
),
);

return $data;
}

#2

BeechyBoy - August 30, 2009 - 20:36

Thanks for this, it worked great ;)

#3

gggdrpl - October 21, 2009 - 05:43

It's true! Works great! I almost gave up using this module. Thanks a lot!!!

#4

tortoise - November 18, 2009 - 01:39

I pasted the above code into relativity.views.inc as suggested, but when I try using Parent Node ID as an argument, I get

"user warning: Unknown column 'relativity.title' in 'field list' query: SELECT relativity.parent_nid AS relativity_parent_nid, relativity.title AS relativity_title [...] in mysite.com/modules/views/includes/view.inc on line 765."

Is there something else I need to add?

 
 

Drupal is a registered trademark of Dries Buytaert.