示例#1
0
 /**
  * Initialize menu object
  *
  * @return void
  */
 protected function _initMenu()
 {
     if (!$this->_menu) {
         $this->_menu = $this->_menuFactory->create();
         $cache = $this->_configCacheType->load(self::CACHE_MENU_OBJECT);
         if ($cache) {
             $this->_menu->unserialize($cache);
             return;
         }
         $this->_director->direct($this->_configReader->read($this->_appState->getAreaCode()), $this->_menuBuilder, $this->_logger);
         $this->_menu = $this->_menuBuilder->getResult($this->_menu);
         $this->_configCacheType->save($this->_menu->serialize(), self::CACHE_MENU_OBJECT);
     }
 }
示例#2
0
文件: Item.php 项目: aiesh/magento2
 /**
  * @return void
  */
 public function __wakeup()
 {
     $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
     $this->_moduleManager = $objectManager->get('Magento\\Framework\\Module\\Manager');
     $this->_validator = $objectManager->get('Magento\\Backend\\Model\\Menu\\Item\\Validator');
     $this->_acl = $objectManager->get('Magento\\Framework\\AuthorizationInterface');
     $this->_scopeConfig = $objectManager->get('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->_menuFactory = $objectManager->get('Magento\\Backend\\Model\\MenuFactory');
     $this->_urlModel = $objectManager->get('Magento\\Backend\\Model\\UrlInterface');
     $this->_moduleList = $objectManager->get('Magento\\Framework\\Module\\ModuleListInterface');
     if ($this->_serializedSubmenu) {
         $this->_submenu = $this->_menuFactory->create();
         $this->_submenu->unserialize($this->_serializedSubmenu);
     }
 }