diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 4ce2cd9..5355da2 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -2050,7 +2050,7 @@ function comment_get_comment_fields($entity_type = NULL) { return array_filter(field_info_fields(), function ($value) use($entity_type) { if ($value['type'] == 'comment') { if (isset($entity_type)) { - return in_array($entity_type, array_keys($value['bundles'])); + return in_array($entity_type, $value['bundles']); } return TRUE; } diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc index 9ca0069..f6e0b74 100644 --- a/core/modules/comment/comment.views.inc +++ b/core/modules/comment/comment.views.inc @@ -368,6 +368,12 @@ function comment_views_data() { 'relationship field' => 'entity_id', 'id' => 'standard', 'label' => $entity_info['label'], + 'extra' => array( + array( + 'field' => 'entity_type', + 'value' => 'node', + ), + ), ), ); } diff --git a/core/modules/views/config/views.view.comments_recent.yml b/core/modules/views/config/views.view.comments_recent.yml index 032ac63..4ef7638 100644 --- a/core/modules/views/config/views.view.comments_recent.yml +++ b/core/modules/views/config/views.view.comments_recent.yml @@ -31,10 +31,10 @@ display: options: items_per_page: 5 relationships: - entity_id: - id: entity_id + node: + id: node table: comment - field: entity_id + field: node fields: subject: id: subject @@ -59,7 +59,7 @@ display: id: status_extra table: node field: status_extra - relationship: entity_id + relationship: node group: 0 style: type: html_list @@ -85,7 +85,7 @@ display: id: title table: node field: title - relationship: entity_id + relationship: node label: 'Reply to' link_to_node: 1 timestamp: diff --git a/core/modules/views/config/views.view.tracker.yml b/core/modules/views/config/views.view.tracker.yml index 5d31e2f..16f1e03 100644 --- a/core/modules/views/config/views.view.tracker.yml +++ b/core/modules/views/config/views.view.tracker.yml @@ -51,12 +51,12 @@ display: label: Author comment_count: id: comment_count - table: node_comment_statistics + table: comment_entity_statistics field: comment_count label: Replies last_comment_timestamp: id: last_comment_timestamp - table: node_comment_statistics + table: comment_entity_statistics field: last_comment_timestamp label: 'Last Post' timestamp: @@ -77,7 +77,7 @@ display: sorts: last_comment_timestamp: id: last_comment_timestamp - table: node_comment_statistics + table: comment_entity_statistics field: last_comment_timestamp arguments: uid_touch: diff --git a/core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php b/core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php index 7a2b2d3..97e2da6 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/ArgumentUserUIDTest.php @@ -12,6 +12,11 @@ */ class ArgumentUserUIDTest extends CommentTestBase { + protected function setUp() { + comment_add_default_comment_field('node', 'page'); + parent::setUp(); + } + public static function getInfo() { return array( 'name' => 'Comment: User UID Argument', @@ -31,7 +36,6 @@ function testCommentUserUIDTest() { ), ); $this->column_map = array('nid' => 'nid'); - debug($this->view); $this->assertIdenticalResultset($this->view, $result_set, $this->column_map); } diff --git a/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php b/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php index c49452b..eaa7833 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/DefaultViewRecentComments.php @@ -75,8 +75,11 @@ public function setUp() { 'comment_' . $content_type->type . "[$language_not_specified][0][comment]" => COMMENT_ENTITY_OPEN ); + comment_add_default_comment_field('node', $content_type->type); $this->node = $this->drupalCreateNode($node_data); + views_invalidate_cache(); + // Create some comments and attach them to the created node. for ($i = 0; $i < $this->masterDisplayResults; $i++) { $comment = entity_create('comment', array()); diff --git a/core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php b/core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php index 00ba08c..0ebf6d7 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Comment/FilterUserUIDTest.php @@ -14,6 +14,11 @@ */ class FilterUserUIDTest extends CommentTestBase { + protected function setUp() { + comment_add_default_comment_field('node', 'page'); + parent::setUp(); + } + public static function getInfo() { return array( 'name' => 'Comment: User UID Filter', diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php index 91ae217..5a26867 100644 --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -33,6 +33,11 @@ class DefaultViewsTest extends WebTestBase { 'glossary' => array('all'), ); + protected function setUp() { + comment_add_default_comment_field('node', 'page'); + parent::setUp(); + } + public static function getInfo() { return array( 'name' => 'Default views', diff --git a/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php index ca988ab..6293694 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Entity/FieldEntityTest.php @@ -13,7 +13,10 @@ * Tests the field plugin base integration with the entity system. */ class FieldEntityTest extends ViewTestBase { - + protected function setUp() { + comment_add_default_comment_field('node', 'page'); + parent::setUp(); + } /** * Modules to enable. diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php index 50c070e..af2eb0f 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerAllTest.php @@ -40,6 +40,11 @@ class HandlerAllTest extends HandlerTestBase { 'user', ); + protected function setUp() { + comment_add_default_comment_field('node', 'page'); + parent::setUp(); + } + public static function getInfo() { return array( 'name' => 'Handlers: All', @@ -52,6 +57,7 @@ public static function getInfo() { * Tests most of the handlers. */ public function testHandlers() { + comment_add_default_comment_field('node', 'page'); $object_types = array_keys(ViewExecutable::viewsHandlerTypes()); foreach (views_fetch_data() as $base_table => $info) { if (!isset($info['table']['base'])) { diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php index 4d93194..49db5b7 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/HandlerTest.php @@ -33,7 +33,7 @@ public static function getInfo() { protected function setUp() { parent::setUp(); - + comment_add_default_comment_field('node', 'page'); $this->enableViewsTestModule(); } diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php index 0da4c1f..b580470 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php @@ -30,7 +30,7 @@ protected function setUp() { parent::setUp(); - + $this->view = $this->getBasicView(); } diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_destroy.yml b/core/modules/views/tests/views_test_config/config/views.view.test_destroy.yml index d49828d..711f8bd 100644 --- a/core/modules/views/tests/views_test_config/config/views.view.test_destroy.yml +++ b/core/modules/views/tests/views_test_config/config/views.view.test_destroy.yml @@ -135,11 +135,11 @@ display: last_comment_name: field: last_comment_name id: last_comment_name - table: node_comment_statistics + table: comment_entity_statistics last_comment_timestamp: field: last_comment_timestamp id: last_comment_timestamp - table: node_comment_statistics + table: comment_entity_statistics style: type: default row: diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_field_get_entity.yml b/core/modules/views/tests/views_test_config/config/views.view.test_field_get_entity.yml index d4b5377..cb22db4 100644 --- a/core/modules/views/tests/views_test_config/config/views.view.test_field_get_entity.yml +++ b/core/modules/views/tests/views_test_config/config/views.view.test_field_get_entity.yml @@ -21,7 +21,7 @@ display: field: nid id: nid table: node - relationship: entity_id + relationship: node uid: field: uid id: uid @@ -36,9 +36,9 @@ display: query: type: views_query relationships: - entity_id: - field: entity_id - id: entity_id + node: + field: node + id: node required: '1' table: comment uid: diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_handler_relationships.yml b/core/modules/views/tests/views_test_config/config/views.view.test_handler_relationships.yml index ab03b57..e53f8a5 100644 --- a/core/modules/views/tests/views_test_config/config/views.view.test_handler_relationships.yml +++ b/core/modules/views/tests/views_test_config/config/views.view.test_handler_relationships.yml @@ -12,15 +12,15 @@ display: table: node field: title relationships: - comment_cid: - id: comment_cid + comment_node: + id: comment_node table: node - field: comment_cid + field: comment_node nid: id: nid table: comment field: node - relationship: comment_cid + relationship: comment_node display_plugin: default display_title: Master id: default