allow to include bundle configuration in system configuration screen (#1235)

This commit is contained in:
Kevin Papst
2019-11-14 19:25:38 +01:00
committed by GitHub
parent c32cd36861
commit b4739f8f03
4 changed files with 106 additions and 15 deletions

View File

@@ -60,8 +60,6 @@ class AppExtension extends Extension
$this->createThemeParameter($config['theme'], $container);
$this->createUserParameter($config['user'], $container);
$container->setParameter('kimai.config', $config);
$container->setParameter('kimai.timesheet', $config['timesheet']);
$container->setParameter('kimai.timesheet.rates', $config['timesheet']['rates']);
$container->setParameter('kimai.timesheet.rounding', $config['timesheet']['rounding']);
@@ -77,6 +75,22 @@ class AppExtension extends Extension
$localTranslations[] = $config['industry']['translation'];
}
$container->setParameter('kimai.i18n_domains', $localTranslations);
// this should happen always at the end, so bundles do not mess with the base configuration
if ($container->hasParameter('kimai.bundles.config')) {
$bundleConfig = $container->getParameter('kimai.bundles.config');
if (!is_array($bundleConfig)) {
trigger_error('Invalid bundle configuration found, skipping all bundle configuration');
}
foreach ($bundleConfig as $key => $value) {
if (array_key_exists($key, $config)) {
trigger_error(sprintf('Invalid bundle configuration "%s" found, skipping', $key));
continue;
}
$config[$key] = $value;
}
}
$container->setParameter('kimai.config', $config);
}
protected function setLdapParameter(array $config, ContainerBuilder $container)