/** * Gets the decorator directory for a given template. * * @param string The template file * * @return string A template directory */ public function getDecoratorDir($template) { // if there is a configuration dimension if ($this->hasDimension()) { $cacheKey = sprintf('sf_decorator_dir_%s', $template); // if there is a cache return it if ($this->dimension->getCache()->has($cacheKey)) { $decoratorDir = $this->dimension->getCache()->get($cacheKey); } else { $dirs = $this->getDecoratorDirs(); foreach ($dirs as $dir) { if (is_readable($dir . '/' . $template)) { $decoratorDir = $dir; break; // find most specific and then break } } // save cache $this->dimension->getCache()->set($cacheKey, $decoratorDir); } } else { $decoratorDir = parent::getDecoratorDir($template); } return $decoratorDir; }