getAuthIdentity() && $this->_hasNavigationBlock) { $this->_initNavigationBlock(); } return $this; } public function hasNavigationBlock($value) { $this->_hasNavigationBlock = (bool) $value; return $this; } protected function _initNavigationBlock() { $item = array( 'menu' => $this->_getUserNavigationList(), 'active' => $this->getOption('id'), 'tpl' => $this->getTemplate('navigation-block.tpl') ); $item['activeItems'] = []; $this->_getActiveIds($item['menu'], $item['activeItems']); $this->addItem($item, 'LEFT_ITEMS'); return $this; } protected function _getActiveIds(array $menu, array &$ids) { $currentId = $this->getOption('id'); foreach ($menu as $item) { if (!empty($item['sub'])) { if ($this->_getActiveIds($item['sub'], $ids)) { $ids[] = $item['id']; return true; } } if ($item['id'] == $currentId) { $ids[] = $currentId; return true; } } return false; } }