diff --git a/src/QUI/Bricks/Brick.php b/src/QUI/Bricks/Brick.php index 6772b15f33d7bf92857ffa3c588d2e52e3b087c1..d82b688579059c43004ab514a43cafaccb49918b 100644 --- a/src/QUI/Bricks/Brick.php +++ b/src/QUI/Bricks/Brick.php @@ -277,7 +277,23 @@ public function create() .$this->hash; try { - return QUI\Cache\Manager::get($cacheName); + $data = QUI\Cache\Manager::get($cacheName); + $cssFiles = $data['cssFiles']; + $cssClasses = $data['cssClasses']; + + if (\is_array($cssClasses)) { + foreach ($cssClasses as $cssClass) { + $this->addCSSClass($cssClass); + } + } + + if (\is_array($cssFiles)) { + foreach ($cssFiles as $cssFile) { + QUI\Control\Manager::addCSSFile($cssFile); + } + } + + return $data['html']; } catch (QUI\Exception $Exception) { } @@ -335,7 +351,12 @@ public function create() ]); $result = $Engine->fetch(\dirname(__FILE__).'/Brick.html'); - QUI\Cache\Manager::set($cacheName, $result); + + QUI\Cache\Manager::set($cacheName, [ + 'html' => $result, + 'cssClasses' => $this->cssClasses, + 'cssFiles' => [] + ]); return $result; } @@ -370,7 +391,12 @@ public function create() } $result = $Control->create(); - QUI\Cache\Manager::set($cacheName, $result); + + QUI\Cache\Manager::set($cacheName, [ + 'result' => $result, + 'cssClasses' => $this->cssClasses, + 'cssFiles' => $Control->getCSSFiles() + ]); return $result; }