/** * * @param boolean $includeDefaults Include the default values (yes for filtering, no for urls * @param string $sourceAction The action to get the cache from if not the current one. * @param boolean $readonly Optional, tell the cache not to store any new values * @param boolean $filterEmpty Optional, filter empty values from cache * @return array */ public function getCachedRequestData($includeDefaults = true, $sourceAction = null, $readonly = false, $filterEmpty = true) { if (!$this->requestCache) { $this->requestCache = $this->util->getRequestCache($sourceAction, $readonly); $this->requestCache->setMenu($this->menu); $this->requestCache->setRequest($this->request); // Button text should not be stored. $this->requestCache->removeParams(self::SEARCH_BUTTON, 'action'); } $data = $this->requestCache->getProgramParams(); if ($includeDefaults) { $data = $data + $this->getDefaultSearchData(); } if ($filterEmpty) { // Clean up empty values // // We do this here because empty values can be valid filters that overrule the default foreach ($data as $key => $value) { if (is_array($value) && empty($value) || is_string($value) && 0 === strlen($value)) { unset($data[$key]); } } } // Make sure to update the request $this->getRequest()->setParams($data); return $data; }