Skip to content

Commit

Permalink
Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Mar 28, 2018
1 parent c9f950c commit 8cbf771
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
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.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
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": "mmikkel/cp-clearcache",
"description": "Fewer clicks to get clearin'",
"type": "craft-plugin",
"version": "1.0.0",
"version": "1.0.1",
"keywords": [
"craft",
"cms",
Expand Down
18 changes: 18 additions & 0 deletions src/CpClearCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand All @@ -80,6 +97,7 @@ public function init()
$data = [
'html' => $clearCachesUtility::contentHtml(),
];

Event::on(
View::class,
View::EVENT_BEFORE_RENDER_TEMPLATE,
Expand Down

0 comments on commit 8cbf771

Please sign in to comment.