diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index cf68a49..d412346 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -1225,7 +1225,7 @@ public function optionsSummary(&$categories, &$options) { if ($this->usesLinkDisplay()) { $display_id = $this->getLinkDisplay(); - $link_display = empty($this->view->display[$display_id]) ? t('None') : check_plain($this->view->display[$display_id]['display_title']); + $link_display = empty($this->view->storage->display[$display_id]) ? t('None') : check_plain($this->view->storage->display[$display_id]['display_title']); $link_display = $this->getOption('link_display') == 'custom_url' ? t('Custom URL') : $link_display; $options['link_display'] = array( 'category' => 'other', diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayTest.php index 0fd4bc3..9b3b9b4 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayTest.php @@ -55,7 +55,9 @@ public function testRemoveDisplay() { // Delete the page, so we can test the undo process. $this->drupalPost($path_prefix . '/page_1', array(), 'delete Page'); $this->assertFieldById('edit-displays-settings-settings-content-tab-content-details-top-actions-undo-delete', 'undo delete of Page', 'Make sure there a undo button on the page display after deleting.'); - $this->assertTrue($this->xpath('//a[contains(@class, :class)]', array(':class' => 'views-display-deleted-link')), 'Make sure the display link is marked as to be deleted.'); + + $element = $this->xpath('//a[contains(@href, :href) and contains(@class, :class)]', array(':href' => $path_prefix . '/page_1', ':class' => 'views-display-deleted-link')); + $this->assertTrue(!empty($element), 'Make sure the display link is marked as to be deleted.'); // Undo the deleting of the display. $this->drupalPost($path_prefix . '/page_1', array(), 'undo delete of Page'); @@ -128,7 +130,7 @@ public function testReorderDisplay() { */ public function testDefaultDisplay() { $this->drupalGet('admin/structure/views/view/test_display'); - $elements = $this->xpath('//*[@id="views-page-display-title"]'); + $elements = $this->xpath('//*[@id="views-page-1-display-title"]'); $this->assertEqual(count($elements), 1, 'The page display is loaded as the default display.'); } @@ -182,4 +184,26 @@ public function testDisplayPluginsAlter() { } } + /** + * Tests the link-display setting. + */ + public function testLinkDisplay() { + // Test setting the link display in the UI form. + $path = 'admin/structure/views/view/test_display/edit/block_1'; + $link_display_path = 'admin/structure/views/nojs/display/test_display/block_1/link_display'; + $this->drupalPost($link_display_path, array('link_display' => 'page_1'), t('Apply')); + // The form redirects to the master display. + $this->drupalGet($path); + + $result = $this->xpath("//a[contains(@href, :path)]", array(':path' => $link_display_path)); + $this->assertEqual($result[0], 'Page', 'Make sure that the link option summary shows the right linked display.'); + + $link_display_path = 'admin/structure/views/nojs/display/test_display/block_1/link_display'; + $this->drupalPost($link_display_path, array('link_display' => 'custom_url'), t('Apply')); + // The form redirects to the master display. + $this->drupalGet($path); + + $this->assertLink(t('Custom URL'), 0, 'The link option has custom url as summary.'); + } + } diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_display.yml b/core/modules/views/tests/views_test_config/config/views.view.test_display.yml index 5c44bb2..d18b24f 100644 --- a/core/modules/views/tests/views_test_config/config/views.view.test_display.yml +++ b/core/modules/views/tests/views_test_config/config/views.view.test_display.yml @@ -4,7 +4,7 @@ core: '8' description: '' disabled: '1' display: - block: + block_1: display_options: defaults: pager: '0' @@ -30,7 +30,7 @@ display: style_plugin: default display_plugin: block display_title: Block - id: block + id: block_1 position: '2' default: display_options: @@ -75,12 +75,12 @@ display: display_title: Master id: default position: '0' - page: + page_1: display_options: path: test-display display_plugin: page display_title: Page - id: page + id: page_1 position: '1' human_name: '' name: test_display