Skip to content

Commit

Permalink
Use correct template directory in templateselect
Browse files Browse the repository at this point in the history
  • Loading branch information
I-Valchev authored and bobdenotter committed Nov 17, 2020
1 parent 7c97529 commit 4d63576
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Configuration/Parser/ThemeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public function parse(): Collection
{
$theme = $this->parseConfigYaml($this->path . '/theme.yaml', true);

if (! isset($theme['template_directory'])) {
// the theme itself
$theme['template_directory'] = './';
}

return new Collection($theme);
}
}
5 changes: 4 additions & 1 deletion src/Twig/ContentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,12 @@ public function getListTemplates(TemplateselectField $field): Collection
$current = current($field->getValue());

$finder = new Finder();
$templatesDir = $this->config->get('theme/template_directory');
$templatesPath = $this->config->getPath('theme', true, $templatesDir);

$finder
->files()
->in($this->config->getPath('theme'))
->in($templatesPath)
->name($definition->get('filter', '/^[^_].*\.twig$/'))
->path($definition->get('path'));

Expand Down

0 comments on commit 4d63576

Please sign in to comment.