• Модуль: mobileapp
  • Путь к файлу: ~/bitrix/modules/mobileapp/lib/janative/manager.php
  • Класс: BitrixMobileAppJanativeManager
  • Вызов: Manager::fetchComponents
static function fetchComponents(): ?array
    {
        if (self::$availableComponents == null)
        {
            self::$availableComponents = [];
            $rawComponentList = [];
            $workspaces = self::getWorkspaces();
            foreach ($workspaces as $path)
            {
                $componentDir = new Directory(Application::getDocumentRoot() . $path . '/components/');
                if (!$componentDir->isExists())
                {
                    continue;
                }

                $namespaces = $componentDir->getChildren();
                foreach ($namespaces as $NSDir)
                {
                    if (!$NSDir->isDirectory())
                    {
                        continue;
                    }

                    $namespaceItems = $NSDir->getChildren();
                    $namespace = $NSDir->getName();
                    foreach ($namespaceItems as $item)
                    {
                        try
                        {
                            $component = new Component($item->getPath(), $namespace);
                            $name = $item->getName();
                            $name = ($namespace == 'bitrix' ? $name : $namespace . ':' . $name);
                            $rawComponentList[$name] = $component;
                        } catch (Exception $e)
                        {

                        }
                    }
                }
            }

		self::$availableComponents = $rawComponentList;

        }

        return self::$availableComponents;
    }