Skip to content

Commit 27ae99f

Browse files
committed
themes_path is relative now
1 parent 6a20bd5 commit 27ae99f

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/DependencyInjection/Configuration.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public function getConfigTreeBuilder(): TreeBuilder
2323
$treeBuilder->getRootNode()
2424
->children()
2525
->scalarNode('themes_path')
26-
->defaultValue('%kernel.project_dir%/themes')
26+
->defaultValue('themes')
27+
->info('The path to the themes directory, relative to the root dir.')
2728
->end()
2829
->end()
2930
;

src/Migration/ThemeMigration.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\Config\Definition\Processor;
2323
use Symfony\Component\Config\Loader\DelegatingLoader;
2424
use Symfony\Component\Config\Loader\LoaderResolver;
25+
use Symfony\Component\Filesystem\Path;
2526
use Symfony\Component\Finder\Finder;
2627

2728
/**
@@ -49,13 +50,14 @@ public function getName(): string
4950

5051
public function shouldRun(): bool
5152
{
52-
if (!file_exists($this->themesPath)) {
53+
$themesPath = Path::join($this->rootDir, $this->themesPath);
54+
if (!file_exists($themesPath)) {
5355
return false;
5456
}
5557

5658
$manifests = (new Finder())
5759
->files()
58-
->in($this->themesPath)
60+
->in($themesPath)
5961
->name(['theme.yml', 'theme.yaml'])
6062
->getIterator()
6163
;
@@ -88,9 +90,10 @@ public function shouldRun(): bool
8890

8991
public function run(): MigrationResult
9092
{
93+
$themesPath = Path::join($this->rootDir, $this->themesPath);
9194
$manifests = (new Finder())
9295
->files()
93-
->in($this->themesPath)
96+
->in($themesPath)
9497
->name(['theme.yml', 'theme.yaml'])
9598
->getIterator()
9699
;
@@ -180,13 +183,11 @@ private function persistTheme($id, $name, string $themeName, string $manifestHas
180183
{
181184
$themeId = $id ?? null;
182185

183-
$themePath = str_replace($this->rootDir.'/', '', $this->themesPath);
184-
185186
$data = [
186187
'name' => $name,
187188
'alias' => $themeName,
188189
'tstamp' => time(),
189-
'templates' => sprintf('%s/%s/templates', $themePath, $themeName),
190+
'templates' => sprintf('%s/%s/templates', $this->themesPath, $themeName),
190191
'manifestHash' => $manifestHash,
191192
];
192193

0 commit comments

Comments
 (0)