/** * Get command object * * @param array $data command params * @param \Magento\Framework\Logger $logger * @return \Magento\Backend\Model\Menu\Builder\AbstractCommand */ protected function _getCommand($data, $logger) { $command = $this->_commandFactory->create($data['type'], array('data' => $data)); if (isset($this->_messagePatterns[$data['type']])) { $logger->logDebug(sprintf($this->_messagePatterns[$data['type']], $command->getId()), \Magento\Backend\Model\Menu::LOGGER_KEY); } return $command; }
/** * Remove menu item by id * * @param string $itemId * @return bool */ public function remove($itemId) { $result = false; foreach ($this as $key => $item) { /** @var $item \Magento\Backend\Model\Menu\Item */ if ($item->getId() == $itemId) { unset($this[$key]); $result = true; $this->_logger->logDebug(sprintf('Remove on item with id %s was processed', $item->getId()), self::LOGGER_KEY); break; } if ($item->hasChildren() && ($result = $item->getChildren()->remove($itemId))) { break; } } return $result; }