mirror of
https://github.com/getgrav/grav.git
synced 2026-02-01 20:30:19 +01:00
Added lang template paths for theme by default
This commit is contained in:
@@ -57,6 +57,7 @@ class Twig
|
||||
public function __construct(Grav $grav)
|
||||
{
|
||||
$this->grav = $grav;
|
||||
$this->twig_paths = [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +73,19 @@ class Twig
|
||||
$locator = $this->grav['locator'];
|
||||
$debugger = $this->grav['debugger'];
|
||||
|
||||
$this->twig_paths = $locator->findResources('theme://templates');
|
||||
/** @var Language $language */
|
||||
$language = $this->grav['language'];
|
||||
|
||||
// handle language templates if available
|
||||
if ($language->enabled()) {
|
||||
$lang_templates = $locator->findResource('theme://templates/'.$language->getActive());
|
||||
if ($lang_templates) {
|
||||
$this->twig_paths[] = $lang_templates;
|
||||
}
|
||||
}
|
||||
|
||||
$this->twig_paths = array_merge($this->twig_paths, $locator->findResources('theme://templates'));
|
||||
|
||||
$this->grav->fireEvent('onTwigTemplatePaths');
|
||||
|
||||
$this->loader = new \Twig_Loader_Filesystem($this->twig_paths);
|
||||
|
||||
Reference in New Issue
Block a user