*/
protected $_classes = [];
+
+ /**
+ * @var string
+ */
+ protected $_type = '';
+
/**
* @param string $id
*/
$this->addChild($child);
}
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->_type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setType(string $type): void
+ {
+ $this->_type = $type;
+ }
+
/**
* @return mixed
*/
/**
* @return string
*/
- public function getTitle(): string
+ public function getTitle()
{
return $this->_title;
}
/**
* @param string $title
*/
- public function setTitle(string $title): void
+ public function setTitle($title)
{
$this->_title = $title;
}
// Handle items with submenus
if ($child->hasChildren()) {
// Create an empty sub-element that will serve as a wrapper for the submenu(s)
- $wrapper = $parent->raw('')->attr(['class' => 'nav-submenu-wrapper']);
+
+
+ if ($child->getType() == 'mega') {
+ foreach ($child->getChildren() as $submenu) {
+ $wrapper = $parent->raw('')->attr(['class' => 'nav-submenu-wrapper']);
+ $wrapper->raw($submenu->getTitle())->attr(['class' => 'nav-submenu-title']);
+ foreach ($submenu->getChildren() as $subitem) {
+ $wrapper->add($subitem->getTitle(), $subitem->getHref());
+ }
+ }
+ } else {
// // Some submenus have a title element
// if (isset($submenu_data['title'])) {
// $wrapper->raw($submenu_data['title'])->attr(['class' => 'nav-submenu-title']);
// }
-
- foreach ($child->getChildren() as $subitem) {
- $wrapper->add($subitem->getTitle(), $subitem->getHref());
+ $wrapper = $parent->raw('')->attr(['class' => 'nav-submenu-wrapper']);
+ foreach ($child->getChildren() as $subitem) {
+ $wrapper->add($subitem->getTitle(), $subitem->getHref());
+ }
}
}
}