/** * {@inheritDoc} */ public function resolve($name, Renderer $renderer = null) { foreach ($this->prefixes as $prefix => &$resolver) { if (strpos($name, $prefix) !== 0) { continue; } if (!$resolver instanceof ResolverInterface) { $resolver = new TemplatePathStack(array('script_paths' => (array) $resolver)); } if ($result = $resolver->resolve(substr($name, strlen($prefix)), $renderer)) { return $result; } } return; }
/** * Retrieve the filesystem path to a view script * * @param string $name * @param null|Renderer $renderer * @throws \Zend\View\Exception\DomainException * @return string */ public function resolve($name, Renderer $renderer = null) { if (!self::$currentLayoutId) { $activeLayouts = LayoutService::getCurrentLayouts(); self::$currentLayoutId = end($activeLayouts)['name']; } // generate a cache name $cacheName = CacheUtility::getCacheName(self::CACHE_TEMPLATE_PATH, [$name, $renderer, self::$currentLayoutId]); // check data in cache if (null === ($templatePath = $this->dynamicCacheInstance->getItem($cacheName))) { if (false !== ($templatePath = parent::resolve($name, $renderer))) { // save data in cache $this->dynamicCacheInstance->setItem($cacheName, $templatePath); } } return $templatePath; }