diff --git a/core/modules/views/lib/Drupal/views/DisplayArray.php b/core/modules/views/lib/Drupal/views/DisplayArray.php index 4144393..5301687 100644 --- a/core/modules/views/lib/Drupal/views/DisplayArray.php +++ b/core/modules/views/lib/Drupal/views/DisplayArray.php @@ -44,7 +44,8 @@ public function __construct(ViewExecutable $view) { $this->initializeDisplay('default'); - $this->displayIDs = array_keys($this->view->storage->display); + // Store all display IDs to access them easy and fast. + $this->displayIDs = drupal_map_assoc(array_keys($this->view->storage->display)); } /** @@ -83,7 +84,7 @@ protected function initializeDisplay($display_id) { * Implements \ArrayAccess::offsetExists(). */ public function offsetExists($offset) { - return isset($this->displayHandlers[$offset]) || isset($this->view->storage->display[$offset]); + return isset($this->displayHandlers[$offset]) || isset($this->displayIDs[$offset]); } /** @@ -114,7 +115,8 @@ public function offsetUnset($offset) { * Implements \Iterator::current(). */ public function current() { - return current($this->displayIDs); + $display_id = $this->key(); + return $this->offsetGet($display_id); } /** @@ -150,7 +152,7 @@ public function rewind() { * Implements \Countable::count(). */ public function count() { - return count($this->view->storage->display); + return count($this->displayIDs); } }