Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
transition.php
1
<?php
2
3
namespace
Bitrix\Landing\Hook\Page
;
4
5
use
Bitrix\Landing\Field
;
6
use
Bitrix\Landing\Hook
;
7
use
Bitrix\Landing\Landing
;
8
use
Bitrix\Landing\Manager
;
9
use
Bitrix\Main\Localization\Loc
;
10
use Bitrix\Main\Page\Asset;
11
15
class
Transition
extends
Hook\Page
16
{
17
protected
const
BASE_COLOR
=
'#fff'
;
18
23
protected
function
getMap
(): array
24
{
25
return
[
26
'COLOR'
=>
new
Field\Text
(
'COLOR'
, [
27
'title'
=>
Loc::getMessage
(
'LANDING_HOOK_TRANSITION_COLOR'
),
28
]),
29
];
30
}
31
36
public
function
enabled
(): bool
37
{
38
if
($this->
issetCustomExec
())
39
{
40
return
true
;
41
}
42
43
if
($this->
isPage
())
44
{
45
return
false
;
46
}
47
48
return
true
;
//always enable on site to default value
49
}
50
55
public
function
exec
(): void
56
{
57
if
($this->
execCustom
())
58
{
59
return
;
60
}
61
62
$type = strtoupper(Landing::getSiteType());
63
if
($type ===
'KNOWLEDGE'
)
64
{
65
return
;
66
}
67
68
$color = \htmlspecialcharsbx(trim($this->fields[
'COLOR'
]->getValue()));
69
if
(!$color)
70
{
71
$color =
self::BASE_COLOR
;
72
}
73
$this->
addTransitionClass
();
74
$this->
setTransition
($color);
75
}
76
77
protected
function
setTransition
($color): void
78
{
79
Asset::getInstance()->addString(
80
'<style>
81
body.landing-page-transition::after {
82
}
83
</style>'
84
);
85
}
86
87
protected
function
addTransitionClass
(): void
88
{
89
//add background on page load
90
Manager::setPageView
(
91
'BodyClass'
,
92
'landing-page-transition'
93
);
94
}
95
}
Bitrix\Landing\Assets\Manager
Definition
manager.php:20
Bitrix\Landing\Field\Text
Definition
text.php:5
Bitrix\Landing\Hook\Page\Transition
Definition
transition.php:16
Bitrix\Landing\Hook\Page\Transition\setTransition
setTransition($color)
Definition
transition.php:77
Bitrix\Landing\Hook\Page\Transition\BASE_COLOR
const BASE_COLOR
Definition
transition.php:17
Bitrix\Landing\Hook\Page\Transition\addTransitionClass
addTransitionClass()
Definition
transition.php:87
Bitrix\Landing\Hook\Page\Transition\getMap
getMap()
Definition
transition.php:23
Bitrix\Landing\Hook\Page\Transition\enabled
enabled()
Definition
transition.php:36
Bitrix\Landing\Hook\Page\Transition\exec
exec()
Definition
transition.php:55
Bitrix\Landing\Hook\Page
Definition
page.php:7
Bitrix\Landing\Hook\Page\isPage
isPage()
Definition
page.php:66
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\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
Bitrix\Landing\Hook
Definition
page.php:2
Bitrix\Landing\Landing
Definition
cache.php:2
modules
landing
lib
hook
page
transition.php
Создано системой
1.10.0