From 988850cec491a3f7e8efe04744bd4bfa1c1b9fc4 Mon Sep 17 00:00:00 2001 From: Sky Lundy Date: Tue, 26 Dec 2023 14:30:50 -0800 Subject: [PATCH] Move initialization methods to init(), remove call to method that does not exist --- CHANGELOG.md | 9 +++++++++ Fluency.info.php | 2 +- Fluency.module.php | 30 +++++++----------------------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c627f25..e9333d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Fluency for ProcessWire Changelog +## 1.0.6 2023-12-26 + +### Bugfix, Internal Updates, Recommended for all users + +- Move initializations to `init()` method so that Fluency can be used prior to `ready()` which to + allow functionality to be extended beyond the page context. Allows Fluency to be accessed and + used by other modules. +- Removed call to previously removed method in module + ## 1.0.5 2023-12-22 ### _Critical update_, Bugfix upgrade recommended for all users. diff --git a/Fluency.info.php b/Fluency.info.php index f2773d5..720cdeb 100644 --- a/Fluency.info.php +++ b/Fluency.info.php @@ -6,7 +6,7 @@ $info = [ 'title' => 'Fluency', - 'version' => '105', + 'version' => '106', 'href' => 'https://processwire.com/talk/topic/24567-fluency-integrated-deepl-powered-content-translation', 'icon' => 'language', 'summary' => 'The complete translation enhancement suite for ProcessWire.', diff --git a/Fluency.module.php b/Fluency.module.php index da59499..2bff9b9 100644 --- a/Fluency.module.php +++ b/Fluency.module.php @@ -109,18 +109,18 @@ public function init() { $this->moduleJsPath = "{$this->urls->$this}assets/scripts/"; $this->moduleCssPath = "{$this->urls->$this}assets/styles/"; - } - /** - * Executes module when PW is ready - * @return void - */ - public function ready() { $this->fluencyConfig = (new FluencyConfig())->getConfigData(); $this->translationCache = new TranslationCache(); $this->engineLanguagesCache = new EngineLanguagesCache(); $this->initializeTranslationEngine(); + } + /** + * Executes admin UI when PW is ready + * @return void + */ + public function ready() { if (!$this->moduleShouldInitInAdmin()) { return false; } @@ -237,9 +237,7 @@ public function insertApiUsageTableFieldsetAssets(): void { * @return bool */ public function inputfieldTranslationIsReady(): bool { - return $this->translationEngineIsReady() && - $this->getDefaultConfiguredLanguage() && - count($this->getConfiguredLanguages()) >= 2; + return $this->translationEngineIsReady() && count($this->getConfiguredLanguages()) >= 2; } /** @@ -389,20 +387,6 @@ public function getUnconfiguredLanguages(): array { return $this->unconfiguredLanguages = array_values($unconfiguredLanguages); } - /** - * Get the default language configured in Fluency. - * - * #pw-group-Fluency-Module-Configuration-Data - * - * @return ConfiguredLanguageData|null - * - * Reference `Fluency/app/DataTransferObjects/ConfiguredLanguageData.php` - */ - // public function getDefaultConfiguredLanguage(): ?ConfiguredLanguageData { - // return $this->getConfiguredLanguages()->getDefault(); - // } - - /** * Gets all configuration data in one object. Can be passed into the ProcessWire JavaScript * config object