Skip to content

Commit

Permalink
Fix plugin trying to initialise when admin changes disallowed
Browse files Browse the repository at this point in the history
  • Loading branch information
ttempleton committed Aug 19, 2023
1 parent c5085a6 commit 5a9093c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down

0 comments on commit 5a9093c

Please sign in to comment.