Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
BaseAction.php
1
<?php
2
namespace
Bitrix\Landing\History\Action
;
3
4
abstract
class
BaseAction
5
{
6
protected
const
JS_COMMAND
=
''
;
7
protected
array
$params
= [];
8
14
public
function
setParams
(array
$params
,
bool
$prepared =
false
): void
15
{
16
if
(!$prepared)
17
{
18
$params
= static::enrichParams(
$params
);
19
}
20
$this->params =
$params
;
21
}
22
23
public
function
getParams
(): array
24
{
25
return
$this->params
;
26
}
27
28
abstract
public
function
execute
(
bool
$undo =
true
): bool;
29
abstract
public
static
function
enrichParams
(array
$params
): array;
30
35
public
function
delete
(): bool
36
{
37
return
true
;
38
}
39
44
public
function
isNeedPush
(): bool
45
{
46
// todo: compare valuebefore||valueafter (see examples in some actions)
47
return
!empty($this->params);
48
}
49
54
public
function
getJsCommand
(
bool
$undo =
true
): array
55
{
56
return
[
57
'command'
=> static::JS_COMMAND,
58
'params'
=>
$this->params
,
59
];
60
}
61
66
public
static
function
getJsCommandName
(): string
67
{
68
return
static::JS_COMMAND;
69
}
70
77
public
static
function
compareParams
(array $oldParams, array $newParams): bool
78
{
79
return
$oldParams === $newParams;
80
}
81
}
Bitrix\Landing\History\Action\BaseAction
Definition
BaseAction.php:5
Bitrix\Landing\History\Action\BaseAction\$params
array $params
Definition
BaseAction.php:7
Bitrix\Landing\History\Action\BaseAction\getJsCommand
getJsCommand(bool $undo=true)
Definition
BaseAction.php:54
Bitrix\Landing\History\Action\BaseAction\isNeedPush
isNeedPush()
Definition
BaseAction.php:44
Bitrix\Landing\History\Action\BaseAction\compareParams
static compareParams(array $oldParams, array $newParams)
Definition
BaseAction.php:77
Bitrix\Landing\History\Action\BaseAction\getJsCommandName
static getJsCommandName()
Definition
BaseAction.php:66
Bitrix\Landing\History\Action\BaseAction\setParams
setParams(array $params, bool $prepared=false)
Definition
BaseAction.php:14
Bitrix\Landing\History\Action\BaseAction\enrichParams
static enrichParams(array $params)
Bitrix\Landing\History\Action\BaseAction\execute
execute(bool $undo=true)
Bitrix\Landing\History\Action\BaseAction\getParams
getParams()
Definition
BaseAction.php:23
Bitrix\Landing\History\Action\BaseAction\JS_COMMAND
const JS_COMMAND
Definition
BaseAction.php:6
Bitrix\Landing\History\Action
Definition
AddBlockAction.php:3
modules
landing
lib
History
Action
BaseAction.php
Создано системой
1.10.0