Get submodules configs for module from modules manager
addition to static submodules configs defined in module's $config['modules'].
@param \yii\base\Module $module
@return array of submodules configs
187194
public function getSubmodules($module)
    {
        $submodsConfig = static::submodsConfig();
        $result = [];
        foreach ($submodsConfig as $submodUniqueId => $config) {
            if (($pos = strrpos($submodUniqueId, '/')) !== false) {
                $parentUid = substr($submodUniqueId, 0, $pos);
                $moduleId = substr($submodUniqueId, $pos + 1);
            } else {
                $parentUid = ''; // Yii::$app
                $moduleId = $submodUniqueId;
            }
            if ($parentUid == $module->uniqueId) {
                $result[$moduleId] = $config;
            }
        }
        return $result;
    }
349480
public function loadModule($module)
    {
        $trgtModule = $module;
        if (is_array($module) && !empty($module)) {
            $trgtModule = $module[count($module)-1];
        }

        if (!in_array($trgtModule, $this->getActiveModules())) {
            $moduleLoadFile = $_SERVER['DOCUMENT_ROOT'] . '/../config/melis.module.load.php';
            if (file_exists($moduleLoadFile)) {
                $modules = include $_SERVER['DOCUMENT_ROOT'] . '/../config/melis.module.load.php';

                $moduleCount = count($modules);
                $insertAtIdx = $moduleCount - 1;
                array_splice($modules, $insertAtIdx, 0, $module);

                // create the module.load file
                $this->createModuleLoader('config/', $modules, [], []);
            }
        }

        return $this->isModuleLoaded($trgtModule);
    }
781978
public function setModules($modules)
	{
		foreach ($modules as $name => $module) {
		    $this->setModule($name, $module);
		}
		
		return $this;
	}
507737
public static function getModule($module) {
        $info = null;
        if (isset (self::$modules [ $module ])) {
            return self::$modules [ $module ];
        }

        return $info;
    }
1348398
protected function getSiteModules() : array
    {
        $modules    = [];
        $modulePath = $_SERVER['DOCUMENT_ROOT'] . '/../module/MelisSites';

        if (is_dir($modulePath)){
            foreach (scandir($modulePath) as $module) {
                // Skip directory pointers
                if ($module == '.' || $module == '..') continue;

                if (is_dir($modulePath . '/' . $module)) {
                    $modules[$module] = $this->getControllers($modulePath . '/' . $module . '/src/' . $module . '/Controller');
                }
            }
        }

        return $modules;
    }
57131
public function addModule($module)
    {
        if (!($module instanceof ModuleInterface)) {
            $module = new Module($module);
        }

        return ($this->modules[$module->getName()] = $module);
    }
1299716
protected function getModuleInfo(): array
    {
        if ($this->moduleInfo === null) {
            $this->moduleInfo = $this->package()->getExtra()['module'] ?? [];
        }

        return $this->moduleInfo;
    }
107396
private function getModuleProviders()
    {
        $defaultProviders = [
            'vegas-cmf'
        ];

        $appConfig = $this->di->get('config')->application;
        if (!isset($appConfig->vendorModuleProvider)) {
            $providerNames = [];
        } else if (is_string($appConfig->vendorModuleProvider)) {
            $providerNames = [$appConfig->vendorModuleProvider];
        } else {
            $providerNames = $appConfig->vendorModuleProvider->toArray();
        }

        return array_unique(array_merge($defaultProviders, $providerNames));
    }
890263
public function getModulesWithoutRelations(array $modules) : array
    {
        $result = [];
        foreach ($modules as $moduleName => $module) {
            if (isset($module['relations']) && is_array($module['relations']) && ! empty($module['relations'])) {
                continue;
            }
            $result[] = $moduleName;
        }

        return $result;
    }
1331859
public function getUnloadedModules(array $modules)
    {
        $unloaded = array();

        foreach ($modules as $module) {
            if (!$this->isLoaded($module)) {
                array_push($unloaded, $module);
            }
        }

        return $unloaded;
    }
559152
public function getModuleNames()
    {
        $data = [];
        foreach (Yii::$app->getFrontendModules() as $k => $f) {
            $data[] = ['value' => $k, 'label' => $k];
        }
        return $data;
    }
