Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Director.php
Go to the documentation of this file.
1 <?php
8 
13 class Director extends \Magento\Backend\Model\Menu\AbstractDirector
14 {
20  protected $_messagePatterns = ['update' => 'Item %s was updated', 'remove' => 'Item %s was removed'];
21 
29  protected function _getCommand($data, $logger)
30  {
31  $command = $this->_commandFactory->create($data['type'], ['data' => $data]);
32  if (isset($this->_messagePatterns[$data['type']])) {
33  $logger->info(
34  sprintf($this->_messagePatterns[$data['type']], $command->getId())
35  );
36  }
37  return $command;
38  }
39 
48  public function direct(
49  array $config,
50  \Magento\Backend\Model\Menu\Builder $builder,
51  \Psr\Log\LoggerInterface $logger
52  ) {
53  foreach ($config as $data) {
54  $builder->processCommand($this->_getCommand($data, $logger));
55  }
56  }
57 }
$config
Definition: fraud_order.php:17
$logger
direct(array $config, \Magento\Backend\Model\Menu\Builder $builder, \Psr\Log\LoggerInterface $logger)
Definition: Director.php:48