Newer
Older
<?php
/**
* This file contains QUI\Menu\MegaMenu
*/
namespace QUI\Menu;
use QUI;
/**
* Class MegaMenu
*
* @package QUI\Menu
*/
{
/**
* @param array $attributes
*/
public function __construct($attributes = array())
{
$this->setAttributes(array(
'showStart' => false,
'Start' => false,
'data-qui' => 'package/quiqqer/menu/bin/MegaMenu',
'display' => $this->getProject()->getConfig('menu.settings.type')
));
parent::__construct($attributes);
$this->addCSSClass('quiqqer-menu-megaMenu');
$this->addCSSFile(dirname(__FILE__) . '/MegaMenu.css');
}
/**
* @return string
* @throws QUI\Exception
*/
public function getBody()
{
$Engine = QUI::getTemplateManager()->getEngine();
switch ($this->getAttribute('display')) {
case 'Image':
case QUI\Menu\Mega\Image::class:
$childControl = QUI\Menu\Mega\Image::class;
break;
case 'Icons':
case QUI\Menu\Mega\Icons::class:
$childControl = QUI\Menu\Mega\Icons::class;
break;
case 'IconsDescription':
case QUI\Menu\Mega\IconsDescription::class:
$childControl = QUI\Menu\Mega\IconsDescription::class;
break;

Henning Leutz
committed
default:

Henning Leutz
committed
case QUI\Menu\Mega\Standard::class:
$childControl = QUI\Menu\Mega\Standard::class;
break;
}

Henning Leutz
committed
'this' => $this,
'Site' => $this->getSite(),
'Project' => $this->getProject(),
'Start' => $this->getStart(),
'children' => $this->getStart()->getNavigation(),
'Rewrite' => QUI::getRewrite(),
'jsControl' => 'package/quiqqer/menu/bin/MegaMenu',
'prepend' => $this->prepend,
'append' => $this->append,
'childControl' => $childControl
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
));
return $Engine->fetch(dirname(__FILE__) . '/MegaMenu.html');
}
/**
* @return QUI\Projects\Site
*/
public function getStart()
{
if ($this->getAttribute('Start')) {
return $this->getAttribute('Start');
}
return $this->getProject()->firstChild();
}
/**
* Return the current site
*
* @return mixed|QUI\Projects\Site
*/
protected function getSite()
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
}
return QUI::getRewrite()->getSite();
}
}