1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
EditComponentAction.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
EditComponentAction
extends
BaseAction
10
{
11
protected
const
JS_COMMAND
=
'editComponent'
;
12
13
public
function
execute
(
bool
$undo =
true
): bool
14
{
15
$block =
new
Block
((
int
)$this->params[
'block'
]);
16
$selector = $this->params[
'selector'
] ?:
''
;
17
$value = $undo ? $this->params[
'valueBefore'
] : $this->params[
'valueAfter'
];
18
19
if
($selector)
20
{
21
$manifest = $block->getManifest();
22
if
(isset($manifest[
'nodes'
][$selector][
'extra'
]))
23
{
24
$doc = $block->getDom();
25
Node\Component::saveNode
($block, $selector, $value);
26
$block->saveContent($doc->saveHTML());
27
28
return
$block->save();
29
}
30
}
31
32
return
false
;
33
}
34
35
public
static
function
enrichParams
(
array
$params
):
array
36
{
40
$block =
$params
[
'block'
];
41
42
return
[
43
'block'
=> $block->getId(),
44
'selector'
=>
$params
[
'selector'
] ?:
''
,
45
'lid'
=> $block->getLandingId(),
46
'valueAfter'
=>
$params
[
'valueAfter'
] ?: [],
47
'valueBefore'
=>
$params
[
'valueBefore'
] ?: [],
48
];
49
}
50
55
public
function
getJsCommand
(
bool
$undo =
true
):
array
56
{
57
$params
= parent::getJsCommand($undo);
58
59
$params
[
'params'
][
'value'
] =
60
$undo
61
?
$params
[
'params'
][
'valueBefore'
]
62
:
$params
[
'params'
][
'valueAfter'
]
63
;
64
65
unset(
66
$params
[
'params'
][
'valueAfter'
],
67
$params
[
'params'
][
'valueBefore'
],
68
);
69
70
return
$params
;
71
}
72
79
public
static
function
compareParams
(
array
$oldParams,
array
$newParams): bool
80
{
81
unset($oldParams[
'valueBefore'
], $newParams[
'valueBefore'
]);
82
83
return
$oldParams === $newParams;
84
}
85
}
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\EditComponentAction
Определения
EditComponentAction.php:10
Bitrix\Landing\History\Action\EditComponentAction\getJsCommand
getJsCommand(bool $undo=true)
Определения
EditComponentAction.php:55
Bitrix\Landing\History\Action\EditComponentAction\compareParams
static compareParams(array $oldParams, array $newParams)
Определения
EditComponentAction.php:79
Bitrix\Landing\History\Action\EditComponentAction\execute
execute(bool $undo=true)
Определения
EditComponentAction.php:13
Bitrix\Landing\History\Action\EditComponentAction\JS_COMMAND
const JS_COMMAND
Определения
EditComponentAction.php:11
Bitrix\Landing\Node\Component\saveNode
static saveNode(Block $block, $selector, array $data)
Определения
component.php:122
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
EditComponentAction.php
Создано системой
1.14.0