diff --git a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index ed22ea5..c713eed 100644 --- a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -1221,7 +1221,7 @@ abstract class DisplayPluginBase extends PluginBase { 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/lib/Drupal/views/Tests/UI/DisplayTest.php b/lib/Drupal/views/Tests/UI/DisplayTest.php index 42cae46..7ccf7df 100644 --- a/lib/Drupal/views/Tests/UI/DisplayTest.php +++ b/lib/Drupal/views/Tests/UI/DisplayTest.php @@ -55,7 +55,7 @@ class DisplayTest extends UITestBase { // 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('//div[contains(@class, views-display-deleted-link)]'). 'Make sure the display link is marked as to be deleted.'); + $this->assertTrue($this->xpath('//div[contains(@class, views-display-deleted-link)]'), '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'); @@ -127,7 +127,7 @@ class DisplayTest extends UITestBase { */ 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.'); } @@ -181,4 +181,26 @@ class DisplayTest extends UITestBase { } } + /** + * Tests the link-display setting. + */ + public function testLinkDisplay() { + // Link + $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/tests/views_test_config/config/views.view.test_display.yml b/tests/views_test_config/config/views.view.test_display.yml index 5c44bb2..d18b24f 100644 --- a/tests/views_test_config/config/views.view.test_display.yml +++ b/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