本文整理汇总了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 '';
}
示例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;
}
示例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();
}
}
}
}
示例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;
}
示例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());
}
}