1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
EditIconAction.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
EditIconAction
extends
BaseAction
10
{
11
protected
const
JS_COMMAND
=
'editIcon'
;
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\Icon::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
{
41
// convert format form getNode to js-command like
42
if
(
count
(
$params
[
'valueBefore'
][
'classList'
]) === 1)
43
{
44
$params
[
'valueBefore'
][
'classList'
] = explode(
' '
,
$params
[
'valueBefore'
][
'classList'
][0]);
45
}
46
if
(
$params
[
'valueBefore'
][
'data-pseudo-url'
])
47
{
48
$params
[
'valueBefore'
][
'url'
] =
$params
[
'valueBefore'
][
'data-pseudo-url'
];
49
unset(
$params
[
'valueBefore'
][
'data-pseudo-url'
]);
50
}
51
55
$block =
$params
[
'block'
];
56
57
return
[
58
'block'
=> $block->getId(),
59
'selector'
=>
$params
[
'selector'
] ?:
''
,
60
'position'
=>
$params
[
'position'
] ?: 0,
61
'lid'
=> $block->getLandingId(),
62
'valueAfter'
=>
$params
[
'valueAfter'
] ?:
''
,
63
'valueBefore'
=>
$params
[
'valueBefore'
] ?:
''
,
64
];
65
}
66
71
public
function
getJsCommand
(
bool
$undo =
true
):
array
72
{
73
$params
= parent::getJsCommand($undo);
74
75
$params
[
'params'
][
'selector'
] .=
'@'
.
$params
[
'params'
][
'position'
];
76
$params
[
'params'
][
'value'
] =
77
$undo
78
?
$params
[
'params'
][
'valueBefore'
]
79
:
$params
[
'params'
][
'valueAfter'
];
80
if
(isset(
$params
[
'params'
][
'value'
][
'url'
]))
81
{
82
$params
[
'params'
][
'value'
][
'url'
] = Json::decode(
$params
[
'params'
][
'value'
][
'url'
]);
83
}
84
85
unset(
86
$params
[
'params'
][
'valueAfter'
],
87
$params
[
'params'
][
'valueBefore'
],
88
$params
[
'params'
][
'position'
],
89
);
90
91
return
$params
;
92
}
93
100
public
static
function
compareParams
(
array
$oldParams,
array
$newParams): bool
101
{
102
unset($oldParams[
'valueBefore'
], $newParams[
'valueBefore'
]);
103
104
return
$oldParams === $newParams;
105
}
106
}
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\EditIconAction
Определения
EditIconAction.php:10
Bitrix\Landing\History\Action\EditIconAction\getJsCommand
getJsCommand(bool $undo=true)
Определения
EditIconAction.php:71
Bitrix\Landing\History\Action\EditIconAction\compareParams
static compareParams(array $oldParams, array $newParams)
Определения
EditIconAction.php:100
Bitrix\Landing\History\Action\EditIconAction\execute
execute(bool $undo=true)
Определения
EditIconAction.php:13
Bitrix\Landing\History\Action\EditIconAction\JS_COMMAND
const JS_COMMAND
Определения
EditIconAction.php:11
Bitrix\Landing\Node\Icon\saveNode
static saveNode(\Bitrix\Landing\Block $block, $selector, array $data)
Определения
icon.php:25
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
count
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения
waybill.php:936
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
bitrix
modules
landing
lib
History
Action
EditIconAction.php
Создано системой
1.14.0