Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
map.php
1
<?php
2
namespace
Bitrix\Landing\Node
;
3
4
use
Bitrix\Landing\History
;
5
6
class
Map
extends
\Bitrix\Landing\Node
7
{
8
protected
const
ATTR_MAP
=
'data-map'
;
9
14
public
static
function
getHandlerJS
()
15
{
16
return
'BX.Landing.Node.Map'
;
17
}
18
26
public
static
function
saveNode
(\
Bitrix
\
Landing
\
Block
$block, $selector, array $data)
27
{
28
$doc = $block->getDom();
29
$resultList = $doc->querySelectorAll($selector);
30
31
foreach
($data as $pos => $value)
32
{
33
if
(isset($resultList[$pos]) && $value)
34
{
35
if
(
History::isActive
())
36
{
37
$history =
new
History
($block->getLandingId(),
History::ENTITY_TYPE_LANDING
);
38
$history->push(
'EDIT_MAP'
, [
39
'block'
=> $block,
40
'selector'
=> $selector,
41
'position'
=> (
int
)$pos,
42
'valueBefore'
=> $resultList[$pos]->getAttributes()[self::ATTR_MAP]->getValue(),
43
'valueAfter'
=> $value,
44
]);
45
}
46
47
$resultList[$pos]->setAttribute(
48
self::ATTR_MAP,
49
$value
50
);
51
}
52
}
53
}
54
61
public
static
function
getNode
(\
Bitrix
\
Landing
\
Block
$block, $selector)
62
{
63
$data = array();
64
$doc = $block->getDom();
65
$resultList = $doc->querySelectorAll($selector);
66
67
foreach
($resultList as $pos => $res)
68
{
69
$data[$pos] = $res->getAttribute(self::ATTR_MAP);
70
}
71
72
return
$data;
73
}
74
}
Bitrix\Landing\Block
Definition
block.php:21
Bitrix\Landing\Connector\Landing
Definition
landing.php:12
Bitrix\Landing\History
Definition
history.php:17
Bitrix\Landing\History\isActive
static isActive()
Definition
history.php:105
Bitrix\Landing\History\ENTITY_TYPE_LANDING
const ENTITY_TYPE_LANDING
Definition
history.php:21
Bitrix\Landing\Node\Map
Definition
map.php:7
Bitrix\Landing\Node\Map\ATTR_MAP
const ATTR_MAP
Definition
map.php:8
Bitrix\Landing\Node\Map\getNode
static getNode(\Bitrix\Landing\Block $block, $selector)
Definition
map.php:61
Bitrix\Landing\Node\Map\getHandlerJS
static getHandlerJS()
Definition
map.php:14
Bitrix\Landing\Node\Map\saveNode
static saveNode(\Bitrix\Landing\Block $block, $selector, array $data)
Definition
map.php:26
Bitrix\Landing\Node
Definition
node.php:5
Bitrix\Landing\History
Bitrix\Landing\Node
Definition
component.php:2
Bitrix
modules
landing
lib
node
map.php
Создано системой
1.10.0