diff --git a/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig index 518ea7e29..43a91b5e1 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig @@ -2,8 +2,8 @@
{{ 'This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License'|trans|raw }}
- {% if chillBundlesVersion is defined %}
- {{ 'footer.Running chill version %version%'|trans({ '%version%': chillBundlesVersion.getFormattedVersion() }) }}
+ {% if get_chill_version() %}
+ {{ 'footer.Running chill version %version%'|trans({ '%version%': get_chill_version() }) }}
{% endif %}
diff --git a/src/Bundle/ChillMainBundle/Service/VersionProvider.php b/src/Bundle/ChillMainBundle/Service/VersionProvider.php
index 76ecf551f..28b4f3ff3 100644
--- a/src/Bundle/ChillMainBundle/Service/VersionProvider.php
+++ b/src/Bundle/ChillMainBundle/Service/VersionProvider.php
@@ -13,9 +13,9 @@ namespace Chill\MainBundle\Service;
use Composer\InstalledVersions;
-class VersionProvider
+readonly class VersionProvider
{
- public function __construct(private readonly string $packageName) {}
+ public function __construct(private string $packageName) {}
public function getVersion(): string
{
diff --git a/src/Bundle/ChillMainBundle/Templating/VersionRenderExtension.php b/src/Bundle/ChillMainBundle/Templating/VersionRenderExtension.php
new file mode 100644
index 000000000..ca3f362a2
--- /dev/null
+++ b/src/Bundle/ChillMainBundle/Templating/VersionRenderExtension.php
@@ -0,0 +1,35 @@
+getChillVersion(...)),
+ ];
+ }
+
+ public function getChillVersion(): string
+ {
+ return $this->versionProvider->getFormattedVersion();
+ }
+}
diff --git a/src/Bundle/ChillMainBundle/config/services.yaml b/src/Bundle/ChillMainBundle/config/services.yaml
index 0a2154bcb..f73eeb071 100644
--- a/src/Bundle/ChillMainBundle/config/services.yaml
+++ b/src/Bundle/ChillMainBundle/config/services.yaml
@@ -118,4 +118,4 @@ services:
Chill\MainBundle\Service\VersionProvider:
arguments:
- $packageName: ''
+ $packageName: 'chill-project/chill-bundles'
diff --git a/src/Bundle/ChillMainBundle/config/services/templating.yaml b/src/Bundle/ChillMainBundle/config/services/templating.yaml
index 56bc1ff75..c081d96fd 100644
--- a/src/Bundle/ChillMainBundle/config/services/templating.yaml
+++ b/src/Bundle/ChillMainBundle/config/services/templating.yaml
@@ -66,3 +66,7 @@ services:
resource: './../../Templating/Listing'
Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface: '@Chill\MainBundle\Templating\Listing\FilterOrderHelperFactory'
+
+ Chill\MainBundle\Templating\VersionRenderExtension:
+ tags:
+ - { name: twig.extension }