Получить форму редактирования параметров подключения модуля.

@param  string $module_name

@return AbstractNodePropertiesFormType
974003
public function getPropertiesFormType($module_name)
    {
        try {
            $form_class_name = '\\'.$this->kernel->getModule($module_name)['namespace'].'\Form\Type\NodePropertiesFormType';
            if (class_exists($form_class_name)) {
                //return new $form_class_name($this->em, $this->kernel);
                return $form_class_name;
            }
        } catch (\InvalidArgumentException $e) {
            // Случай, когда запрашивается не подключенный модуль.
        }

        // @todo может быть гибче настраивать форму параметров по умолчанию?.
        return new NodeDefaultPropertiesFormType();
    }
1128585
public function includeTemplate($name = null, $module = null, $model = null)
    {
        $name = Kwc_Abstract::getTemplateFile($this->view->data->componentClass, $name);
        if (!$module) { $module = $this->view; }
        return $this->partial($name, $module, $model);
    }
180612
private function checkForMissingDependencies($moduleName, DependsOnModule $module)
    {
        $dependencies = $this->getModuleDependencies($module);
        $configuredDependenciesCount = count($this->getConfiguredDependencies($moduleName));

        if ($configuredDependenciesCount < count($dependencies)) {
            $missingDependency = array_keys($dependencies)[$configuredDependenciesCount];

            $message = sprintf(
                "\nThis module depends on %s\n\n\n%s",
                $missingDependency,
                $this->getErrorMessageForDependency($module, $missingDependency)
            );

            throw new ModuleRequireException($moduleName, $message);
        }
    }
1370307
function get_module_type() {
            if ( ! isset( $this->_module_type ) ) {
                $id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
                $this->_module_type    = $id_slug_type_path_map[ $this->_module_id ]['type'];
            }

            return $this->_module_type;
        }
44688
private function classNameScalar($class_name, $colon_node) {
    $node = new ClassNameScalarNode();
    $node->addChild($class_name, 'className');
    $node->mergeNode($colon_node);
    $this->mustMatch(T_CLASS, $node, NULL, TRUE);
    return $node;
  }
544003
public function checkRequirements($module_id)
    {
        $this->checkModuleId($module_id);
        $module = $this->module->getInfo($module_id);
        $this->checkCore($module);
        $this->checkPhpVersion($module);

        if ($this->module->isInstaller($module_id)) {
            $error = $this->translation->text('Modules with "installer" type cannot be installed/enabled when system is already set up');
            throw new UnexpectedValueException($error);
        }

        $this->checkDependenciesExtensions($module);
        $this->checkDependenciesModule($module_id);
        return true;
    }
219794
public static function modulesMenuitems($routesType = 'main', $module = null)
    {
        if (empty($module)) $module = Yii::$app;

        //$submodules = $module->modules; // without ModuleManager
        //$submodules = ModulesManager::submodules($module); // only dynamicly added modules
        $submodules = ArrayHelper::merge($module->modules, ModulesManager::submodules($module));
        
        $itemsModules = [];
        foreach ($submodules as $submoduleId => $submodule) {
            if (is_array($submodule)) $submodule = $module->getModule($submoduleId);
            if (empty($submodule)) continue;

            $nextItem = false;
            $startLinkInfo = BaseModule::startLink($submodule->uniqueId, $routesType);
            if (!empty($startLinkInfo)) {
                $nextItem = [
                    'label' => $startLinkInfo['label'],
                    'url' => isset($startLinkInfo['route']) ? $startLinkInfo['route'] : $startLinkInfo['link']
                ];
            
                if (!empty($startLinkInfo['route'][0])) {
                    $actionUid = trim($startLinkInfo['route'][0], '/');
                    $can = AuthHelper::canUserRunAction($actionUid, Yii::$app->user);
                    if (!$can) $nextItem = false;
                }
            }

            $itemsSubmodules = static::modulesMenuitems($routesType, $submodule);
            if (empty($itemsSubmodules)) {
                if (!empty($nextItem)) $itemsModules[] = $nextItem;
            } else {
                if (empty($nextItem)) {
                    //$tc = TranslationsBuilder::getBaseTransCategory($submodule) . '/module';
                    $label = empty($submodule->params['label'])
                           ? Yii::t('common', "Submenu for '{uid}'", ['uid' => $submodule->uniqueId])
                           //: Yii::t($tc, $submodule->params['label']);
                           : $submodule->params['label']; // must be already translated
                } else {
                    $label = $nextItem['label'];
                    $itemsSubmodules = ArrayHelper::merge([$nextItem], $itemsSubmodules);
                }
                // make submenu
                $itemsModules[] = [
                    'label' => $label,
                    'items' => $itemsSubmodules,
                ];
            }
        }
        return $itemsModules;
    }
93487
public function get($module, $name, $default)
    {
        $index = 0;

        if ($this->has($module, $name, $index)) {
            return $this->data[$index][ConstProviderInterface::CONFIG_PARAM_VALUE];
        } else {
            return $default;
        }
    }
1078013
public static function getModuleInstanceByName($name)
    {
        $instance = self::getInstance();
        foreach ($instance->getModules() as $module) {
            if ($module->title === $name) {
                return $module;
            }
        }
        return null;
    }
