3namespace Bitrix\MobileApp\Janative;
5use Bitrix\Main\Application;
6use Bitrix\Main\Config\Option;
7use Bitrix\Main\EventManager;
8use Bitrix\Main\IO\Directory;
9use Bitrix\Main\IO\FileNotFoundException;
10use Bitrix\MobileApp\Janative\Entity\Component;
11use Bitrix\MobileApp\Janative\Entity\Extension;
16 private static ?
array $workspaces =
null;
17 private static ?
array $availableComponents =
null;
18 private static array $extensionPaths = [];
19 private static ?
bool $isBundleEnabled =
null;
21 private static function getWorkspaces():
array
23 if (self::$workspaces ==
null)
25 self::$workspaces = [];
27 foreach ($events as
$event)
30 if (!in_array(
$path, self::$workspaces))
32 self::$workspaces[] =
$path;
37 return self::$workspaces;
44 private static function fetchComponents(): ?
array
46 if (self::$availableComponents ==
null)
48 self::$availableComponents = [];
49 $rawComponentList = [];
50 $workspaces = self::getWorkspaces();
51 foreach ($workspaces as
$path)
53 $componentDir =
new Directory(Application::getDocumentRoot() .
$path .
'/components/');
54 if (!$componentDir->isExists())
59 $namespaces = $componentDir->getChildren();
60 foreach ($namespaces as $NSDir)
62 if (!$NSDir->isDirectory())
67 $namespaceItems = $NSDir->getChildren();
68 $namespace = $NSDir->getName();
69 foreach ($namespaceItems as $item)
73 $component =
new Component($item->getPath(), $namespace);
74 $name = $item->getName();
76 $rawComponentList[
$name] = $component;
86 self::$availableComponents = $rawComponentList;
90 return self::$availableComponents;
99 if (!isset(self::$extensionPaths[$ext]))
102 $workspaces = self::getWorkspaces();
103 foreach ($workspaces as
$path)
105 $extensionDir =
new Directory(Application::getDocumentRoot() .
$path .
'/extensions/' .
$desc[
'relativePath']);
106 if ($extensionDir->isExists())
108 self::$extensionPaths[$ext] = $extensionDir->getPath();
114 return self::$extensionPaths[$ext] ??
null;
119 $extList = is_array($ext) ? $ext : [$ext];
122 $alreadyResolved = [];
124 foreach ($extList as $extension)
139 foreach ($extensions as $extName)
142 $result[
'messages'] = array_merge(
$result[
'messages'], $extension->getLangMessages());
143 $result[
'js'][] = $extension->getRelativePathToFile();
159 return $component->getVersion();
175 return $component->getPublicPath();
187 return self::fetchComponents();
198 $components = self::fetchComponents();
200 return $components[
$name] ??
null;
205 if (self::$isBundleEnabled ===
null)
207 self::$isBundleEnabled = Option::get(
'mobileapp',
'jn_bundle_enabled',
'N') ===
'Y';
210 return self::$isBundleEnabled;
static getResolvedDependencyList($name, &$list=[], &$alreadyResolved=[], $margin=0)
static getInstance($identifier)
static getExtensionResourceList($ext)
static getExtensionPath($ext)
static getAvailableComponents()
static getComponentVersion($componentName)
static getComponentPath($componentName)
static getComponentByName($name)
static extractEntityDescription($entityIdentifier, string $defaultNamespace="bitrix")
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
ExecuteModuleEventEx($arEvent, $arParams=[])
if(mb_strlen($order)< 6) $desc