/** * Remove menu item by id * * @param string $itemId * @return bool */ public function remove($itemId) { $result = false; foreach ($this as $key => $item) { /** @var $item Mage_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; }
/** * Get command object * @param array $data command params * @return Mage_Backend_Model_Menu_Builder_CommandAbstract */ protected function _getCommand($data) { switch ($data['type']) { case 'update': $command = $this->_factory->create('Mage_Backend_Model_Menu_Builder_Command_Update', array('data' => $data)); $this->_logger->logDebug(sprintf('Update on item with id %s was processed', $command->getId()), Mage_Backend_Model_Menu::LOGGER_KEY); break; case 'remove': $command = $this->_factory->create('Mage_Backend_Model_Menu_Builder_Command_Remove', array('data' => $data)); $this->_logger->logDebug(sprintf('Remove on item with id %s was processed', $command->getId()), Mage_Backend_Model_Menu::LOGGER_KEY); break; default: $command = $this->_factory->create('Mage_Backend_Model_Menu_Builder_Command_Add', array('data' => $data)); break; } return $command; }