示例#1
0
 /**
  * Process provided command object
  *
  * @param \Magento\Backend\Model\Menu\Builder\AbstractCommand $command
  * @return $this
  */
 public function processCommand(\Magento\Backend\Model\Menu\Builder\AbstractCommand $command)
 {
     if (!isset($this->_commands[$command->getId()])) {
         $this->_commands[$command->getId()] = $command;
     } else {
         $this->_commands[$command->getId()]->chain($command);
     }
     return $this;
 }
示例#2
0
文件: Add.php 项目: aiesh/magento2
 /**
  * Add command as last in the list of callbacks
  *
  * @param \Magento\Backend\Model\Menu\Builder\AbstractCommand $command
  * @return $this
  * @throws \InvalidArgumentException
  */
 public function chain(\Magento\Backend\Model\Menu\Builder\AbstractCommand $command)
 {
     if ($command instanceof \Magento\Backend\Model\Menu\Builder\Command\Add) {
         throw new \InvalidArgumentException("Two 'add' commands cannot have equal id (" . $command->getId() . ")");
     }
     return parent::chain($command);
 }