/** * $Up and $Top need to restore the overlay from the parent and top-level * scope respectively. */ public function obj($name, $arguments = [], $cache = false, $cacheName = null) { $overlayIndex = false; switch ($name) { case 'Up': $upIndex = $this->getUpIndex(); if ($upIndex === null) { user_error('Up called when we\'re already at the top of the scope', E_USER_ERROR); } $overlayIndex = $upIndex; // Parent scope break; case 'Top': $overlayIndex = 0; // Top-level scope break; } if ($overlayIndex !== false) { $itemStack = $this->getItemStack(); if (!$this->overlay && isset($itemStack[$overlayIndex][SSViewer_Scope::ITEM_OVERLAY])) { $this->overlay = $itemStack[$overlayIndex][SSViewer_Scope::ITEM_OVERLAY]; } } return parent::obj($name, $arguments, $cache, $cacheName); }