@param ModuleSetting $moduleSetting
@param string        $moduleId
@param int           $shopId

@throws WrongModuleSettingException
185090
public function handleOnModuleActivation(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canHandle($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        foreach ($moduleSetting->getValue() as $shopModuleSettingData) {
            $shopModuleSetting = new ShopModuleSetting();
            $shopModuleSetting
                ->setShopId($shopId)
                ->setModuleId($moduleId);

            $shopModuleSetting = $this->mapDataToShopModuleSetting($shopModuleSetting, $shopModuleSettingData);

            $this->shopModuleSettingDao->save($shopModuleSetting);
        }
    }
1026394
public static PmiModuleConfig getConfig(String moduleID) {
        if (moduleID == null)
            return null;

        PmiModuleConfig config = (PmiModuleConfig) moduleConfigs.get(moduleID);

        if (config == null) {
            // beanModule and com.ibm.websphere.pmi.xml.beanModule will work
            // if moduleID doesn't have a '.' then use pre-defined modulePrefix
            int hasDot = moduleID.indexOf('.');
            if (hasDot == -1) {
                // not found in moduleConfigs; try as a pre-defined module
                // prepend com.ibm.websphere.pmi.xml. to moduleID
                String preDefinedMod = DEFAULT_MODULE_PREFIX + moduleID;
                config = getConfigFromXMLFile(getXmlFileName(preDefinedMod), true, false);
            }
        }

        if (config == null) {
            // input moduleID has '.' in it. use as it is            
            // do validation since its NOT pre-defined module
            config = getConfigFromXMLFile(getXmlFileName(moduleID), true, true);
        }

        return config;
    }
1032823
protected function _addModuleExtensions($moduleExtensions, $moduleId)
    {
        $extensions = (array) $this->getConfig()->getConfigParam('aModuleExtensions');
        $old = isset($extensions[$moduleId]) ? $extensions[$moduleId] : null;
        $old = (array) $old;
        $new = $moduleExtensions === null ? [] : array_values($moduleExtensions);
        if (is_array($moduleExtensions)) {
            $diff = $this->diff($old, $new);
            if ($diff) {
                $extensions[$moduleId] = array_values($moduleExtensions);
                $this->output->writeLn("$moduleId fixing module extensions:" . $old === null ? ' everything ' : var_export($diff, true));
                $this->_saveToConfig('aModuleExtensions', $extensions);
                $this->needCacheClear = true;
            }
        } else {
            $this->output->writeLn("$moduleId unregister module extensions");
            $this->needCacheClear = true;
            $this->_saveToConfig('aModuleExtensions', []);
        }
    }
759488
protected function _getShop($langId = null, $shopId = null)
    {
        if ($langId === null && $shopId === null) {
            if (isset($this->_oShop)) {
                return $this->_oShop;
            } else {
                return $this->_oShop = Registry::getConfig()->getActiveShop();
            }
        }

        $myConfig = Registry::getConfig();

        $shop = oxNew(\OxidEsales\Eshop\Application\Model\Shop::class);
        if ($shopId !== null) {
            $shop->setShopId($shopId);
        }
        if ($langId !== null) {
            $shop->setLanguage($langId);
        }
        $shop->load($myConfig->getShopId());

        return $shop;
    }
156243
protected function _addModuleExtensions($moduleExtensions, $moduleId)
    {
        $extensions = (array) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aModuleExtensions');
        if (is_array($extensions)) {
            $extensions[$moduleId] = array_values($moduleExtensions);
        }

        $this->_saveToConfig('aModuleExtensions', $extensions);
    }
754413
protected function removeNotUsedSettings($moduleSettings, $moduleId)
    {
        $moduleConfigs = array_keys($this->getModuleConfigs($moduleId));
        $moduleSettings = $this->parseModuleSettings($moduleSettings);

        $configsToRemove = array_diff($moduleConfigs, $moduleSettings);
        if (!empty($configsToRemove)) {
            $this->removeModuleConfigs($moduleId, $configsToRemove);
        }
    }
872664
protected function processModule($moduleId, array $moduleData)
    {
        $this->resetTemporaryModelCache();

        // fill cache with current module's data
        $this->moduleId = $moduleId;
        $this->module   = $moduleData;

        // set default model data
        $this->model = [
            'module'                => $moduleId,
            'name'                  => $this->normalizeModelName($this->module['name']),
            'table'                 => null,
            'cached'                => config('pxlcms.generator.models.enable_rememberable_cache'),
            'is_translated'         => false,
            'is_translation'        => false,
            'is_listified'          => false,
            'ordered_by'            => [],
            'timestamps'            => null,
            // attributes
            'normal_fillable'       => [],
            'translated_fillable'   => [],
            'hidden'                => [],
            'casts'                 => [],
            'dates'                 => [],
            'defaults'              => [],
            'normal_attributes'     => [],
            'translated_attributes' => [],
            // categories
            'has_categories'        => (bool) array_get($this->module, 'client_cat_control'),
            // relationships
            'relations_config'      => [],
            'relationships'         => [
                'normal'   => [],
                'reverse'  => [],
                'image'    => [],
                'file'     => [],
                'checkbox' => [],
            ],
            // special
            'sluggable'       => false,
            'sluggable_setup' => [],
            'scope_active'    => null,   // config determines
            'scope_position'  => null,   // config determines
        ];

        // process manual/automatic sorting of entries
        $this->processModuleSorting();

        // set overrides in model data
        $this->prepareModelOverrides();

        // add module fields as attribute data
        $this->processModuleFields();

        // override relationship data found while processing fields
        $this->applyOverridesForRelationships();

        // make sure we do not use a reserved class name
        $this->checkForReservedClassName($this->model['name']);

        // save completely built up model to context
        $this->context->output['models'][ $moduleId ] = $this->model;
    }
499492
function Module(moduleId, ctx, combineConfig) {
    this.moduleId = moduleId;
    this.compiler = ctx;
    this.combineConfig = combineConfig || ctx.getCombineConfig(moduleId);
    this.definition = null;
    this.prepare();
}
1329217
public function validate(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canValidate($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        $events = $moduleSetting->getValue();
        foreach ($this->validEvents as $validEventName) {
            if (is_array($events) && array_key_exists($validEventName, $events)) {
                $this->checkIfMethodIsCallable($events[$validEventName]);
            }
        }
    }
1285938
function modTryInvokeFactory(id) {
        var mod = modModules[id];

        if (mod && mod.invokeFactory) {
            mod.invokeFactory();
        }
    }
1209455
public function getModuleFullPath(string $moduleId) : string
    {
        $modulePaths = Registry::getConfig()->getConfigParam('aModulePaths');

        /**
         * @TODO We have to throw an exception here in the future, module path should exist.
         *       Use module id for the BC.
         */
        $moduleRelativePath = $modulePaths[$moduleId] ?? $moduleId;

        return Registry::getConfig()->getModulesDir() . $moduleRelativePath;
    }
455110
public static PmiModuleConfig findConfig(PmiModuleConfig[] configs, String moduleID) {
        if (moduleID == null)
            return null;

        for (int i = 0; i < configs.length; i++) {
            if (configs[i].getUID().equals(moduleID)) // VELA
                //configs[i].getShortName().equals(moduleID))
                return configs[i];
        }
        return null;
    }
791959
public function setActive(string $moduleId, int $shopId)
    {
        if ($this->isActive($moduleId, $shopId)) {
            throw new ModuleStateIsAlreadySetException(
                'Active status for module "' . $moduleId . '" and shop with id "' . $shopId . '" is already set.'
            );
        }

        $activeModuleIdsSetting = $this->getActiveModulesShopConfigurationSetting($shopId);

        $activeModuleIds = $activeModuleIdsSetting->getValue();
        $activeModuleIds[] = $moduleId;
        $activeModuleIdsSetting->setValue($activeModuleIds);

        $this->shopConfigurationSettingDao->save($activeModuleIdsSetting);
    }
407535
public void addModuleToExport(final String moduleName) {

        if (m_modulesToExport == null) {
            m_modulesToExport = new HashSet<String>();
        }
        m_modulesToExport.add(moduleName);
    }
175893
public function addSetting(ModuleSetting $moduleSetting): ModuleConfiguration
    {
        $this->settings[$moduleSetting->getName()] = $moduleSetting;

        return $this;
    }
15535
public function getShopConfVar($varName, $shopId = null, $module = '')
    {
        if (!$shopId) {
            $shopId = $this->getShopId();
        }

        if ($shopId == $this->getShopId() && (!$module || $module == Config::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme'))) {
            $varValue = $this->getConfigParam($varName);
            if ($varValue !== null) {
                return $varValue;
            }
        }

        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);

        $query = "select oxvartype, " . $this->getDecodeValueQuery() . " as oxvarvalue from oxconfig where oxshopid = '{$shopId}' and oxmodule = '{$module}' and oxvarname = " . $db->quote($varName);
        $rs = $db->select($query);

        if ($rs != false && $rs->count() > 0) {
            return $this->decodeValue($rs->fields['oxvartype'], $rs->fields['oxvarvalue']);
        }
    }
1003971
private function getSettingsData(ModuleConfiguration $moduleConfiguration): array
    {
        $data = [];

        foreach ($moduleConfiguration->getSettings() as $setting) {
            $data[$setting->getName()] = $setting->getValue();
        }

        return $data;
    }