namespace Cubist\Backpack\app\Magic\Menu;
use Cubist\Backpack\app\Magic\Models\CMSPage;
+use Illuminate\Support\Str;
class Item
{
*/
protected $_type = '';
+
+ /**
+ * @var array
+ */
+ protected $_controller = [];
+
+
/**
* @param string $id
*/
*/
public function getHref()
{
- return $this->_href;
+ $href = $this->_href;
+ if (!$href) {
+ return Str::slug($this->getTitle());
+ }
+ return $href;
}
/**
$this->_classes = $classes;
}
+ /**
+ * @return array
+ */
+ public function getController(): array
+ {
+ return $this->_controller;
+ }
+
+ /**
+ * @param array $controller
+ */
+ public function setController(array $controller): void
+ {
+ $this->_controller = $controller;
+ }
+
/**
* @param $menu Menu
*/
}
}
} else {
-
-// // Some submenus have a title element
-// if (isset($submenu_data['title'])) {
-// $wrapper->raw($submenu_data['title'])->attr(['class' => 'nav-submenu-title']);
-// }
$wrapper = $parent->raw('')->attr(['class' => 'nav-submenu-wrapper']);
foreach ($child->getChildren() as $subitem) {
$wrapper->add($subitem->getTitle(), $subitem->getHref());