diff --git a/core/modules/views/src/Plugin/views/display/EntityReference.php b/core/modules/views/src/Plugin/views/display/EntityReference.php index 699169958b1..eb5f04cfea0 100644 --- a/core/modules/views/src/Plugin/views/display/EntityReference.php +++ b/core/modules/views/src/Plugin/views/display/EntityReference.php @@ -54,6 +54,9 @@ class EntityReference extends DisplayPluginBase { $options['row']['contains']['type'] = ['default' => 'entity_reference']; $options['defaults']['default']['row'] = FALSE; + // Make sure the query is not cached. + $options['defaults']['default']['cache'] = FALSE; + // Set the display title to an empty string (not used in this display type). $options['title']['default'] = ''; $options['defaults']['default']['title'] = FALSE; @@ -62,12 +65,13 @@ class EntityReference extends DisplayPluginBase { } /** - * {@inheritdoc} + * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary(). + * + * Disable 'cache' and 'title' so it won't be changed. */ public function optionsSummary(&$categories, &$options) { parent::optionsSummary($categories, $options); - // Disable 'title' so it won't be changed from the default set in - // \Drupal\views\Plugin\views\display\EntityReference::defineOptions. + unset($options['query']); unset($options['title']); } diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php index 499d1b2c8ab..daad14896e4 100644 --- a/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php @@ -125,10 +125,6 @@ class DisplayEntityReferenceTest extends ViewTestBase { * Tests the entity reference display plugin. */ public function testEntityReferenceDisplay() { - // Test that the 'title' settings are not shown. - $this->drupalGet('admin/structure/views/view/test_display_entity_reference/edit/entity_reference_1'); - $this->assertSession()->linkByHrefNotExists('admin/structure/views/nojs/display/test_display_entity_reference/entity_reference_1/title'); - // Add the new field to the fields. $this->drupalPostForm('admin/structure/views/nojs/add-handler/test_display_entity_reference/default/field', ['name[entity_test__' . $this->fieldName . '.' . $this->fieldName . ']' => TRUE], t('Add and configure fields')); $this->drupalPostForm(NULL, [], t('Apply'));