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']); }