171704
private function classVariable($class_name, $colon_node) {
    if ($this->currentType === '{') {
      // Must be $class_name::{expr()}().
      return $this->classMethodCall($class_name, $colon_node, $this->bracesExpr());
    }

    /*
     * Note $var_node contains possible array lookup, eg. $a[0]. This must
     * happen cause $class::$var[0]() is treated as $class::($var[0])();
     * However $class::$var[0] is treated as ($class::$var)[0], but in order
     * to determine between these two cases, the [0] has to be matched.
     */
    $var_node = $this->indirectReference();
    if ($this->currentType === '(') {
      return $this->classMethodCall($class_name, $colon_node, $var_node);
    }
    else {
      /*
       * Since $class::$var[0] is treated as ($class::$var)[0] then have
       * to replace the $var in $var[0] with $class::$var.
       */
      if ($var_node instanceof ArrayLookupNode) {
        // Find the member name, eg. $var
        $member_name = $var_node;
        while ($member_name instanceof ArrayLookupNode) {
          $member_name = $member_name->getArray();
        }
        // Replace the member name with ClassMemberLookupNode, eg. $class::$var
        $node = new ClassMemberLookupNode();
        $node->addChild($class_name, 'className');
        $node->mergeNode($colon_node);
        $node->addChild(clone $member_name, 'memberName');
        $member_name->replaceWith($node);
        return $this->objectDereference($var_node);
      }
      else {
        $node = new ClassMemberLookupNode();
        $node->addChild($class_name, 'className');
        $node->mergeNode($colon_node);
        $node->addChild($var_node, 'memberName');
        return $this->objectDereference($node);
      }
    }
  }
937566
protected function getLoggerModuleNameForType()
    {
        $reflection = new ReflectionClass($this);

        $filename = $reflection->getFileName();
        $match    = str_contains($filename, 'app') ? [1 => 'core'] : null;

        if (!isset($match[1]) and ! preg_match("'src(.*?)src'si", $filename, $match)) {
            throw new Exception('Unable to resolve current module name.');
        }

        if (!isset($match[1])) {
            throw new Exception('Unable to resolve current module namespace.');
        }

        $reserved = [
            'components', 'modules'
        ];

       return str_contains($match[1], 'core')
           ? 'core'
           : trim(str_replace($reserved, '', $match[1]), DIRECTORY_SEPARATOR);
    }
371048
public static function loadModule($moduleName) {
        $moduleConf = self::getModuleConf($moduleName);

        try {

            if (isset($moduleConf['requires_php_extension']) && is_array($moduleConf['requires_php_extension'])) {
                self::checkPhpExtensions($moduleConf['requires_php_extension']);
            }

            $tmpModule = new \ReflectionClass('\\pff\\modules\\' . $moduleConf['class']);
            if ($tmpModule->isSubclassOf('\\pff\\Abs\\AModule')) {
                $moduleName = strtolower($moduleConf['name']);

                if (isset(self::$_modules[$moduleName])) { //Module has already been loaded
                    return self::$_modules[$moduleName];
                }

                self::$_modules[$moduleName] = $tmpModule->newInstance();
                self::$_modules[$moduleName]->setModuleName($moduleConf['name']);
                self::$_modules[$moduleName]->setModuleVersion($moduleConf['version']);
                self::$_modules[$moduleName]->setModuleDescription($moduleConf['desc']);
                self::$_modules[$moduleName]->setConfig(ServiceContainer::get('config'));
                self::$_modules[$moduleName]->setApp(ServiceContainer::get('app'));
                (isset($moduleConf['runBefore']))? $moduleLoadBefore = $moduleConf['runBefore']: $moduleLoadBefore = null ;

                if (isset ($moduleConf['requires']) && is_array($moduleConf['requires'])) {
                    self::$_modules[$moduleName]->setModuleRequirements($moduleConf['requires']);
                    foreach ($moduleConf['requires'] as $requiredModuleName) {
                        self::loadModule($requiredModuleName);
                        self::$_modules[$moduleName]->registerRequiredModule(self::$_modules[$requiredModuleName]);
                    }
                }

                if ($tmpModule->isSubclassOf('\pff\Iface\IHookProvider')) {
                    ServiceContainer::get('hookmanager')->registerHook(self::$_modules[$moduleName], $moduleName, $moduleLoadBefore);
                }

                return self::$_modules[$moduleName];

            } else {
                throw new ModuleException("Invalid module: " . $moduleConf['name']);
            }
        }
        catch (\ReflectionException $e) {
            throw new ModuleException("Unable to create module instance: " . $e->getMessage());
        }

    }
948638
public static function hasName( $name, $module_id = null ): bool
	{
		if( !self::isValidName($name) )
		{
			return false;
		}

		$builder = \DB::table("events")->where("name", $name);
		if( is_numeric($module_id) )
		{
			$builder->where("module_id", (int) $module_id );
		}

		return $builder->count(["id"]) > 0;
	}
807112
protected function makeController($name, $module, $is_module = false) {
        return ModuleGenerator::renderTemplate('Controller', [
            'module' => $module,
            'name' => $name,
            'is_module' => $is_module
        ]);
    }
386069
public final function get_activity_type() {
        $class = get_class($this);
        $package = stristr($class, "\\", true);
        $type = str_replace("mod_", "", $package);
        if ($type === $package) {
            throw new \coding_exception("$class does not belong to any module specific namespace");
        }
        return $type;
    }
1103854
public static function getColumnTypeByMetadataType($metadata_type)
    {
        if (!array_key_exists($metadata_type, self::$mapper)) {
            $mt = $metadata_type;
            throw new Exception\InvalidArgumentException(__METHOD__ . " Cannot map the metadata type '$mt' to a column model type");
        }

        return ColumnType::createType(self::$mapper[$metadata_type]);
    }
1317518
function module_ex($module_name, $attrs)
	{
		$class_name = $this->class_name();
		$class_name = preg_replace('/_(main|edit|view)$/', '', $class_name);
		$module_class = \blib_grammar::plural($class_name).'_modules_'.$module_name;
		set_def($attrs, 'model', $this);
		$mod = bors_load_ex($module_class, $this, $attrs);
		if(!$mod)
			bors_throw(ec("Не могу загрузить модуль '$module_class'"));

		return $mod;
	}