当前位置: 首页>>代码示例>>PHP>>正文


PHP ModuleListInterface::getNames方法代码示例

本文整理汇总了PHP中Magento\Framework\Module\ModuleListInterface::getNames方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleListInterface::getNames方法的具体用法?PHP ModuleListInterface::getNames怎么用?PHP ModuleListInterface::getNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Module\ModuleListInterface的用法示例。


在下文中一共展示了ModuleListInterface::getNames方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDisabledModules

 /**
  * Retrieve all disabled modules from the configuration
  *
  * @return array
  */
 protected function getDisabledModules()
 {
     $allModules = $this->fullModuleList->getNames();
     $enabledModules = $this->moduleList->getNames();
     $disabledModules = array_diff($allModules, $enabledModules);
     return $disabledModules;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:Collect.php

示例2: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('<info>List of active modules:<info>');
     foreach ($this->moduleList->getNames() as $moduleName) {
         $output->writeln('<info>' . $moduleName . '<info>');
     }
 }
开发者ID:jeremyBass,项目名称:wsumage_command,代码行数:10,代码来源:CheckActiveModulesCommand.php

示例3: 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
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function determineOmittedNamespace($name, $asFullModuleName = false)
 {
     if (null === $this->_moduleNamespaces) {
         $this->_moduleNamespaces = [];
         foreach ($this->_moduleList->getNames() as $moduleName) {
             $module = strtolower($moduleName);
             $this->_moduleNamespaces[substr($module, 0, strpos($module, '_'))][$module] = $moduleName;
         }
     }
     $explodeString = strpos($name, '\\') === false ? '_' : '\\';
     $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:shabbirvividads,项目名称:magento2,代码行数:43,代码来源:NamespaceResolver.php

示例4: execute

 public function execute()
 {
     $greeting = "Hello world! I am a Magento2 extension.<br/>\n";
     $title = 'Hello World';
     $moduleNames = implode("<br/>\n", $this->moduleList->getNames());
     $body = "\n<html>\n    <head>\n        <title>{$title}</title>\n    </head>\n    <body>{$greeting}<br/>Modules Installed:<br/>{$moduleNames}</body>\n</html>";
     $this->_response->setBody($body);
 }
开发者ID:Robin-bms,项目名称:m2extension,代码行数:8,代码来源:SayHello.php

示例5: prepareModuleNamespaces

 /**
  * Prepare module namespaces
  *
  * @return void
  */
 protected function prepareModuleNamespaces()
 {
     if (null === $this->moduleNamespaces) {
         $this->moduleNamespaces = [];
         foreach ($this->moduleList->getNames() as $moduleName) {
             $module = strtolower($moduleName);
             $this->moduleNamespaces[substr($module, 0, strpos($module, '_'))][$module] = $moduleName;
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:NamespaceResolver.php

示例6: toOptionArray

 /**
  * Options getter
  *
  * @return array
  */
 public function toOptionArray()
 {
     $output = [];
     $modules = $this->_moduleList->getNames();
     sort($modules);
     foreach ($modules as $k => $v) {
         if (preg_match("/Ves/", $v)) {
             $output[$k] = ['value' => $v, 'label' => $v];
         }
     }
     return $output;
 }
开发者ID:rustamveer,项目名称:magento2,代码行数:17,代码来源:VesModules.php

示例7: getModuleName

 /**
  * Retrieve fully-qualified module name, path belongs to
  *
  * @param string $path Full path to file or directory
  * @return string|null
  */
 public function getModuleName($path)
 {
     $path = str_replace('\\', '/', $path);
     foreach ($this->_moduleList->getNames() as $moduleName) {
         $moduleDir = $this->_moduleDirs->getDir($moduleName);
         $moduleDir = str_replace('\\', '/', $moduleDir);
         if ($path == $moduleDir || strpos($path, $moduleDir . '/') === 0) {
             return $moduleName;
         }
     }
     return null;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:ReverseResolver.php

示例8: getDbVersionErrors

 /**
  * Get array of errors if DB is out of date, return [] if DB is current
  *
  * @return string[] Array of errors, each error contains module name, current version, required version,
  *                  and type (schema or data).  The array will be empty if all schema and data are current.
  */
 public function getDbVersionErrors()
 {
     $errors = [];
     foreach ($this->moduleList->getNames() as $moduleName) {
         if (!$this->isSchemaUpToDate($moduleName)) {
             $errors[] = $this->getSchemaInfo($moduleName);
         }
         if (!$this->isDataUpToDate($moduleName)) {
             $errors[] = $this->getDataInfo($moduleName);
         }
     }
     return $errors;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:DbVersionInfo.php

示例9: getObservers

 /**
  * @return array
  */
 public function getObservers()
 {
     if (!is_null($this->observers)) {
         return $this->observers;
     }
     $this->observers = [];
     foreach ($this->moduleList->getNames() as $module) {
         $parts = explode('_', $module);
         $class = 'Magento\\Tools\\SampleData\\Module\\' . $parts[1] . '\\Observer';
         if (class_exists($class)) {
             $this->observers[] = $this->objectManager->get($class);
         }
     }
     return $this->observers;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:ObserverManager.php

示例10: addHeadInclude

 /**
  * Add Link to Head
  *
  * @return void
  */
 protected function addHeadInclude()
 {
     $styleContent = '';
     foreach ($this->moduleList->getNames() as $moduleName) {
         $fileName = substr($moduleName, strpos($moduleName, "_") + 1) . '/styles.css';
         $fileName = $this->fixtureHelper->getPath($fileName);
         if (!$fileName) {
             continue;
         }
         $style = file_get_contents($fileName);
         $styleContent .= preg_replace('/^\\/\\*[\\s\\S]+\\*\\//', '', $style);
     }
     if (empty($styleContent)) {
         return;
     }
     $mediaDir = $this->directoryList->getPath(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
     file_put_contents("{$mediaDir}/styles.css", $styleContent);
     $linkTemplate = '<link  rel="stylesheet" type="text/css"  media="all" href="%sstyles.css" />';
     $baseUrl = $this->baseUrl->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_MEDIA]);
     $linkText = sprintf($linkTemplate, $baseUrl);
     $miscScriptsNode = 'design/head/includes';
     $miscScripts = $this->scopeConfig->getValue($miscScriptsNode);
     if (!$miscScripts || strpos($miscScripts, $linkText) === false) {
         $this->configWriter->save($miscScriptsNode, $miscScripts . $linkText);
         $this->configCacheType->clean();
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:32,代码来源:Setup.php

示例11: run

 /**
  * Run installation in context of the specified admin user
  *
  * @param $userName
  * @param array $modules
  * @return void
  * @throws \Exception
  */
 public function run($userName, array $modules = [])
 {
     set_time_limit(0);
     /** @var \Magento\User\Model\User $user */
     $user = $this->userFactory->create()->loadByUsername($userName);
     if (!$user->getId()) {
         throw new \Exception('Invalid admin user provided');
     }
     $this->state->start();
     $this->session->setUser($user);
     $this->deploy->run();
     $resources = $this->initResources($modules);
     $this->state->clearErrorFlag();
     try {
         foreach ($this->moduleList->getNames() as $moduleName) {
             if (isset($resources[$moduleName])) {
                 $resourceType = $resources[$moduleName];
                 $this->setupFactory->create($resourceType)->run();
                 $this->postInstaller->addModule($moduleName);
             }
         }
         $this->session->unsUser();
         $this->postInstaller->run();
         $this->state->finish();
     } catch (\Exception $e) {
         $this->state->setError();
         $this->logger->log($e->getMessage());
     }
 }
开发者ID:vinai-drive-by-commits,项目名称:magento2-sample-data,代码行数:37,代码来源:Installer.php

示例12: run

 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->logger->log('Installing categories:');
     $this->isMediaInstalled();
     foreach ($this->moduleList->getNames() as $moduleName) {
         $fileName = substr($moduleName, strpos($moduleName, "_") + 1) . '/categories.csv';
         $fileName = $this->fixtureHelper->getPath($fileName);
         if (!$fileName) {
             continue;
         }
         $csvReader = $this->csvReaderFactory->create(['fileName' => $fileName, 'mode' => 'r']);
         foreach ($csvReader as $row) {
             $this->createCategory($row);
         }
     }
 }
开发者ID:vinai-drive-by-commits,项目名称:magento2-sample-data,代码行数:19,代码来源:Category.php

示例13: 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 = $this->_moduleList->getNames();
     $dispatchResult = new \Magento\Framework\Object($modules);
     $this->_eventManager->dispatch('adminhtml_system_config_advanced_disableoutput_render_before', ['modules' => $dispatchResult]);
     $modules = $dispatchResult->toArray();
     sort($modules);
     foreach ($modules as $moduleName) {
         if ($moduleName === 'Magento_Backend') {
             continue;
         }
         $html .= $this->_getFieldHtml($element, $moduleName);
     }
     $html .= $this->_getFooterHtml($element);
     return $html;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:21,代码来源:DisableOutput.php

示例14: run

 /**
  * Run installation in context of the specified admin user
  *
  * @param \Magento\User\Model\User $adminUser
  * @throws \Exception
  *
  * @return void
  */
 public function run(\Magento\User\Model\User $adminUser)
 {
     set_time_limit(3600);
     if (!$adminUser || !$adminUser->getId()) {
         throw new \Exception('Invalid admin user provided');
     }
     $this->session->setUser($adminUser);
     $this->deploy->run();
     $resources = $this->initResources();
     foreach ($this->moduleList->getNames() as $moduleName) {
         if (isset($resources[$moduleName])) {
             $resourceType = $resources[$moduleName];
             $this->setupFactory->create($resourceType)->run();
             $this->postInstaller->addModule($moduleName);
         }
     }
     $this->session->unsUser();
     $this->postInstaller->run();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:27,代码来源:Installer.php

示例15: 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 = $this->_moduleList->getNames();
     $wsaApproved = array('webshopapps', 'shipperhq');
     sort($modules);
     $viewAllExtns = $this->_scopeConfig->isSetFlag('shqlogmenu/shqlogger/view_all_extns', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
     foreach ($modules as $moduleName) {
         if ($moduleName === 'Mage_Adminhtml' || $moduleName === 'ShipperHQ_Common' || $moduleName === 'ShipperHQ_Logger' || stripos($moduleName, 'Mage_') !== false) {
             continue;
         }
         $providerArray = explode('_', $moduleName);
         $provider = strtolower($providerArray[0]);
         if (!$viewAllExtns && !in_array($provider, $wsaApproved)) {
             continue;
         }
         $html .= $this->_getFieldHtml($element, $moduleName);
     }
     $html .= $this->_getFooterHtml($element);
     return $html;
 }
开发者ID:shipperhq,项目名称:module-logger,代码行数:25,代码来源:DisableLogging.php


注:本文中的Magento\Framework\Module\ModuleListInterface::getNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。