From 8cbf7715e9f68104a9a0dda4747d5d101773f29d Mon Sep 17 00:00:00 2001 From: Mats Mikkel Rummelhoff Date: Wed, 28 Mar 2018 09:26:11 +0200 Subject: [PATCH] Fixes #1 --- CHANGELOG.md | 4 ++++ composer.json | 2 +- src/CpClearCache.php | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f6a26e..2d3f1de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.0.1 - 2018-03-28 +### Fixed +- Fixes issue #1, where CP Clear Cache would conflict w/ other plugins (e.g. SEOmatic) + ## 1.0.0 - 2018-03-06 ### Added - Initial release diff --git a/composer.json b/composer.json index 16d9a82..85dc8ad 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "mmikkel/cp-clearcache", "description": "Fewer clicks to get clearin'", "type": "craft-plugin", - "version": "1.0.0", + "version": "1.0.1", "keywords": [ "craft", "cms", diff --git a/src/CpClearCache.php b/src/CpClearCache.php index 57359ec..84fa759 100644 --- a/src/CpClearCache.php +++ b/src/CpClearCache.php @@ -14,6 +14,7 @@ use craft\base\Plugin; use craft\base\UtilityInterface; use craft\events\RegisterCpNavItemsEvent; +use craft\services\Plugins; use craft\web\assets\utilities\UtilitiesAsset; use craft\web\twig\variables\Cp; use craft\web\View; @@ -65,6 +66,22 @@ public function init() return; } + // Handler: EVENT_AFTER_LOAD_PLUGINS + Event::on( + Plugins::class, + Plugins::EVENT_AFTER_LOAD_PLUGINS, + function () { + $this->doIt(); + } + ); + + } + + /** + * + */ + protected function doIt() + { $utilitiesService = Craft::$app->getUtilities(); /** @var UtilityInterface $clearCachesUtility */ @@ -80,6 +97,7 @@ public function init() $data = [ 'html' => $clearCachesUtility::contentHtml(), ]; + Event::on( View::class, View::EVENT_BEFORE_RENDER_TEMPLATE,