當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ModuleListInterface::getModules方法代碼示例

本文整理匯總了PHP中Magento\Framework\Module\ModuleListInterface::getModules方法的典型用法代碼示例。如果您正苦於以下問題:PHP ModuleListInterface::getModules方法的具體用法?PHP ModuleListInterface::getModules怎麽用?PHP ModuleListInterface::getModules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\Module\ModuleListInterface的用法示例。


在下文中一共展示了ModuleListInterface::getModules方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: determineOmittedNamespace

 /**
  * Determine whether provided name begins from any available modules, according to namespaces priority
  * If matched, returns as the matched module "factory" name or a fully qualified module name
  *
  * @param string $name
  * @param bool $asFullModuleName
  * @return string
  */
 public function determineOmittedNamespace($name, $asFullModuleName = false)
 {
     if (null === $this->_moduleNamespaces) {
         $this->_moduleNamespaces = array();
         foreach ($this->_moduleList->getModules() as $module) {
             $moduleName = $module['name'];
             $module = strtolower($moduleName);
             $this->_moduleNamespaces[substr($module, 0, strpos($module, '_'))][$module] = $moduleName;
         }
     }
     $explodeString = strpos($name, \Magento\Framework\Autoload\IncludePath::NS_SEPARATOR) === false ? '_' : \Magento\Framework\Autoload\IncludePath::NS_SEPARATOR;
     $name = explode($explodeString, strtolower($name));
     $partsNum = count($name);
     $defaultNamespaceFlag = false;
     foreach ($this->_moduleNamespaces as $namespaceName => $namespace) {
         // assume the namespace is omitted (default namespace only, which comes first)
         if ($defaultNamespaceFlag === false) {
             $defaultNamespaceFlag = true;
             $defaultNS = $namespaceName . '_' . $name[0];
             if (isset($namespace[$defaultNS])) {
                 return $asFullModuleName ? $namespace[$defaultNS] : $name[0];
                 // return omitted as well
             }
         }
         // assume namespace is qualified
         if (isset($name[1])) {
             $fullNS = $name[0] . '_' . $name[1];
             if (2 <= $partsNum && isset($namespace[$fullNS])) {
                 return $asFullModuleName ? $namespace[$fullNS] : $fullNS;
             }
         }
     }
     return '';
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:42,代碼來源:NamespaceResolver.php

示例2: render

 /**
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $html = $this->_getHeaderHtml($element);
     $modules = array_keys($this->_moduleList->getModules());
     $dispatchResult = new \Magento\Framework\Object($modules);
     $this->_eventManager->dispatch('adminhtml_system_config_advanced_disableoutput_render_before', array('modules' => $dispatchResult));
     $modules = $dispatchResult->toArray();
     sort($modules);
     foreach ($modules as $moduleName) {
         if ($moduleName === 'Magento_Adminhtml' || $moduleName === 'Magento_Backend') {
             continue;
         }
         $html .= $this->_getFieldHtml($element, $moduleName);
     }
     $html .= $this->_getFooterHtml($element);
     return $html;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:21,代碼來源:DisableOutput.php

示例3: updateData

 /**
  * Apply database data updates whenever needed
  *
  * @return void
  */
 public function updateData()
 {
     foreach (array_keys($this->_moduleList->getModules()) as $moduleName) {
         foreach ($this->_resourceResolver->getResourceList($moduleName) as $resourceName) {
             if (!$this->_moduleManager->isDbDataUpToDate($moduleName, $resourceName)) {
                 $this->_setupFactory->create($resourceName, $moduleName)->applyDataUpdates();
             }
         }
     }
 }
開發者ID:pavelnovitsky,項目名稱:magento2,代碼行數:15,代碼來源:Updater.php

示例4: isDbUpToDate

 /**
  * Check if DB is up to date
  *
  * @return bool
  */
 private function isDbUpToDate()
 {
     foreach (array_keys($this->moduleList->getModules()) as $moduleName) {
         foreach ($this->resourceResolver->getResourceList($moduleName) as $resourceName) {
             $isSchemaUpToDate = $this->moduleManager->isDbSchemaUpToDate($moduleName, $resourceName);
             $isDataUpToDate = $this->moduleManager->isDbDataUpToDate($moduleName, $resourceName);
             if (!$isSchemaUpToDate || !$isDataUpToDate) {
                 return false;
             }
         }
     }
     return true;
 }
開發者ID:pavelnovitsky,項目名稱:magento2,代碼行數:18,代碼來源:DbStatusValidator.php

示例5: checkExtensionsLoaded

 /**
  * Check all necessary extensions are loaded and available
  *
  * @return void
  * @throws \Exception
  */
 protected function checkExtensionsLoaded()
 {
     try {
         foreach ($this->moduleList->getModules() as $moduleData) {
             $this->dependencyManager->checkModuleDependencies($moduleData);
         }
     } catch (\Exception $exception) {
         $this->messageManager->addError($exception->getMessage());
         throw new \Exception($exception->getMessage());
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:17,代碼來源:Installer.php


注:本文中的Magento\Framework\Module\ModuleListInterface::getModules方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。