Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
chat.php
1
<?php
2
namespace
Bitrix\Landing\Subtype
;
3
4
use \Bitrix\Main\Localization\Loc;
5
6
Loc::loadMessages
(__FILE__);
7
8
class
Chat
9
{
17
public
static
function
prepareManifest
(array $manifest, \
Bitrix
\
Landing
\
Block
$block = NULL, array $params = []): array
18
{
19
if
(!\
Bitrix
\Main\ModuleManager::isModuleInstalled(
'im'
))
20
{
21
$manifest[
'requiredUserAction'
] = array(
22
'header'
=>
Loc::getMessage
(
'LANDING_BLOCK_IM_NOT_INSTALLED_HEADER'
),
23
'description'
=>
Loc::getMessage
(
'LANDING_BLOCK_IM_NOT_INSTALLED_TEXT'
),
24
'text'
=>
Loc::getMessage
(
'LANDING_BLOCK_IM_NOT_INSTALLED_LINK'
),
25
'href'
=>
'/bitrix/admin/module_admin.php?lang='
. LANGUAGE_ID,
26
'className'
=>
'landing-required-link'
27
);
28
}
29
$manifest[
'callbacks'
] = array(
30
'afterAdd'
=>
function
(\
Bitrix
\
Landing
\
Block
&$block) use($params)
31
{
32
$block->saveDynamicParams(
33
self::getSourceParams($params)
34
);
35
},
36
);
37
38
return
$manifest;
39
}
40
46
protected
static
function
buildReferences
(array $references): array
47
{
48
$return = [];
49
50
foreach
($references as $fieldCode => $selector)
51
{
52
if
(is_string($selector))
53
{
54
$return[$selector] = [
55
'id'
=> $fieldCode,
56
'link'
=> false
57
];
58
}
59
}
60
61
return
$return;
62
}
63
69
protected
static
function
getSourceParams
(array $params): array
70
{
71
$return = [];
72
73
if
(
74
isset($params[
'type'
]) && is_string($params[
'type'
]) &&
75
isset($params[
'card'
]) && is_string($params[
'card'
]) &&
76
isset($params[
'attributeData'
]) && is_string($params[
'attributeData'
]) &&
77
isset($params[
'references'
]) && is_array($params[
'references'
])
78
)
79
{
80
$return[$params[
'card'
]] = [
81
'source'
=>
'landing:chat'
,
82
'references'
=>
self::buildReferences
($params[
'references'
]),
83
'settings'
=> [
84
'source'
=> [
85
'source'
=>
'landing:chat'
,
86
'additional'
=> [
87
'type'
=> $params[
'type'
],
88
'attributeData'
=> $params[
'attributeData'
],
89
'attributeButton'
=> isset($params[
'attributeButton'
])
90
? $params[
'attributeButton'
]
91
: null
92
]
93
],
94
'pagesCount'
=> isset($params[
'references'
])
95
? $params[
'references'
]
96
: 10
97
]
98
];
99
}
100
101
return
$return;
102
}
103
}
Bitrix\Landing\Block
Definition
block.php:21
Bitrix\Landing\Connector\Landing
Definition
landing.php:12
Bitrix\Landing\Subtype\Chat
Definition
chat.php:9
Bitrix\Landing\Subtype\Chat\getSourceParams
static getSourceParams(array $params)
Definition
chat.php:69
Bitrix\Landing\Subtype\Chat\buildReferences
static buildReferences(array $references)
Definition
chat.php:46
Bitrix\Landing\Subtype\Chat\prepareManifest
static prepareManifest(array $manifest, \Bitrix\Landing\Block $block=NULL, array $params=[])
Definition
chat.php:17
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\Subtype
Definition
chat.php:2
Bitrix
modules
landing
lib
subtype
chat.php
Создано системой
1.10.0