Skip to content

Commit a9eea3a

Browse files
authored
fix default theme config loader priority (#214)
1 parent 60e2052 commit a9eea3a

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

UPGRADE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Upgrade Notes
22

3+
## 5.0.4
4+
- Fix default theme config loader priority
5+
36
## 5.0.3
47
- Respect editable configuration for standalone editables in headless document
58

src/DependencyInjection/ToolboxExtension.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,15 @@ public function prepend(ContainerBuilder $container): void
4646
}
4747

4848
$coreLoader->load(sprintf('core_areas/%s_service.yaml', $areaName));
49-
50-
// @see https://github.com/symfony/symfony/issues/52789
51-
$data = $coreLoader->getLocator()->locate(sprintf('core_areas/%s_config.yaml', $areaName));
52-
$parsedData = Yaml::parseFile($data);
53-
54-
if (array_key_exists('toolbox', $parsedData)) {
55-
$container->prependExtensionConfig('toolbox', $parsedData['toolbox']);
56-
}
49+
$this->prependConfigToContainer($coreLoader, $container, sprintf('core_areas/%s_config.yaml', $areaName));
5750

5851
$loaded[] = $areaName;
5952
}
6053
}
6154

6255
// add default theme (b4) if not set
6356
if ($hasTheme === false) {
64-
$coreLoader->load('theme/bootstrap4_theme.yaml');
57+
$this->prependConfigToContainer($coreLoader, $container, 'theme/bootstrap4_theme.yaml');
6558
}
6659

6760
$container->setParameter('toolbox.wysiwyg_editor', $wysiwygEditor);
@@ -250,4 +243,18 @@ private function parseContextConfigs(array $configs): array
250243

251244
return $configs;
252245
}
246+
247+
private function prependConfigToContainer(YamlFileLoader $loader, ContainerBuilder $container, string $configPath): void
248+
{
249+
// @see https://github.com/symfony/symfony/issues/52789
250+
251+
$data = $loader->getLocator()->locate($configPath);
252+
$parsedData = Yaml::parseFile($data, Yaml::PARSE_CONSTANT);
253+
254+
if (!array_key_exists('toolbox', $parsedData)) {
255+
return;
256+
}
257+
258+
$container->prependExtensionConfig('toolbox', $parsedData['toolbox']);
259+
}
253260
}

0 commit comments

Comments
 (0)