Skip to content

Commit

Permalink
Defer resources to EVENT_INIT
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Jul 13, 2022
1 parent a9263db commit 37bb880
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

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

## 1.4.5 - 2022-07-14
### Improved
- MatrixMate now defers registering its CP resources to an `Application::EVENT_INIT` event handler, reducing the risk of conflicting with other plugins.

## 1.4.4 - 2022-06-22
### Fixed
- Fixes an issue where adding a block via existing blocks' disclosure menu could put a hash symbol in the browser's address bar, potentially causing various issues.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vaersaagod/matrixmate",
"description": "Welding Matrix into shape, mate!",
"type": "craft-plugin",
"version": "1.4.4",
"version": "1.4.5",
"keywords": [
"craft",
"cms",
Expand Down
10 changes: 5 additions & 5 deletions src/MatrixMate.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use craft\elements\User;
use craft\helpers\Json;
use craft\services\Fields;
use craft\services\Plugins;
use craft\web\Application;
use craft\web\Controller;

use vaersaagod\matrixmate\assetbundles\matrixmate\MatrixMateAsset;
Expand Down Expand Up @@ -79,9 +79,9 @@ public function init()
// Defer further initialisation to after plugins have loaded, and only for CP web requests
if (Craft::$app->getRequest()->getIsCpRequest() && !Craft::$app->getRequest()->getIsConsoleRequest()) {
Event::on(
Plugins::class,
Plugins::EVENT_AFTER_LOAD_PLUGINS,
[$this, 'onAfterLoadPlugins']
Application::class,
Application::EVENT_INIT,
[$this, 'onAppInit']
);
}

Expand All @@ -98,7 +98,7 @@ public function init()
/**
* @return void
*/
public function onAfterLoadPlugins(): void
public function onAppInit(): void
{

if (!Craft::$app->getUser()->checkPermission('accessCp')) {
Expand Down

0 comments on commit 37bb880

Please sign in to comment.