mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-09-25 05:01:37 +02:00
Set default values for values retrieved from the config
This commit is contained in:
@@ -17,12 +17,12 @@ class ViewComposer
|
||||
public function __invoke(Config $config, Twig $twig): void
|
||||
{
|
||||
$twig->getEnvironment()->getExtension(CoreExtension::class)->setDateFormat(
|
||||
$config->get('date_format'), '%d days'
|
||||
$config->get('date_format', 'Y-m-d H:i:s'), '%d days'
|
||||
);
|
||||
|
||||
$twig->getEnvironment()->addFunction(
|
||||
new TwigFunction('asset', function ($path) use ($config) {
|
||||
return "/app/themes/{$config->get('theme')}/{$path}";
|
||||
return "/app/themes/{$config->get('theme', 'defualt')}/{$path}";
|
||||
})
|
||||
);
|
||||
|
||||
|
@@ -21,7 +21,7 @@ $container = new Container();
|
||||
$container->set(Config::class, new Config('app/config'));
|
||||
$container->set(Twig::class, function (Config $config) {
|
||||
return new Twig("app/themes/{$config->get('theme')}", [
|
||||
'cache' => $config->get('view_cache')
|
||||
'cache' => $config->get('view_cache', 'app/cache/views')
|
||||
]);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user