814842
def get_preferred_submodules():
    
    # Path to the modules database
    modules_path = get_conf_path('db')

    # Modules database
    modules_db = PickleShareDB(modules_path)

    if 'submodules' in modules_db:
        return modules_db['submodules']

    submodules = []

    for m in PREFERRED_MODULES:
        submods = get_submodules(m)
        submodules += submods
    
    modules_db['submodules'] = submodules
    return submodules
852676
protected function getModuleCommands($module)
    {
        $prefix = $module instanceof Application ? '' : $module->getUniqueId() . '/';

        $commands = [];
        foreach (array_keys($module->controllerMap) as $id) {
            $commands[] = $prefix . $id;
        }

        foreach ($module->getModules() as $id => $child) {
            if (($child = $module->getModule($id)) === null) {
                continue;
            }
            foreach ($this->getModuleCommands($child) as $command) {
                $commands[] = $command;
            }
        }

        $controllerPath = $module->getControllerPath();
        if (is_dir($controllerPath)) {
            $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($controllerPath, \RecursiveDirectoryIterator::KEY_AS_PATHNAME));
            $iterator = new \RegexIterator($iterator, '/.*Controller\.php$/', \RecursiveRegexIterator::GET_MATCH);
            foreach ($iterator as $matches) {
                $file = $matches[0];
                $relativePath = str_replace($controllerPath, '', $file);
                $class = strtr($relativePath, [
                    '/' => '\\',
                    '.php' => '',
                ]);
                $controllerClass = $module->controllerNamespace . $class;
                if ($this->validateControllerClass($controllerClass)) {
                    $dir = ltrim(pathinfo($relativePath, PATHINFO_DIRNAME), '\\/');

                    $command = InflectorHelper::camel2id(substr(basename($file), 0, -14), '-', true);
                    if (!empty($dir)) {
                        $command = $dir . '/' . $command;
                    }
                    $commands[] = $prefix . $command;
                }
            }
        }

        return $commands;
    }
543761
def core__get_widgets_for_module module_name
      module_configs = core__get_module_configs(module_name)
      return [] unless module_configs
      # load module items
      module_widgets = []
      if module_configs[:widgets]
        module_configs[:widgets].each do |key, value|
          module_widgets.push(core__generate_widget(key, value, module_name))
        end
      end
      # return module items
      return module_widgets
    end
902485
protected function getModulesAutoloadConfigWithoutCache()
    {
        $result = [];
        foreach ($this->modules as $moduleName => $moduleConfig) {
            $className = $moduleConfig['className'];
            $module    = new $className;
            if (!$module instanceof AbstractModule) {
                $errMsg = sprintf('Class "%s" must be extended from %s', $className, AbstractModule::class);
                throw new Exception\RuntimeException($errMsg);
            }
            $autoloadConfig = $module->getAutoloaderConfig();
            if (!ArrayUtils::isHashTable($autoloadConfig)) {
                $errMsg = sprintf('The autoloader configuration for module "%s" is invalid', $moduleName);
                throw new Exception\RuntimeException($errMsg);
            }
            $result = ArrayUtils::merge($result, $autoloadConfig);
        }
        
        foreach ($result as $moduleName => $configAutoload) {
            foreach ($configAutoload as $key => $value) {
                $result[$moduleName][$key] = realpath($value);
            }
        }
        
        return $result;
    }
141679
public function getAppRoutes(string $module = null): array
    {
        if ($module === null) {
            $module = Yii::$app;
        } else {
            $module = Yii::$app->getModule($module);
        }

        $key = [__METHOD__, $module->getUniqueId()];
        $result = (($this->cache !== null) ? $this->cache->get($key) : false);

        if ($result === false) {
            $result = [];
            $this->getRouteRecursive($module, $result);
            if ($this->cache !== null) {
                $this->cache->set($key, $result, $this->cacheDuration, new TagDependency([
                    'tags' => self::CACHE_TAG,
                ]));
            }
        }

        return $result;
    }
328863
public function getModuleIds()
    {
        $aModuleIdsFromExtensions = $this->_getModuleIdsFromExtensions($this->getModulesWithExtendedClass());
        $aModuleIdsFromFiles = array_keys($this->getModuleConfigParametersByKey(static::MODULE_KEY_FILES));

        return array_unique(array_merge($aModuleIdsFromExtensions, $aModuleIdsFromFiles));
    }