|
|
@@ -67,6 +67,7 @@ class MenuItem {
|
|
|
$this->link = $link;
|
|
|
return $this;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* Set the menu item name.
|
|
|
*
|
|
|
@@ -77,6 +78,7 @@ class MenuItem {
|
|
|
$this->name = $name;
|
|
|
return $this;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* Set the menu item title.
|
|
|
*
|
|
|
@@ -119,7 +121,7 @@ class MenuItem {
|
|
|
$this->nested = $menu;
|
|
|
return $this;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* Nest another menu.
|
|
|
*
|
|
|
@@ -128,7 +130,7 @@ class MenuItem {
|
|
|
*/
|
|
|
public function nested() {
|
|
|
return $this->nested;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Render the menu item.
|
|
|
@@ -136,7 +138,12 @@ class MenuItem {
|
|
|
* @return string
|
|
|
*/
|
|
|
public function render() {
|
|
|
- return '<li>' . $this->html->link($this->link, $this->title, $this->icon, $this->attributes) . $this->renderNestedMenu() . '</li>';
|
|
|
+ if( empty($this->nested) ){
|
|
|
+ return '<li>' . $this->html->link($this->link, $this->title, $this->icon, $this->attributes) . '</li>';
|
|
|
+ }
|
|
|
+ if ( !empty($this->nested->items()) ) {
|
|
|
+ return '<li>' . $this->html->link($this->link, $this->title, $this->icon, $this->attributes) . $this->renderNestedMenu() . '</li>';
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|