Skip to content
Snippets Groups Projects
Commit 3d6a12a9 authored by catch's avatar catch
Browse files

Issue #2915175 by vaplas, Phonoman, Lendude: Duplicating a Page to Block after...

Issue #2915175 by vaplas, Phonoman, Lendude: Duplicating a Page to Block after changing the display id and then saving the view destroys the Page
parent 7eaf9abc
No related branches found
No related tags found
No related merge requests found
......@@ -245,6 +245,7 @@ public function duplicateDisplayAsType($old_display_id, $new_display_type) {
$display_duplicate = $displays[$old_display_id];
unset($display_duplicate['display_title']);
unset($display_duplicate['display_plugin']);
unset($display_duplicate['new_id']);
$displays[$new_display_id] = NestedArray::mergeDeep($displays[$new_display_id], $display_duplicate);
$displays[$new_display_id]['id'] = $new_display_id;
......
......@@ -143,6 +143,16 @@ public function testDuplicateDisplay() {
$this->assertFalse(isset($block_1->display['display_options']['path']));
$this->assertEqual($block_1->getOption('title'), $random_title, 'The overridden title option from the display got copied into the duplicate');
$this->assertEqual($block_1->getOption('css_class'), $random_css, 'The overridden css_class option from the display got copied into the duplicate');
// Test duplicating a display after changing the machine name.
$view_id = $view->id();
$this->drupalPostForm("admin/structure/views/nojs/display/$view_id/page_2/display_id", ['display_id' => 'page_new'], 'Apply');
$this->drupalPostForm(NULL, [], 'Duplicate as Block');
$this->drupalPostForm(NULL, [], t('Save'));
$view = Views::getView($view_id);
$view->initDisplay();
$this->assertNotNull($view->displayHandlers->get('page_new'), 'The original display is saved with a changed id');
$this->assertNotNull($view->displayHandlers->get('block_2'), 'The duplicate display is saved with new id');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment