Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
page.php
1
<?php
2
namespace
Bitrix\Landing\Hook
;
3
4
use \Bitrix\Landing\Manager;
5
6
abstract
class
Page
7
{
12
protected
$editMode
=
false
;
13
18
protected
$fields
= array();
19
24
protected
$fieldsPage
= array();
25
30
protected
$isPage
=
true
;
31
36
protected
$customExec
=
null
;
37
42
protected
$isNeedPublication
=
false
;
43
49
public
function
__construct
($editMode =
false
, $isPage =
true
)
50
{
51
if
(
$editMode
)
52
{
53
$this->editMode =
true
;
54
}
55
if
(!
$isPage
)
56
{
57
$this->
isPage
=
false
;
58
}
59
$this->fields = $this->
getMap
();
60
}
61
66
public
function
isPage
()
67
{
68
return
$this->isPage;
69
}
70
75
public
function
getTitle
()
76
{
77
return
''
;
78
}
79
84
public
function
getDescription
()
85
{
86
return
''
;
87
}
88
93
protected
function
isEditMode
()
94
{
95
return
$this->editMode ===
true
;
96
}
97
102
public
function
getSort
()
103
{
104
return
100;
105
}
106
111
public
function
isFree
()
112
{
113
return
true
;
114
}
115
120
public
function
isLocked
()
121
{
122
return
false
;
123
}
124
129
public
function
getLockedMessage
()
130
{
131
return
''
;
132
}
133
137
public
function
isNeedPublication
(): bool
138
{
139
return
$this->isNeedPublication;
140
}
141
146
public
function
getCode
()
147
{
148
$class = new \ReflectionClass($this);
149
return
mb_strtoupper($class->getShortName());
150
}
151
157
public
function
setData
(array $data)
158
{
159
foreach
($data as $key => $value)
160
{
161
if
(isset($this->fields[$key]))
162
{
163
$this->fields[$key]->setValue($value);
164
}
165
}
166
}
167
172
public
function
getPageFields
()
173
{
174
if
(empty($this->fieldsPage))
175
{
176
foreach
($this->fields as $field)
177
{
178
$code = $field->getCode();
179
$code = $this->
getCode
() .
'_'
. $code;
180
$field->setCode($code);
181
182
$this->fieldsPage[$code] = $field;
183
}
184
}
185
186
return
$this->fieldsPage;
187
}
188
193
public
function
getFields
()
194
{
195
return
$this->fields;
196
}
197
202
public
function
enabledInEditMode
()
203
{
204
return
true
;
205
}
206
211
public
function
enabledInIntranetMode
()
212
{
213
return
true
;
214
}
215
220
public
function
fieldsHash
()
221
{
222
$hash =
''
;
223
$hash .= implode(
'.'
, array_keys($this->fields));
224
$hash .= implode(
'.'
, array_values($this->fields));
225
$hash = md5($hash);
226
227
return
$hash;
228
}
229
234
public
function
dataExist
()
235
{
236
return
implode(
''
, array_values($this->fields)) !=
''
;
237
}
238
244
public
function
setCustomExec
(callable $callback)
245
{
246
$this->customExec = $callback;
247
}
248
253
public
function
issetCustomExec
()
254
{
255
return
is_callable($this->customExec);
256
}
257
262
protected
function
execCustom
()
263
{
264
if
($this->customExec)
265
{
266
return
call_user_func_array($this->customExec, [$this]) ===
true
;
267
}
268
return
false
;
269
}
270
275
abstract
protected
function
getMap
();
276
281
abstract
public
function
enabled
();
282
287
abstract
public
function
exec
();
288
}
Bitrix\Landing\Hook\Page
Definition
page.php:7
Bitrix\Landing\Hook\Page\isLocked
isLocked()
Definition
page.php:120
Bitrix\Landing\Hook\Page\$fieldsPage
$fieldsPage
Definition
page.php:24
Bitrix\Landing\Hook\Page\fieldsHash
fieldsHash()
Definition
page.php:220
Bitrix\Landing\Hook\Page\getDescription
getDescription()
Definition
page.php:84
Bitrix\Landing\Hook\Page\$customExec
$customExec
Definition
page.php:36
Bitrix\Landing\Hook\Page\enabledInIntranetMode
enabledInIntranetMode()
Definition
page.php:211
Bitrix\Landing\Hook\Page\getLockedMessage
getLockedMessage()
Definition
page.php:129
Bitrix\Landing\Hook\Page\$isNeedPublication
$isNeedPublication
Definition
page.php:42
Bitrix\Landing\Hook\Page\$isPage
$isPage
Definition
page.php:30
Bitrix\Landing\Hook\Page\__construct
__construct($editMode=false, $isPage=true)
Definition
page.php:49
Bitrix\Landing\Hook\Page\getMap
getMap()
Bitrix\Landing\Hook\Page\setData
setData(array $data)
Definition
page.php:157
Bitrix\Landing\Hook\Page\isPage
isPage()
Definition
page.php:66
Bitrix\Landing\Hook\Page\isNeedPublication
isNeedPublication()
Definition
page.php:137
Bitrix\Landing\Hook\Page\getTitle
getTitle()
Definition
page.php:75
Bitrix\Landing\Hook\Page\dataExist
dataExist()
Definition
page.php:234
Bitrix\Landing\Hook\Page\issetCustomExec
issetCustomExec()
Definition
page.php:253
Bitrix\Landing\Hook\Page\getSort
getSort()
Definition
page.php:102
Bitrix\Landing\Hook\Page\enabledInEditMode
enabledInEditMode()
Definition
page.php:202
Bitrix\Landing\Hook\Page\enabled
enabled()
Bitrix\Landing\Hook\Page\$fields
$fields
Definition
page.php:18
Bitrix\Landing\Hook\Page\isEditMode
isEditMode()
Definition
page.php:93
Bitrix\Landing\Hook\Page\getCode
getCode()
Definition
page.php:146
Bitrix\Landing\Hook\Page\setCustomExec
setCustomExec(callable $callback)
Definition
page.php:244
Bitrix\Landing\Hook\Page\exec
exec()
Bitrix\Landing\Hook\Page\getPageFields
getPageFields()
Definition
page.php:172
Bitrix\Landing\Hook\Page\isFree
isFree()
Definition
page.php:111
Bitrix\Landing\Hook\Page\execCustom
execCustom()
Definition
page.php:262
Bitrix\Landing\Hook\Page\$editMode
$editMode
Definition
page.php:12
Bitrix\Landing\Hook\Page\getFields
getFields()
Definition
page.php:193
Bitrix\Landing\Hook
Definition
page.php:2
modules
landing
lib
hook
page.php
Создано системой
1.10.0