diff --git a/CHANGELOG.md b/CHANGELOG.md index 21d206ff9..7ee604c90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Improved session fixation handling in PHP 7.4+ (cannot fix it in PHP 7.3 due to PHP bug) * Added optional password/database attributes for redis in `system.yaml` * Added ability to filter enabled or disabled with bin/gpm index [#3187](https://github.com/getgrav/grav/pull/3187) + * Added `$grav->getVersion()` or `grav.version` in twig to get the current Grav version [#3142](https://github.com/getgrav/grav/issues/3142) 1. [](#bugfix) * Fixed CLI progressbar in `backup` and `security` commands to use styled output [#3198](https://github.com/getgrav/grav/issues/3198) * Fixed page save failing because of uploaded images [#3191](https://github.com/getgrav/grav/issues/3191) diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index db8316a9e..048f7d40b 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -162,6 +162,19 @@ class Grav extends Container return self::$instance; } + /** + * Get Grav version. + * + * @return string + */ + public function getVersion(): string + { + return GRAV_VERSION; + } + + /** + * @return bool + */ public function isSetup(): bool { return isset($this->initialized['setup']);