Issue #2153469 by Garrett Albright, olli, swentel, webchick: View page display getting re-ordered on import, leading config system to believe it hasn't been imported yet.
parent
c9a8e335ee
commit
2421c75fbe
|
@ -198,7 +198,7 @@ class View extends ConfigEntityBase implements ViewStorageInterface {
|
|||
'display_plugin' => $plugin_id,
|
||||
'id' => $id,
|
||||
'display_title' => $title,
|
||||
'position' => count($this->display),
|
||||
'position' => $id === 'default' ? 0 : count($this->display),
|
||||
'provider' => $plugin['provider'],
|
||||
'display_options' => array(),
|
||||
);
|
||||
|
|
|
@ -240,6 +240,17 @@ class ViewStorageTest extends ViewUnitTestBase {
|
|||
$display = $view->get('display');
|
||||
$this->assertEqual($display[$id]['display_title'], 'Page 3');
|
||||
|
||||
// Ensure the 'default' display always has position zero, regardless of when
|
||||
// it was created relative to other displays.
|
||||
$displays = $view->get('display');
|
||||
$displays['default']['deleted'] = TRUE;
|
||||
$view->set('display', $displays);
|
||||
$view->set('id', $this->randomName());
|
||||
$view->save();
|
||||
$view->addDisplay('default', $random_title);
|
||||
$displays = $view->get('display');
|
||||
$this->assertEqual($displays['default']['position'], 0, 'Default displays are always in position zero');
|
||||
|
||||
// Tests Drupal\views\Entity\View::generateDisplayId().
|
||||
// @todo Sadly this method is not public so it cannot be tested.
|
||||
// $view = $this->controller->create(array());
|
||||
|
|
Loading…
Reference in New Issue