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 07423cb..57df49d 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 @@ -813,6 +813,11 @@ public function getPlugin($type) { $options = $this->getOption($type); $name = $options['type']; + // Return now if no options have been loaded. + if (empty($options)) { + return; + } + // Query plugins allow specifying a specific query class per base table. if ($type == 'query') { $views_data = Views::viewsData()->get($this->view->storage->get('base_table')); diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayPath.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayPath.php index 89f4822..74b90c7 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayPath.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayPath.php @@ -55,4 +55,31 @@ public function testDeleteWithNoPath() { $this->assertRaw(t('The view %view has been saved.', array('%view' => 'Test view'))); } + /** + * Tests the menu and tab option form. + */ + public function testMenuOptions() { + $this->container->get('module_handler')->enable(array('menu')); + $this->drupalGet('admin/structure/views/view/test_view'); + + // Add a new page display. + $this->drupalPost(NULL, array(), 'Add Page'); + // Save a path. + $this->drupalPost("admin/structure/views/nojs/display/test_view/page_1/path", array('path' => $this->randomString()), t('Apply')); + $this->drupalGet('admin/structure/views/view/test_view'); + + $this->drupalPost('admin/structure/views/nojs/display/test_view/page_1/menu', array('menu[type]' => 'default tab', 'menu[title]' => 'Test tab title'), t('Apply')); + $this->assertResponse(200); + $this->assertUrl('admin/structure/views/nojs/display/test_view/page_1/tab_options'); + + $this->drupalPost(NULL, array('tab_options[type]' => 'tab', 'tab_options[title]' => $this->randomString()), t('Apply')); + $this->assertResponse(200); + $this->assertUrl('admin/structure/views/view/test_view'); + + $this->drupalGet('admin/structure/views/view/test_view'); + $this->assertLink(t('Tab: @title', array('@title' => 'Test tab title'))); + // If it's a default tab, it should also have an additional settings link. + $this->assertLinkByHref('admin/structure/views/nojs/display/test_view/page_1/tab_options'); + } + }