Esempio n. 1
0
 /**
  * Count All Subnavigation Items
  *
  * @param \Magento\Backend\Model\Menu $items
  * @return int
  */
 protected function _countItems($items)
 {
     $total = $items->count();
     foreach ($items as $item) {
         /** @var $item \Magento\Backend\Model\Menu\Item */
         if ($item->hasChildren()) {
             $total += $this->_countItems($item->getChildren());
         }
     }
     return $total;
 }
Esempio n. 2
0
 /**
  * Check whether item has subnodes
  *
  * @return bool
  */
 public function hasChildren()
 {
     return !is_null($this->_submenu) && (bool) $this->_submenu->count();
 }