Skip to content

Commit

Permalink
Move initialization methods to init(), remove call to method that doe…
Browse files Browse the repository at this point in the history
…s not exist
  • Loading branch information
SkyLundy committed Dec 26, 2023
1 parent 4496140 commit 988850c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Fluency.info.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
30 changes: 7 additions & 23 deletions Fluency.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 988850c

Please sign in to comment.