diff --git a/CHANGELOG.md b/CHANGELOG.md index 61b3757a9..8e8079092 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,18 @@ -# v1.2.3 +# v1.2.4 ## 04/xx/2017 +1. [](#bugfix) + * Allow multiple calls to `Themes::initTheme()` without throwing errors + +# v1.2.3 +## 04/19/2017 + 1. [](#improved) * Added new `pwd_regex` and `username_regex` system configuration options to allow format modifications * Allow `user/accounts.yaml` overrides and implemented more robust theme initialization - + * improved `getList()` method to do more powerful things + * Fix Typo in GPM [#1427](https://github.com/getgrav/grav/issues/1427) + # v1.2.2 ## 04/11/2017 diff --git a/system/defines.php b/system/defines.php index fb565e9ec..6e79ce7cf 100644 --- a/system/defines.php +++ b/system/defines.php @@ -8,7 +8,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.2.2'); +define('GRAV_VERSION', '1.2.3'); define('GRAV_TESTING', false); define('DS', '/'); diff --git a/system/src/Grav/Common/Themes.php b/system/src/Grav/Common/Themes.php index bfe31e01c..492c86610 100644 --- a/system/src/Grav/Common/Themes.php +++ b/system/src/Grav/Common/Themes.php @@ -24,6 +24,8 @@ class Themes extends Iterator /** @var Config */ protected $config; + protected $inited = false; + /** * Themes constructor. * @@ -51,25 +53,29 @@ class Themes extends Iterator public function initTheme() { - /** @var Themes $themes */ - $themes = $this->grav['themes']; + if ($this->inited === false) { + /** @var Themes $themes */ + $themes = $this->grav['themes']; - try { - $instance = $themes->load(); - } catch (\InvalidArgumentException $e) { - throw new \RuntimeException($this->current() . ' theme could not be found'); + try { + $instance = $themes->load(); + } catch (\InvalidArgumentException $e) { + throw new \RuntimeException($this->current() . ' theme could not be found'); + } + + if ($instance instanceof EventSubscriberInterface) { + /** @var EventDispatcher $events */ + $events = $this->grav['events']; + + $events->addSubscriber($instance); + } + + $this->grav['theme'] = $instance; + + $this->grav->fireEvent('onThemeInitialized'); + + $this->inited = true; } - - if ($instance instanceof EventSubscriberInterface) { - /** @var EventDispatcher $events */ - $events = $this->grav['events']; - - $events->addSubscriber($instance); - } - - $this->grav['theme'] = $instance; - - $this->grav->fireEvent('onThemeInitialized'); } /**