public static function getDefaultPath($template, $format)
{
$file = $template . '.' . $format;
if (isset(self::$files[$template])) {
$filesystem = \System::getContainer()->get('filesystem');
// Make the paths absolute (backwards compatibility)
if (!$filesystem->isAbsolutePath(self::$files[$template])) {
return TL_ROOT . '/' . self::$files[$template];
}
return self::$files[$template] . '/' . $file;
}
$strPath = null;
try {
// Search for the template if it is not in the lookup array (last match wins)
foreach (\System::getContainer()->get('contao.resource_finder')->findIn('templates')->name($file) as $file) {
$strPath = $file->getPathname();
}
} catch (\InvalidArgumentException $e) {
}
if ($strPath !== null) {
return $strPath;
}
throw new \Exception('Could not find template "' . $template . '"');
}