124 $componentFilePath =
"{$this->path}/{$this->baseFileName}.js";
125 $extensionContent =
"";
126 $availableComponents =
"";
127 if ($this->isBundleEnabled)
129 $bundleConfig =
new Config(
"{$this->path}/dist/deps.bundle.php");
130 foreach ($bundleConfig->dynamicData as $ext)
133 $extensionContent .= $extension->getResultExpression();
135 $componentFilePath =
"{$this->path}/dist/{$this->baseFileName}.bundle.js";
140 $availableComponents =
"this.availableComponents = ".Utils::jsonEncode( $this->
getComponentListInfo()).
";";
144 $events = $eventManager->findEventHandlers(
"mobileapp",
"onBeforeComponentContentGet");
146 $additionalContent =
"";
147 if (count($events) > 0)
149 foreach ($events as $event)
151 $jsCode = ExecuteModuleEventEx($event, [$this]);
152 if (is_string($jsCode)) {
153 $additionalContent .= $jsCode;
167 $file =
new File($componentFilePath);
168 if ($file->isExists())
170 $componentCode = $file->getContents();
171 $content .=
"\n" . $componentCode;
180 $result = Utils::jsonEncode($this->
getResult());
181 $object = Utils::jsonEncode($this->
getInfo());
185 if ($isExtranetModuleInstalled)
187 $extranetSiteId = CExtranet::getExtranetSiteId();
188 if (!$extranetSiteId)
190 $isExtranetModuleInstalled =
false;
193 $isExtranetUser = $isExtranetModuleInstalled && !CExtranet::IsIntranetUser();
204 $res = CSite::getById($siteId);
206 ($extranetSiteFields = $res->fetch())
207 && ($extranetSiteFields[
'ACTIVE'] !=
'N')
210 $siteDir = $extranetSiteFields[
'DIR'];
215 $env = Utils::jsonEncode([
217 'languageId' => LANGUAGE_ID,
218 'siteDir' => $siteDir,
219 'userId' => $USER->GetId(),
220 'extranet' => $isExtranetUser
223 $export = $file->getContents();
224 $inlineContent = <<<JS
229 this.result = $result;
230 this.component = $object;
236 return $inlineContent;
240 $relativeComponents = $this->getComponentDependencies();
242 if ($relativeComponents !==
null) {
243 $relativeComponentsScope = [];
244 foreach ($relativeComponents as $scope)
246 if (isset($componentScope[$scope])) {
247 $relativeComponentsScope[$scope] = $componentScope[$scope];
251 $componentScope = $relativeComponentsScope;
254 return array_map(
function ($component) {
255 return $component->getInfo();
281 $config = $this->getConfig();
284 $this->version =
"1";
285 if ( $this->isBundleEnabled )
287 $bundleVersion =
new File(
"{$this->path}/dist/version.bundle.php");
288 if ($bundleVersion->isExists())
290 $versionDesc = include($bundleVersion->getPath());
291 $this->version = $versionDesc[
'version'];
296 $versionFile =
new File(
"{$this->path}/version.php");
297 if ($versionFile->isExists())
299 $versionDesc = include($versionFile->getPath());
300 $this->version = $versionDesc[
'version'];
301 $this->version .=
'.' . self::VERSION;
304 $this->version .=
'_' . $this->getModificationMarker();
308 return $this->version;
318 public function getLangMessages()
320 $langPhrases = parent::getLangMessages();
321 $extensions = $this->getDependencies();
322 foreach ($extensions as $extension)
326 $extensionPhrases = $instance->getLangMessages();
327 $langPhrases = array_merge($langPhrases, $extensionPhrases);
352 $componentDependencies = parent::getComponentDependencies();
353 if (is_array($componentDependencies)) {
354 $dependencies = $this->getDependencies();
356 foreach ($dependencies as $dependency)
358 $list = (
new Extension($dependency))->getComponentDependencies();
359 if ($list !==
null) {
360 $componentDependencies = array_merge($componentDependencies, $list);
364 return array_unique($componentDependencies);