From 6a0593601f747892ace65f1452ff54c424177415 Mon Sep 17 00:00:00 2001 From: dereine <dereine@99340.no-reply.drupal.org> Date: Thu, 27 Sep 2012 23:45:27 +0200 Subject: [PATCH] Issue #1793992 by dawehner | smiletrl: Fixed Add new displays will change the default displays?. --- lib/Drupal/views/Tests/UI/DisplayTest.php | 7 +++++++ lib/Drupal/views/ViewUI.php | 3 +++ 2 files changed, 10 insertions(+) diff --git a/lib/Drupal/views/Tests/UI/DisplayTest.php b/lib/Drupal/views/Tests/UI/DisplayTest.php index 5a38e696aec7..918478b81fa8 100644 --- a/lib/Drupal/views/Tests/UI/DisplayTest.php +++ b/lib/Drupal/views/Tests/UI/DisplayTest.php @@ -73,16 +73,23 @@ public function testRemoveDisplay() { * Tests adding a display. */ public function testAddDisplay() { + // Show the master display. + config('views.settings')->set('ui.show.master_display', TRUE)->save(); + $settings['page[create]'] = FALSE; $view = $this->randomView($settings); $path_prefix = 'admin/structure/views/view/' . $view['name'] .'/edit'; $this->drupalGet($path_prefix); + $this->drupalPost(NULL, array(), t('Save')); // Add a new display. $this->drupalPost(NULL, array(), 'Add Page'); // @todo Revising this after http://drupal.org/node/1793700 got in. $this->assertLinkByHref($path_prefix . '/page_1', 0, 'Make sure after adding a display the new display appears in the UI'); + + $this->assertNoLink('Master*', 0, 'Make sure the master display is not marked as changed.'); + $this->assertLink('Page*', 0, 'Make sure the added display is marked as changed.'); } /** diff --git a/lib/Drupal/views/ViewUI.php b/lib/Drupal/views/ViewUI.php index 5c7e34470958..91d7e90f01a8 100644 --- a/lib/Drupal/views/ViewUI.php +++ b/lib/Drupal/views/ViewUI.php @@ -789,6 +789,9 @@ public function submitDisplayAdd($form, &$form_state) { $parents = $form_state['triggering_element']['#parents']; $display_type = array_pop($parents); $display_id = $this->storage->addDisplay($display_type); + // A new display got added so the asterisks symbol should appear on the new + // display. + $this->current_display = $display_id; views_ui_cache_set($this); // Redirect to the new display's edit page. -- GitLab