diff --git a/modules/node.views.inc b/modules/node.views.inc index 6bdbba2a76ded912ebe38c2a0deb513ef204a975..591a25443787d21c36adcf4cd9e7ff79c4a13fcb 100644 --- a/modules/node.views.inc +++ b/modules/node.views.inc @@ -456,7 +456,7 @@ function node_views_data() { $data['node_revision']['table']['default_relationship'] = array( 'node' => array( 'table' => 'node', - 'field' => 'vid', + 'field' => 'nid', ), ); @@ -473,24 +473,56 @@ function node_views_data() { ); // nid + $data['node_revision']['nid'] = array( + 'title' => t('Nid'), + // The help that appears on the UI. + 'help' => t('The revision NID of the content revision.'), + // Information for displaying the nid. + 'field' => array( + 'click sortable' => TRUE, + ), + // Information for accepting a nid as an argument. + 'argument' => array( + 'id' => 'node_nid', + 'click sortable' => TRUE, + 'numeric' => TRUE, + ), + // Information for accepting a nid as a filter. + 'filter' => array( + 'id' => 'numeric', + ), + // Information for sorting on a nid. + 'sort' => array( + 'id' => 'standard', + ), + 'relationship' => array( + 'id' => 'standard', + 'base' => 'node', + 'base field' => 'nid', + 'title' => t('Content'), + 'label' => t('Get the actual content from a content revision.'), + ), + ); + + // vid $data['node_revision']['vid'] = array( 'title' => t('Vid'), - 'help' => t('The revision ID of the content revision.'), // The help that appears on the UI, - // Information for displaying the nid + 'help' => t('The revision ID of the content revision.'), + // Information for displaying the vid 'field' => array( 'click sortable' => TRUE, ), - // Information for accepting a nid as an argument + // Information for accepting a vid as an argument 'argument' => array( 'id' => 'node_vid', 'click sortable' => TRUE, 'numeric' => TRUE, ), - // Information for accepting a nid as a filter + // Information for accepting a vid as a filter 'filter' => array( 'id' => 'numeric', ), - // Information for sorting on a nid. + // Information for sorting on a vid. 'sort' => array( 'id' => 'standard', ), diff --git a/tests/views_test_config/config/views.view.test_node_revision_nid.yml b/tests/views_test_config/config/views.view.test_node_revision_nid.yml new file mode 100644 index 0000000000000000000000000000000000000000..cefeddab9fc2d27181cf60d22f7811a93cdf518f --- /dev/null +++ b/tests/views_test_config/config/views.view.test_node_revision_nid.yml @@ -0,0 +1,36 @@ +name: test_node_revision_nid +base_table: node_revision +core: 8 +api_version: 3 +display: + default: + display_options: + relationships: + nid: + id: nid + table: node_revision + field: nid + required: TRUE + fields: + vid: + id: vid + table: node_revision + field: vid + nid_1: + id: nid_1 + table: node_revision + field: nid + nid: + id: nid + table: node + field: nid + relationship: nid + arguments: + nid: + id: nid: + table: node_revision + field: nid + display_plugin: default + display_title: Master + id: default + position: '0' diff --git a/tests/views_test_config/config/views.view.test_node_revision_vid.yml b/tests/views_test_config/config/views.view.test_node_revision_vid.yml new file mode 100644 index 0000000000000000000000000000000000000000..b36f54967dcaec2ff3e73879202864decde8168c --- /dev/null +++ b/tests/views_test_config/config/views.view.test_node_revision_vid.yml @@ -0,0 +1,36 @@ +name: test_node_revision_vid +base_table: node_revision +core: 8 +api_version: 3 +display: + default: + display_options: + relationships: + vid: + id: vid + table: node_revision + field: vid + required: TRUE + fields: + vid: + id: vid + table: node_revision + field: vid + nid_1: + id: nid_1 + table: node_revision + field: nid + nid: + id: nid + table: node + field: nid + relationship: vid + arguments: + nid: + id: nid: + table: node_revision + field: nid + display_plugin: default + display_title: Master + id: default + position: '0'