From 39c6ee27e87bbdf4c0c981bec71bf9dd11cfcab3 Mon Sep 17 00:00:00 2001 From: Vitaliy Dmytruk Date: Mon, 3 Feb 2020 14:10:06 +0200 Subject: [PATCH] Invalidate block_html cache when backend CSS saved. --- Observer/Backend/ThemeEditorConfigSave.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Observer/Backend/ThemeEditorConfigSave.php b/Observer/Backend/ThemeEditorConfigSave.php index b79e556..c5b0399 100644 --- a/Observer/Backend/ThemeEditorConfigSave.php +++ b/Observer/Backend/ThemeEditorConfigSave.php @@ -26,11 +26,13 @@ class ThemeEditorConfigSave implements \Magento\Framework\Event\ObserverInterfac public function __construct( \Swissup\ThemeEditor\Model\CssFactory $cssModelFactory, \Magento\Store\Model\ResourceModel\Store\CollectionFactory $storesFactory, - \Magento\Framework\App\ResourceConnection $coreResource + \Magento\Framework\App\ResourceConnection $coreResource, + \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList ) { $this->cssModelFactory = $cssModelFactory; $this->storesFactory = $storesFactory; $this->coreResource = $coreResource; + $this->cacheTypeList = $cacheTypeList; } public function execute(\Magento\Framework\Event\Observer $observer) @@ -62,6 +64,9 @@ public function execute(\Magento\Framework\Event\Observer $observer) } } } + + // Invalidate block_html cache to get new version of backend styles. + $this->cacheTypeList->invalidate(\Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER); } /**