Skip to content
Code-Schnipsel Gruppen Projekte
Commit 7662b2f5 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: include css files from sub menu controls

Übergeordneter 49fef759
No related branches found
No related tags found
2 Merge Requests!7include css files from sub menu controls,!6fix: include css files from sub menu controls
......@@ -41,7 +41,7 @@ public function __construct($attributes = [])
parent::__construct($attributes);
$this->addCSSClass('quiqqer-menu-megaMenu');
$this->addCSSFile(dirname(__FILE__) . '/MegaMenu.css');
$this->addCSSFile(dirname(__FILE__).'/MegaMenu.css');
if (!$this->getAttribute('enableMobile')) {
return;
......@@ -68,10 +68,10 @@ public function __construct($attributes = [])
*/
public function getBody()
{
$cache = EventHandler::menuCacheName() . '/megaMenu/';
$cache = EventHandler::menuCacheName().'/megaMenu/';
$cache .= \md5(
$this->getSite()->getCachePath() .
$this->getSite()->getCachePath().
\serialize($this->getAttributes())
);
......@@ -80,9 +80,16 @@ public function getBody()
try {
$cacheResult = QUI\Cache\Manager::get($cache);
// load css files of controls
// load css files from the controls
$cssFiles = [];
foreach ($cacheResult['subMenus'] as $childControl) {
new $childControl();
$Instance = new $childControl();
$cssFiles = \array_merge($cssFiles, $Instance->getCSSFiles());
}
foreach ($cssFiles as $cssFile) {
QUI\Control\Manager::addCSSFile($cssFile);
}
return $cacheResult['html'];
......@@ -126,7 +133,7 @@ public function getBody()
}
$result = [
'html' => $Engine->fetch(dirname(__FILE__) . '/MegaMenu.html'),
'html' => $Engine->fetch(dirname(__FILE__).'/MegaMenu.html'),
'subMenus' => \array_unique($this->subMenus)
];
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren