예제 #1
0
파일: Menu.php 프로젝트: nemphys/magento2
 /**
  * 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->log(sprintf('Remove on item with id %s was processed', $item->getId()));
             break;
         }
         if ($item->hasChildren() && ($result = $item->getChildren()->remove($itemId))) {
             break;
         }
     }
     return $result;
 }
예제 #2
0
파일: Dom.php 프로젝트: nemphys/magento2
 /**
  * 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->getModelInstance('Mage_Backend_Model_Menu_Builder_Command_Update', $data);
             $this->_logger->log(sprintf('Update on item with id %s was processed', $command->getId()));
             break;
         case 'remove':
             $command = $this->_factory->getModelInstance('Mage_Backend_Model_Menu_Builder_Command_Remove', $data);
             $this->_logger->log(sprintf('Remove on item with id %s was processed', $command->getId()));
             break;
         default:
             $command = $this->_factory->getModelInstance('Mage_Backend_Model_Menu_Builder_Command_Add', $data);
             break;
     }
     return $command;
 }