diff --git a/CHANGELOG.md b/CHANGELOG.md index d0582c1..13ada98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Unreleased + +### Fixed +- Fixed a bug where Quick Field was trying to initialise in environments where admin changes are disallowed + ## 2.0.4 - 2023-04-26 ### Fixed diff --git a/src/Plugin.php b/src/Plugin.php index 5e1a3f5..2642bcb 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -48,7 +48,12 @@ private function _includeResources(): void Craft::$app->on(Application::EVENT_INIT, function() { $request = Craft::$app->getRequest(); - if ($request->getIsCpRequest() && !$request->getIsAjax() && Craft::$app->getUser()->getIsAdmin()) { + if ( + $request->getIsCpRequest() && + !$request->getIsAjax() && + Craft::$app->getUser()->getIsAdmin() && + Craft::$app->getConfig()->getGeneral()->allowAdminChanges + ) { Craft::$app->getView()->registerAssetBundle(QuickFieldAsset::class); } });