From b93c8e0e547d35d52fd5b0390a40be04e4c2f0d1 Mon Sep 17 00:00:00 2001 From: Daniel Wehner Date: Mon, 27 Aug 2012 11:30:21 +0200 Subject: [PATCH] Provide a sane default for the displays. --- lib/Drupal/views/ViewStorageController.php | 10 ++++++++++ views.module | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/Drupal/views/ViewStorageController.php b/lib/Drupal/views/ViewStorageController.php index ef5911aa09d..f297b075c4e 100644 --- a/lib/Drupal/views/ViewStorageController.php +++ b/lib/Drupal/views/ViewStorageController.php @@ -104,7 +104,17 @@ class ViewStorageController extends ConfigStorageController { * Overrides Drupal\config\ConfigStorageController::create(). */ public function create(array $values) { + + // If there is no information about displays available add at least the + // default display. + $values += array( + 'display' => array( + 'default' => array() + ) + ); + $entity = parent::create($values); + $this->attachDisplays($entity); return $entity; } diff --git a/views.module b/views.module index 5d13a631789..e17fa825fd2 100644 --- a/views.module +++ b/views.module @@ -1507,9 +1507,7 @@ function views_get_all_templates() { * it can be successfully saved. */ function views_new_view() { - $view = new View(); - $view->vid = 'new'; - $view->add_display('default'); + $view = entity_create('view', array()); return $view; }