Skip to content

Commit

Permalink
Fix regression
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhj committed Sep 5, 2024
1 parent cd6e4be commit 6a20bd5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ services:
arguments:
- '@database_connection'
- '@contao.twig.filesystem_loader'
- '%kernel.project_dir%'
- '%kernel.project_dir%/themes'

Richardhj\ContaoThemeFramework\Command\CreateThemeCommand:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public function load(array $configs, ContainerBuilder $container)
}

$config = $this->processConfiguration(new Configuration(), $configs);
$container->getDefinition(ThemeMigration::class)->replaceArgument(2, $config['themes_path']);
$container->getDefinition(ThemeMigration::class)->replaceArgument(3, $config['themes_path']);
}
}
8 changes: 6 additions & 2 deletions src/Migration/ThemeMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ class ThemeMigration implements MigrationInterface
{
private Connection $connection;
private ContaoFilesystemLoader $filesystemLoader;
private string $rootDir;
private string $themesPath;

public function __construct(Connection $connection, ContaoFilesystemLoader $filesystemLoader, string $themesPath)
public function __construct(Connection $connection, ContaoFilesystemLoader $filesystemLoader, string $rootDir, string $themesPath)
{
$this->connection = $connection;
$this->filesystemLoader = $filesystemLoader;
$this->rootDir = $rootDir;
$this->themesPath = $themesPath;
}

Expand Down Expand Up @@ -178,11 +180,13 @@ private function persistTheme($id, $name, string $themeName, string $manifestHas
{
$themeId = $id ?? null;

$themePath = str_replace($this->rootDir.'/', '', $this->themesPath);

$data = [
'name' => $name,
'alias' => $themeName,
'tstamp' => time(),
'templates' => sprintf('themes/%s/templates', $themeName),
'templates' => sprintf('%s/%s/templates', $themePath, $themeName),
'manifestHash' => $manifestHash,
];

Expand Down

0 comments on commit 6a20bd5

Please sign in to comment.