1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
UpdateContentAction.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Landing\History\Action;
4
5
use Bitrix\Landing\Block;
6
7
class
UpdateContentAction
extends
BaseAction
8
{
9
protected
const
JS_COMMAND
=
'updateContent'
;
10
11
public
function
execute
(
bool
$undo =
true
): bool
12
{
13
$block =
new
Block
((
int
)$this->params[
'block'
]);
14
if
($block->exist())
15
{
16
$content
= $undo ? $this->params[
'contentBefore'
] : $this->params[
'contentAfter'
];
17
$block->saveContent(
$content
, $this->params[
'designed'
]);
18
19
return
$block->save();
20
}
21
22
return
false
;
23
}
24
25
public
static
function
enrichParams
(
array
$params
):
array
26
{
27
return
[
28
'block'
=>
$params
[
'block'
],
29
'contentAfter'
=>
$params
[
'contentAfter'
] ?:
''
,
30
'contentBefore'
=>
$params
[
'contentBefore'
] ?:
''
,
31
'designed'
=> (bool)
$params
[
'designed'
],
32
];
33
}
34
35
public
function
isNeedPush
(): bool
36
{
37
return
38
parent::isNeedPush()
39
&& $this->params[
'contentBefore'
] !== $this->params[
'contentAfter'
];
40
}
41
46
public
function
getJsCommand
(
bool
$undo =
true
):
array
47
{
48
$params
= parent::getJsCommand($undo);
49
50
$params
[
'params'
][
'content'
] =
51
$undo
52
?
$params
[
'params'
][
'contentBefore'
]
53
:
$params
[
'params'
][
'contentAfter'
]
54
;
55
56
unset(
57
$params
[
'params'
][
'contentAfter'
],
58
$params
[
'params'
][
'contentBefore'
],
59
$params
[
'params'
][
'designed'
],
60
);
61
62
return
$params
;
63
}
64
}
Bitrix\Landing\History\Action\BaseAction
Определения
BaseAction.php:5
Bitrix\Landing\History\Action\BaseAction\$params
array $params
Определения
BaseAction.php:7
Bitrix\Landing\History\Action\UpdateContentAction
Определения
UpdateContentAction.php:8
Bitrix\Landing\History\Action\UpdateContentAction\getJsCommand
getJsCommand(bool $undo=true)
Определения
UpdateContentAction.php:46
Bitrix\Landing\History\Action\UpdateContentAction\isNeedPush
isNeedPush()
Определения
UpdateContentAction.php:35
Bitrix\Landing\History\Action\UpdateContentAction\enrichParams
static enrichParams(array $params)
Определения
UpdateContentAction.php:25
Bitrix\Landing\History\Action\UpdateContentAction\execute
execute(bool $undo=true)
Определения
UpdateContentAction.php:11
Bitrix\Landing\History\Action\UpdateContentAction\JS_COMMAND
const JS_COMMAND
Определения
UpdateContentAction.php:9
$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
bitrix
modules
landing
lib
History
Action
UpdateContentAction.php
Создано системой
1.14.0