diff --git a/modules/comment.views.inc b/modules/comment.views.inc index 3f4795256bfb782041f3dd9944f34576ae21715d..286decdd1b037701d41e48adb7aeae5e209420cd 100644 --- a/modules/comment.views.inc +++ b/modules/comment.views.inc @@ -29,12 +29,11 @@ function comment_views_data() { 'help' => t("Comments are responses to node content."), ); - //joins - $data['comment']['table']['join'] = array( - //...to the node table + // Provide a "default relationship" to keep older views from choking. + $data['comment']['table']['default_relationship'] = array( 'node' => array( - 'left_field' => 'nid', - 'field' => 'nid', + 'table' => 'node', + 'field' => 'cid', ), ); @@ -532,6 +531,19 @@ function comment_views_data_alter(&$data) { ), ); + $data['node']['cid'] = array( + 'title' => t('Comments of the node'), + 'help' => t('Relate all comments on the node. This will create 1 duplicate record for every comment. Usually if you need this it is better to create a comment view.'), + 'relationship' => array( + 'group' => t('Comment'), + 'label' => t('Comments'), + 'base' => 'comment', + 'base field' => 'nid', + 'relationship field' => 'nid', + 'handler' => 'views_handler_relationship', + ), + ); + } /**