/** * {@inheritdoc} */ private function getTemplates($name) { // Config $context = $this->siteContext->getContext(); $templates = array($name); // Avoid non-end loops by declaring you want the original version if (preg_match('/^\\#/ui', $name, $matches)) { return array(preg_replace('/^\\#/ui', '', $name)); } // Find template name (or local path + name) $match_end = preg_match('/^(.*)[(\\:|\\:\\:)+](.*)(\\.html.twig|\\.php)?$/ui', $name, $matches); // Ultimate if (isset($matches[1]) && isset($matches[2]) && $context !== false) { // Template pseudo path $pseudo_template = $matches[1] . ":" . $context['namespace'] . '\\' . $matches[2]; // Pop value array_unshift($templates, $pseudo_template); } // Return templates return $templates; }
/** * @param Cache $cache * @param SiteContext $siteContext */ public function __construct(Cache $cache, SiteContext $siteContext) { parent::__construct($cache); $this->contextNamespace = $siteContext->getContext()['namespace']; }