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..b6f56af 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 @@ -811,13 +811,20 @@ public function usesFields() { public function getPlugin($type) { // Look up the plugin name to use for this instance. $options = $this->getOption($type); - $name = $options['type']; + + // Return now if no options have been loaded. + if (empty($options) || !isset($options['type'])) { + 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')); $name = isset($views_data['table']['base']['query_id']) ? $views_data['table']['base']['query_id'] : 'views_query'; } + else { + $name = $options['type']; + } // Plugin instances are stored on the display for re-use. if (!isset($this->plugins[$type][$name])) { 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..548eaa6 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/edit/page_1'); + + $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'); + } + }