1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
templatetemplate.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\Cli\Command\Make\Templates\Component;
4
5use Bitrix\Main\Cli\Helper\Renderer\Template;
6
7final class TemplateTemplate implements Template
8{
9 public function __construct(
10 private readonly string $componentTitlePhrase,
11 private readonly string $containerId,
12 private readonly string $extensionName,
13 private readonly string $extensionClass,
14 )
15 {}
16
17 public function getContent(): string
18 {
19 return <<<PHP
20<?php
21
25
26if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true)
27{
28 die();
29}
30
38
39\$APPLICATION->SetTitle(Loc::getMessage('{$this->componentTitlePhrase}'));
40
41// load your js extension (https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&LESSON_ID=12435)
42//Extension::load('{$this->extensionName}');
43
44?>
45
46<div id="{$this->containerId}" class="{$this->containerId}"></div>
47
48<!-- Example -->
49Example of using params:<br>
50Safe: <?= \$arParams['USERNAME'] ?> and <?= htmlspecialcharsbx(\$arParams['~USERNAME']) ?>
51
52<script>
53BX.ready(() => {
54 const container = document.getElementById('{$this->containerId}');
55 const fruits = <?= Json::encode(\$arResult['FRUITS']) ?>;
56
57 // render extension inside container
58 // new {$this->extensionClass}({
59 // container,
60 // fruits,
61 // });
62});
63</script>
64
65PHP;
66 }
67}
$arParams
Определения access_dialog.php:21
global $APPLICATION
Определения include.php:80
$arResult
Определения generate_coupon.php:16
__construct(private readonly string $componentTitlePhrase, private readonly string $containerId, private readonly string $extensionName, private readonly string $extensionClass,)
Определения templatetemplate.php:9
Определения json.php:9
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
die
Определения quickway.php:367