protected function addToTree(&$tree, TemplateInterface $template) { $location =& $tree; $parts = explode('/', $template->getKey()); // Remove template name array_pop($parts); if (count($parts) === 0) { array_unshift($parts, 'Default'); } foreach ($parts as $part) { if (!isset($location[$part])) { $location[$part] = []; } $location =& $location[$part]; } $location[$template->getKey()] = $template; }
protected function loadLayout(TemplateInterface $template) { try { $layoutData = $this->loader->load($template->getPath()); } catch (\Exception $e) { return $this->createLayout($template->getKey(), $template->getKey()); } // Did we even find a layout? if ($layoutData === null) { return $this->createLayout($template->getKey(), $template->getKey()); } try { $processed = $this->getProcessor()->processConfiguration($this->configuration, [['title' => $template->getKey()], $layoutData]); } catch (InvalidConfigurationException $e) { return $this->createLayout($template->getKey()); } return $this->createLayout($template->getKey(), $processed['title'], $processed['description'], $processed['layout']); }