Skip to content

Commit 90df4fc

Browse files
committed
Plugin initialisation
1 parent 122eeab commit 90df4fc

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 4.5.2 - 2024-11-21
8+
9+
### Changed
10+
- Moved plugin registrations depending on Craft's initialization into onInit() method
11+
712
## 4.5.1 - 2024-07-18
813

914
### Fixed

src/OhDear.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,18 @@ public function init(): void
9797
]);
9898

9999
$this->registerPermissions();
100-
101-
if (Craft::$app->request->isCpRequest && Craft::$app->user->getIdentity()) {
102-
OhDearAsset::registerLangFile();
103-
$this->registerFrontendPermissions();
104-
$this->registerWidgets();
105-
$this->registerUtilityTypes();
106-
}
107-
100+
$this->registerUtilityTypes();
101+
$this->registerWidgets();
108102
$this->registerUrlRules();
109-
110103
$this->registerCpRoutes();
111-
112104
$this->registerEntryEditRedirectOverride();
105+
106+
Craft::$app->onInit(function () {
107+
if (Craft::$app->request->isCpRequest && Craft::$app->user->getIdentity()) {
108+
$this->registerFrontendPermissions();
109+
OhDearAsset::registerLangFile();
110+
}
111+
});
113112
}
114113

115114
protected function createSettingsModel(): ?Model

0 commit comments

Comments
 (0)