diff --git a/src/TagManager.php b/src/TagManager.php index 37faa05..b463db1 100644 --- a/src/TagManager.php +++ b/src/TagManager.php @@ -13,6 +13,8 @@ use craft\base\Model; use craft\base\Plugin; use craft\elements\actions\Edit; +use craft\elements\Tag as CraftTagElement; +use craft\events\ModelEvent; use craft\events\RegisterCpNavItemsEvent; use craft\events\RegisterElementActionsEvent; use craft\events\RegisterUrlRulesEvent; @@ -82,7 +84,14 @@ public function init () [$this, 'onRegisterIgnoredTypes'] ); } - + + Event::on( + CraftTagElement::class, + CraftTagElement::EVENT_AFTER_SAVE, + function (ModelEvent $event) { + Craft::$app->elements->invalidateCachesForElementType(Tag::class); + } + ); } // Craft @@ -179,4 +188,4 @@ public function onRegisterIgnoredTypes (RegisterIgnoredTypesEvent $event) $event->types[] = Tag::class; } -} \ No newline at end of file +}