diff --git a/lib/Drupal/views/DisplayArray.php b/lib/Drupal/views/DisplayArray.php index d4e0f66..cf9dadf 100644 --- a/lib/Drupal/views/DisplayArray.php +++ b/lib/Drupal/views/DisplayArray.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\views\DisplayArray. + * Contains Drupal\views\DisplayArray. */ namespace Drupal\views; @@ -56,26 +56,23 @@ public function __destruct() { * The name of the display to initialize. */ protected function initializeDisplay($display_id) { - // If the display was initialize before just return it. + // If the display was initialize before just return. if (isset($this->display[$display_id])) { - return $this->display[$display_id]; + return; } + + // Retrieve and initialize the new display handler with data. $this->display[$display_id] = views_get_plugin('display', $this->view->storage->display[$display_id]['display_plugin']); - if (!empty($this->display[$display_id])) { - // Initialize the new display handler with data. - $this->display[$display_id]->init($this->view, $this->view->storage->display[$display_id]); - // If this is NOT the default display handler, let it know which is - // since it may well utilize some data from the default. - // This assumes that the 'default' handler is always first. It always - // is. Make sure of it. - if ($display_id != 'default') { - $this->display[$display_id]->default_display = $this->display['default']; - } + $this->display[$display_id]->init($this->view, $this->view->storage->display[$display_id]); + // If this is not the default display handler, let it know which is since + // it may well utilize some data from the default. + if ($display_id != 'default') { + $this->display[$display_id]->default_display = $this->display['default']; } } /** - * Initialized all displays of the view. + * Initializes all displays of the view. */ protected function initializeAllDisplays() { foreach (array_keys($this->view->storage->display) as $display_id) { @@ -94,13 +91,10 @@ public function offsetExists($offset) { * Implements \ArrayAccess::offsetGet(). */ public function offsetGet($offset) { - if (isset($this->display[$offset])) { - return $this->display[$offset]; - } - else { + if (!isset($this->display[$offset])) { $this->initializeDisplay($offset); - return $this->display[$offset]; } + return $this->display[$offset]; } /** diff --git a/lib/Drupal/views/ViewStorage.php b/lib/Drupal/views/ViewStorage.php index d4ae36c..be9f881 100644 --- a/lib/Drupal/views/ViewStorage.php +++ b/lib/Drupal/views/ViewStorage.php @@ -324,7 +324,7 @@ protected function generateDisplayId($plugin_id) { * @return Drupal\views\Plugin\views\display\DisplayPluginBase * A reference to the new handler object. */ - public function &newDisplay($plugin_id = 'page', $title = NULL, $id = NULL) { + public function newDisplay($plugin_id = 'page', $title = NULL, $id = NULL) { $id = $this->addDisplay($plugin_id, $title, $id); return $this->getExecutable()->newDisplay($id); }