Module Logic

@return void
775397
public function execute()
    {

        $this->htmlattrs = array('class' => 'no-js'.$this->ieClass(' ').$this->browserClass(' '));
        $this->headattrs = array();

        if ($this->called == 'xhtml') {
            $this->xhtml();
        } else {
            $this->html5();
        }

    }
1157895
public static function initSubmodules($module)
    {
        $submodules = ArrayHelper::merge($module->modules, static::submodules($module));
        foreach ($submodules as $submoduleId => $submodule) {
            if (is_array($submodule)) $submodule = $module->getModule($submoduleId);
            if (empty($submodule)) continue;
            static::initSubmodules($submodule);
        }
    }
1276524
protected function configure(): void
    {
        parent::configure();
        foreach ($this->aArguments as $aArgument) {
            $this->addArgument(
                getFromArray('name', $aArgument),
                getFromArray('mode', $aArgument, InputArgument::OPTIONAL),
                getFromArray('description', $aArgument),
                getFromArray('default', $aArgument)
            );
        }
    }
168501
public function boot()
    {
        if ($this->booted) {
            return;
        }

        if (!$this->name) {
            throw new \LogicException('Package: ' . get_class($this) . ' name property should not be empty.');
        }

        $this->getConfig();

        $this->registerProviders($this->getContainer());

        $this->registerListeners($this->getDispatcher());

        $this->registerMiddlewares();

        $this->booted = true;
    }
1083983
public static function setCurrentModule(string $module): void
    {
        if (static::$currentModule !== null) {
            $currentModule = static::$currentModule;
            throw new ApplicationException("Current module was already set to {$currentModule}; once current module is set, you can't change it");
        }

        static::$currentModule = $module;

        // register current module & run init.php if present
        static::registerModule($module);
    }
1364854
public function installModules()
    {
        foreach ($this->getRequiredModules() as $module_id) {
            if ($this->getModuleModel()->install($module_id) !== true) {
                $error = $this->translation->text('Failed to install module @module_id', array('@module_id' => $module_id));
                throw new RuntimeException($error);
            }
        }

        return true;
    }
67743
public function validateModuleID()
    {
        if (!empty($this->moduleID)) {
            $module = Yii::$app->getModule($this->moduleID);
            if ($module === null) {
                $this->addError('moduleID', "Module '{$this->moduleID}' does not exist.");
            }
        }
    }
919490
public function setModule($module) {
        if (!is_string($module) || empty($module)) {
            $errMessage = "The module value must be a string and not be empty";
            throw new \InvalidArgumentException($errMessage, GeneralErrors::VALUE_IS_NOT_OF_EXPECTED_TYPE);
        }

        $this->module = $module;
    }
666050
protected function loadErrorModule() : void
    {
        $fqn = $this->getFullyQualifiedClass('index', 'index');
        $the_module = new $fqn();
        $action = $this->getActionMethodName((string)$this->response->getStatusCode());
        if (method_exists($fqn, $action)) {
            call_user_func_array(array($the_module, $action), [$this->response->getVariables()]);
        } else {
            // There is no error handler for this error, show the index but don't pass variables
            call_user_func_array(array($the_module, $this->getActionMethodName('index')), []);
        }
    }
90418
public function activateConfig()
    {
        $modules = $this->getModules();
        // Work in reverse priority, so the higher priority modules get later execution
        /** @var Module $module */
        foreach (array_reverse($modules) as $module) {
            $module->activate();
        }
    }
72168
public function generate()
    {
        $name = $this->getName();

        if ($this->module->has($name)) {
            if ($this->force) {
                $this->module->delete($name);
            } else {
                $this->console->error("Module [{$name}] already exist!");

                return;
            }
        }

        $this->generateFolders();

        $this->generateFiles();

        if (!$this->plain) {
            $this->generateResources();
        }

        $this->console->info("Module [{$name}] created successfully.");
    }
1115006
protected function actionListModule()
    {
        $this->controlToken('action');

        $action = $this->getQuery('action');
        $module_id = $this->getQuery('module_id');

        if (!empty($action) && !empty($module_id)) {
            $this->setModule($module_id);
            $result = $this->startActionModule($action);
            $this->finishActionModule($result);
        }
    }
400533
public function init()
    {
        foreach (self::$registered as $path => $module) {
            $path = trailingslashit($path);
            $source = $path . $module . '.php';
            $namespace = \Modularity\Helper\File::getNamespace($source);

            if (!$namespace) {
                continue;
            }

            require_once $source;
            $class = $namespace . '\\' . $module;
            $class = new $class();

            $this->register($class, $path);
        }

        do_action('Modularity/Init', $this);
    }
944865
protected function setModule($module_id)
    {
        $this->data_module = $this->module->get($module_id);

        if (empty($this->data_module)) {
            $this->outputHttpStatus(403);
        }
    }
1004398
public function cmdInstallModule()
    {
        $result = $this->module_model->install($this->getParam(0));

        if ($result !== true) {
            $this->errorAndExit($result);
        }

        $this->output();
    }
916894
public static function init()
    {
        foreach (self::$_modulePaths as $path) {
            $folder = new Folder($path);
            $modulePaths = $folder->read(true, false, true)[0];

            foreach ($modulePaths as $modulePath) {
                self::_initializeModule($modulePath);
            }
        }

        self::$_initialized = true;
    }
1180700
private function setByTypeRelation(string $module, array $fields) : void
    {
        $moduleField = $this->getModuleRelatedField($fields);

        if (is_null($moduleField)) {
            return;
        }

        $selfrelated = $this->getSelfRelated($fields);
        if (!empty($selfrelated)) {
            $this->setByTypeSelfRelationField($module, $selfrelated);

            return;
        }

        foreach ($fields as $field) {
            $this->setByTypeRelationField($module, $field, $moduleField);
        }
    }