1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
templatetemplate.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Main\Cli\Command\Make\Templates\Component;
4
5
use Bitrix\Main\Cli\Helper\Renderer\Template;
6
7
final
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
22
use
Bitrix\Main\Web\Json
;
23
use
Bitrix\Main\Localization\Loc
;
24
use
Bitrix\Main\UI\Extension
;
25
26
if
(!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 -->
49
Example of
using
params:<br>
50
Safe: <?= \
$arParams
[
'USERNAME'
] ?> and <?=
htmlspecialcharsbx
(\
$arParams
[
'~USERNAME'
]) ?>
51
52
<script>
53
BX.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
65
PHP;
66
}
67
}
$arParams
$arParams
Определения
access_dialog.php:21
$APPLICATION
global $APPLICATION
Определения
include.php:80
$arResult
$arResult
Определения
generate_coupon.php:16
Bitrix\Main\Cli\Command\Make\Templates\Component\TemplateTemplate
Определения
templatetemplate.php:8
Bitrix\Main\Cli\Command\Make\Templates\Component\TemplateTemplate\getContent
getContent()
Определения
templatetemplate.php:17
Bitrix\Main\Cli\Command\Make\Templates\Component\TemplateTemplate\__construct
__construct(private readonly string $componentTitlePhrase, private readonly string $containerId, private readonly string $extensionName, private readonly string $extensionClass,)
Определения
templatetemplate.php:9
Bitrix\Main\Localization\Loc
Определения
loc.php:12
Bitrix\Main\UI\Extension
Определения
extension.php:11
Bitrix\Main\Web\Json
Определения
json.php:9
Bitrix\Main\Cli\Helper\Renderer\Template
Определения
template.php:6
htmlspecialcharsbx
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения
tools.php:2701
die
die
Определения
quickway.php:367
bitrix
modules
main
lib
cli
command
make
templates
component
templatetemplate.php
Создано системой
1.14.0