public function getLayoutPathAndFilename($layoutName = 'Default')
{
if (isset($this->options['layoutPathAndFilename'])) {
return $this->options['layoutPathAndFilename'];
}
$layoutName = ucfirst($layoutName);
$paths = $this->getLayoutRootPaths();
if (isset($this->options['layoutPathAndFilenamePattern'])) {
$paths = $this->expandGenericPathPattern($this->options['layoutPathAndFilenamePattern'], array_merge($this->patternReplacementVariables, ['layout' => $layoutName]), true, true);
}
foreach ($paths as $layoutPathAndFilename) {
if (is_file($layoutPathAndFilename)) {
return $layoutPathAndFilename;
}
}
throw new Exception\InvalidTemplateResourceException('The layout files "' . implode('", "', $paths) . '" could not be loaded.', 1225709595);
}