Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
view.php
1
<?php
2
3
namespace
Bitrix\Landing\Hook\Page
;
4
5
use
Bitrix\Landing\Field
;
6
use
Bitrix\Landing\Hook\Page
;
7
use
Bitrix\Landing\Manager
;
8
use
Bitrix\Main\Localization\Loc
;
9
10
Loc::loadMessages
(__FILE__);
11
12
class
View
extends
Page
13
{
18
public
function
getItems
(): array
19
{
20
static
$items = [];
21
if
(empty($items))
22
{
23
$items = [
24
'no'
=>
Loc::getMessage
(
'LANDING_HOOK_VIEW_TYPE_NO'
),
25
'ltr'
=>
Loc::getMessage
(
'LANDING_HOOK_VIEW_TYPE_LTR'
),
26
'all'
=>
Loc::getMessage
(
'LANDING_HOOK_VIEW_TYPE_ALL'
),
27
'mobile'
=>
Loc::getMessage
(
'LANDING_HOOK_VIEW_TYPE_MOBILE'
),
28
'adaptive'
=>
Loc::getMessage
(
'LANDING_HOOK_VIEW_TYPE_ADAPTIVE'
),
29
];
30
}
31
return
$items;
32
}
33
38
protected
function
getMap
(): array
39
{
40
return
[
41
'USE'
=>
new
Field\Checkbox
(
'USE'
, [
42
'title'
=>
Loc::getMessage
(
'LANDING_HOOK_VIEW_USE'
),
43
]),
44
'TYPE'
=>
new
Field\Select
(
'TYPE'
, [
45
'title'
=>
Loc::getMessage
(
'LANDING_HOOK_VIEW_TYPE'
),
46
'options'
=> $this->
getItems
(),
47
]),
48
];
49
}
50
55
public
function
getTitle
(): string
56
{
57
return
Loc::getMessage
(
'LANDING_HOOK_VIEW_NAME'
);
58
}
59
64
public
function
enabled
(): bool
65
{
66
if
($this->
issetCustomExec
())
67
{
68
return
true
;
69
}
70
71
return
$this->fields[
'USE'
]->getValue() ===
'Y'
;
72
}
73
78
public
function
exec
(): void
79
{
80
if
($this->
execCustom
())
81
{
82
return
;
83
}
84
85
$type = trim($this->fields[
'TYPE'
]);
86
$bodyClass =
''
;
87
$mainClasses =
''
;
88
89
if
($type ===
'ltr'
)
90
{
91
$bodyClass =
'landing-viewtype--ltr'
;
92
$mainClasses =
'g-pt-6 g-px-10 g-pt-30--md g-px-50--md'
;
93
}
94
elseif ($type ===
'all'
)
95
{
96
$bodyClass =
'landing-viewtype--all'
;
97
$mainClasses =
'g-py-6 g-px-10 g-py-30--md g-px-50--md'
;
98
}
99
elseif ($type ===
'mobile'
)
100
{
101
$bodyClass =
'landing-viewtype--mobile'
;
102
$mainClasses =
'mx-auto'
;
103
}
104
elseif ($type ===
'adaptive'
)
105
{
106
$bodyClass =
'landing-viewtype--adaptive'
;
107
// $mainClasses = 'mx-auto';
108
}
109
110
Manager::setPageView
(
'BodyClass'
, $bodyClass);
111
Manager::setPageView
(
'MainClass'
, $mainClasses);
112
}
113
}
Bitrix\Landing\Assets\Manager
Definition
manager.php:20
Bitrix\Landing\Field\Checkbox
Definition
checkbox.php:5
Bitrix\Landing\Field\Select
Definition
select.php:9
Bitrix\Landing\Hook\Page\View
Definition
view.php:13
Bitrix\Landing\Hook\Page\View\getMap
getMap()
Definition
view.php:38
Bitrix\Landing\Hook\Page\View\getTitle
getTitle()
Definition
view.php:55
Bitrix\Landing\Hook\Page\View\enabled
enabled()
Definition
view.php:64
Bitrix\Landing\Hook\Page\View\getItems
getItems()
Definition
view.php:18
Bitrix\Landing\Hook\Page\View\exec
exec()
Definition
view.php:78
Bitrix\Landing\Hook\Page
Definition
page.php:7
Bitrix\Landing\Hook\Page\issetCustomExec
issetCustomExec()
Definition
page.php:253
Bitrix\Landing\Hook\Page\execCustom
execCustom()
Definition
page.php:262
Bitrix\Landing\Manager\setPageView
static setPageView(string $marker, string $content, bool $skipTrim=false)
Definition
manager.php:465
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Landing\Field
Definition
checkbox.php:2
Bitrix\Landing\Hook\Page
Definition
b24button.php:2
modules
landing
lib
hook
page
view.php
Создано системой
1.10.0