Index: nodereference.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/cck/nodereference.module,v retrieving revision 1.39.2.17 diff -u -r1.39.2.17 nodereference.module --- nodereference.module 5 Mar 2007 21:58:47 -0000 1.39.2.17 +++ nodereference.module 7 Jun 2007 14:33:01 -0000 @@ -104,6 +104,25 @@ 'extra' => array('field' => $field), ), ); + + case 'tables': + //load the default table definitons provided by the content module + $tables = content_views_field_tables($field); + //Add further table definitions, which are needed by views_fusion for using the nodereference reverse + $db_info = content_database_info($field); + $tables['node_data_'. $field['field_name'] .'_reverse'] = array( + 'name' => $db_info['table'], + 'join' => array( + 'left' => array( + 'table' => 'node', + 'field' => 'nid', + ), + 'right' => array( + 'field' => $db_info['columns']['nid']['column'] + ), + ), + ); + return $tables; } } @@ -483,4 +502,27 @@ $options = array(0 => t('')); $options = $options + _nodereference_potential_references($filterinfo['extra']['field']); return $options; -} \ No newline at end of file +} +/* + * Implementation of hook_views_fusion() + */ +function nodereference_views_fusion() { + $field_types = _content_field_types(); + $return = array(); + foreach (content_fields() as $field) { + if ($field['type'] == 'nodereference') { + $db_info = content_database_info($field); + $fusion = array( + 'title' => $field_types[$field['type']]['label'] .': '. $field['widget']['label'] .' ('. $field['field_name'] .')', + 'field' => $db_info['columns']['nid']['column'], + ); + $return['node_data_'. $field['field_name']] = $fusion; + $fusion = array( + 'title' => $field_types[$field['type']]['label'] .': '. $field['widget']['label'] .' ('. $field['field_name'] .') - reverse direction', + 'field' => 'nid', + ); + $return['node_data_'. $field['field_name'] .'_reverse'] = $fusion; + } + } + return $return; +}