1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
EditMapAction.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Landing\History\Action;
4
5
use Bitrix\Landing\Block;
6
use Bitrix\Landing\Node;
7
use Bitrix\Main\Web\Json;
8
9
class
EditMapAction
extends
BaseAction
10
{
11
protected
const
JS_COMMAND
=
'editMap'
;
12
13
public
function
execute
(
bool
$undo =
true
): bool
14
{
15
$block =
new
Block
((
int
)$this->params[
'block'
]);
16
$selector = $this->params[
'selector'
] ?:
''
;
17
$position = (int)($this->params[
'position'
] ?: 0);
18
$value = $undo ? $this->params[
'valueBefore'
] : $this->params[
'valueAfter'
];
19
20
if
($selector)
21
{
22
$doc = $block->getDom();
23
$resultList = $doc->querySelectorAll($selector);
24
if
(isset($resultList[$position]))
25
{
26
Node\Map::saveNode
($block, $selector, [
27
$position => $value
28
]);
29
30
$block->saveContent($doc->saveHTML());
31
32
return
$block->save();
33
}
34
}
35
36
return
false
;
37
}
38
39
public
static
function
enrichParams
(
array
$params
):
array
40
{
44
$block =
$params
[
'block'
];
45
46
return
[
47
'block'
=> $block->getId(),
48
'selector'
=>
$params
[
'selector'
] ?:
''
,
49
'position'
=>
$params
[
'position'
] ?: 0,
50
'lid'
=> $block->getLandingId(),
51
'valueAfter'
=>
$params
[
'valueAfter'
] ?:
''
,
52
'valueBefore'
=>
$params
[
'valueBefore'
] ?:
''
,
53
];
54
}
55
60
public
function
getJsCommand
(
bool
$undo =
true
):
array
61
{
62
$params
= parent::getJsCommand($undo);
63
64
$params
[
'params'
][
'selector'
] .=
'@'
.
$params
[
'params'
][
'position'
];
65
$params
[
'params'
][
'value'
] =
66
$undo
67
?
$params
[
'params'
][
'valueBefore'
]
68
:
$params
[
'params'
][
'valueAfter'
]
69
;
70
$params
[
'params'
][
'value'
] = Json::decode(
$params
[
'params'
][
'value'
]);
71
72
unset(
73
$params
[
'params'
][
'valueAfter'
],
74
$params
[
'params'
][
'valueBefore'
],
75
$params
[
'params'
][
'position'
],
76
);
77
78
return
$params
;
79
}
80
87
public
static
function
compareParams
(
array
$oldParams,
array
$newParams): bool
88
{
89
unset($oldParams[
'valueBefore'
], $newParams[
'valueBefore'
]);
90
91
return
$oldParams === $newParams;
92
}
93
}
Bitrix\Landing\History\Action\BaseAction
Определения
BaseAction.php:5
Bitrix\Landing\History\Action\BaseAction\$params
array $params
Определения
BaseAction.php:7
Bitrix\Landing\History\Action\BaseAction\enrichParams
static enrichParams(array $params)
Bitrix\Landing\History\Action\EditMapAction
Определения
EditMapAction.php:10
Bitrix\Landing\History\Action\EditMapAction\getJsCommand
getJsCommand(bool $undo=true)
Определения
EditMapAction.php:60
Bitrix\Landing\History\Action\EditMapAction\compareParams
static compareParams(array $oldParams, array $newParams)
Определения
EditMapAction.php:87
Bitrix\Landing\History\Action\EditMapAction\execute
execute(bool $undo=true)
Определения
EditMapAction.php:13
Bitrix\Landing\History\Action\EditMapAction\JS_COMMAND
const JS_COMMAND
Определения
EditMapAction.php:11
Bitrix\Landing\Node\Map\saveNode
static saveNode(\Bitrix\Landing\Block $block, $selector, array $data)
Определения
map.php:26
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Landing\Block
Определения
blockrepo.php:3
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
bitrix
modules
landing
lib
History
Action
EditMapAction.php
Создано системой
1.14.0