Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
component.php
1
<?php
2
namespace
Bitrix\Main\Engine\Response\ContentArea
;
3
4
class
Component
implements
ContentAreaInterface
,
DataSectionInterface
5
{
6
private
$componentName =
null
;
7
private
$componentTemplate =
null
;
8
private
$componentParams = [];
9
private
$componentResult = [];
10
12
private
$dataKeys = [];
13
private
$parentComponent =
null
;
14
private
$functionParams = [];
15
24
public
function
__construct
($componentName, $componentTemplate =
''
, array $componentParams = [], $dataKeys = [])
25
{
26
$this->componentName = $componentName;
27
$this->componentTemplate = $componentTemplate;
28
$this->dataKeys = $dataKeys;
29
$this->
setParameters
($componentParams);
30
}
31
37
public
function
setParameters
(array $params)
38
{
39
$this->componentParams = $params;
40
41
return
$this;
42
}
43
49
public
function
setParentComponent
($parentComponent)
50
{
51
$this->parentComponent = $parentComponent;
52
53
return
$this;
54
}
55
61
public
function
setFunctionParameters
(array $functionParams)
62
{
63
$this->functionParams = $functionParams;
64
65
return
$this;
66
}
67
71
public
function
getHtml
()
72
{
73
global $APPLICATION;
74
75
ob_start();
76
$this->componentResult = $APPLICATION->IncludeComponent(
77
$this->componentName,
78
$this->componentTemplate,
79
$this->componentParams,
80
$this->parentComponent,
81
$this->functionParams,
82
!empty($this->dataKeys)
// returnResult
83
);
84
85
return
ob_get_clean();
86
}
87
91
public
function
getSectionName
(): string
92
{
93
return
'componentResult'
;
94
}
95
99
public
function
getSectionData
()
100
{
101
$result = [];
102
103
if
(
104
is_array($this->dataKeys)
105
&& !empty($this->dataKeys)
106
)
107
{
108
$result = array_intersect_key($this->componentResult, array_combine($this->dataKeys, $this->dataKeys));
109
}
110
elseif (is_callable($this->dataKeys))
111
{
112
$result = call_user_func_array($this->dataKeys, [ $this->componentResult ]);
113
}
114
115
return
$result;
116
}
117
}
Bitrix\Main\Engine\Response\ContentArea\Component
Definition
component.php:5
Bitrix\Main\Engine\Response\ContentArea\Component\setParentComponent
setParentComponent($parentComponent)
Definition
component.php:49
Bitrix\Main\Engine\Response\ContentArea\Component\__construct
__construct($componentName, $componentTemplate='', array $componentParams=[], $dataKeys=[])
Definition
component.php:24
Bitrix\Main\Engine\Response\ContentArea\Component\setFunctionParameters
setFunctionParameters(array $functionParams)
Definition
component.php:61
Bitrix\Main\Engine\Response\ContentArea\Component\setParameters
setParameters(array $params)
Definition
component.php:37
Bitrix\Main\Engine\Response\ContentArea\Component\getSectionName
getSectionName()
Definition
component.php:91
Bitrix\Main\Engine\Response\ContentArea\Component\getHtml
getHtml()
Definition
component.php:71
Bitrix\Main\Engine\Response\ContentArea\Component\getSectionData
getSectionData()
Definition
component.php:99
Bitrix\Main\Engine\Response\ContentArea\ContentAreaInterface
Definition
contentareainterface.php:5
Bitrix\Main\Engine\Response\ContentArea\DataSectionInterface
Definition
datasectioninterface.php:5
Bitrix\Main\Engine\Response\ContentArea
Definition
component.php:2
modules
main
lib
engine
response
contentarea
component.php
Создано системой
1.10.0