Пример #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 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);
 }