1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
EditTextAction.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Landing\History\Action;
4
5
use Bitrix\Landing\Block;
6
use Bitrix\Main\Text\Emoji;
7
8
class
EditTextAction
extends
BaseAction
9
{
10
protected
const
JS_COMMAND
=
'editText'
;
11
12
public
function
execute
(
bool
$undo =
true
): bool
13
{
14
$block =
new
Block
((
int
)$this->params[
'block'
]);
15
$selector = $this->params[
'selector'
] ?:
''
;
16
$position = (int)($this->params[
'position'
] ?: 0);
17
18
if
($selector)
19
{
20
$doc = $block->getDom();
21
$resultList = $doc->querySelectorAll($selector);
22
if
(isset($resultList[$position]))
23
{
24
$content
= $undo ? $this->params[
'valueBefore'
] : $this->params[
'valueAfter'
];
25
$content
= Emoji::decode(
$content
);
26
$resultList[$position]->setInnerHTML(
$content
);
27
$block->saveContent($doc->saveHTML());
28
29
return
$block->save();
30
}
31
}
32
33
return
false
;
34
}
35
36
public
static
function
enrichParams
(
array
$params
):
array
37
{
41
$block =
$params
[
'block'
];
42
43
$valueBefore =
$params
[
'valueBefore'
] ?:
''
;
44
$valueBefore = Emoji::encode($valueBefore);
45
$valueAfter =
$params
[
'valueAfter'
] ?:
''
;
46
$valueAfter = Emoji::encode($valueAfter);
47
48
return
[
49
'block'
=> $block->getId(),
50
'selector'
=>
$params
[
'selector'
] ?:
''
,
51
'position'
=>
$params
[
'position'
] ?: 0,
52
'lid'
=> $block->getLandingId(),
53
'valueAfter'
=> $valueAfter,
54
'valueBefore'
=> $valueBefore,
55
];
56
}
57
62
public
function
getJsCommand
(
bool
$undo =
true
):
array
63
{
64
$params
= parent::getJsCommand($undo);
65
66
$params
[
'params'
][
'selector'
] .=
'@'
.
$params
[
'params'
][
'position'
];
67
$params
[
'params'
][
'value'
] =
68
$undo
69
?
$params
[
'params'
][
'valueBefore'
]
70
:
$params
[
'params'
][
'valueAfter'
]
71
;
72
$params
[
'params'
][
'value'
] = Emoji::decode(
$params
[
'params'
][
'value'
]);
73
74
unset(
75
$params
[
'params'
][
'valueAfter'
],
76
$params
[
'params'
][
'valueBefore'
],
77
$params
[
'params'
][
'position'
],
78
);
79
80
return
$params
;
81
}
82
89
public
static
function
compareParams
(
array
$oldParams,
array
$newParams): bool
90
{
91
unset($oldParams[
'valueBefore'
], $newParams[
'valueBefore'
]);
92
93
return
$oldParams === $newParams;
94
}
95
}
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\EditTextAction
Определения
EditTextAction.php:9
Bitrix\Landing\History\Action\EditTextAction\getJsCommand
getJsCommand(bool $undo=true)
Определения
EditTextAction.php:62
Bitrix\Landing\History\Action\EditTextAction\compareParams
static compareParams(array $oldParams, array $newParams)
Определения
EditTextAction.php:89
Bitrix\Landing\History\Action\EditTextAction\execute
execute(bool $undo=true)
Определения
EditTextAction.php:12
Bitrix\Landing\History\Action\EditTextAction\JS_COMMAND
const JS_COMMAND
Определения
EditTextAction.php:10
$content
$content
Определения
commerceml.php:144
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
EditTextAction.php
Создано системой
1.14.0