Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
SortBlockAction.php
1
<?php
2
3
namespace
Bitrix\Landing\History\Action
;
4
5
use
Bitrix\Landing\Landing
;
6
7
class
SortBlockAction
extends
BaseAction
8
{
9
protected
const
JS_COMMAND
=
'sortBlock'
;
10
11
public
function
execute
(
bool
$undo =
true
): bool
12
{
13
$up = (bool)$this->params[
'up'
];
14
$blockId = (int)$this->params[
'block'
];
15
$landing =
Landing::createInstance
($this->params[
'lid'
]);
16
if
($landing->exist())
17
{
18
return
($up === $undo)
19
? $landing->downBlock($blockId)
20
: $landing->upBlock($blockId)
21
;
22
}
23
24
return
false
;
25
}
26
27
public
static
function
enrichParams
(array
$params
): array
28
{
29
return
[
30
'block'
=> (int)
$params
[
'block'
],
31
'lid'
=> (
int
)
$params
[
'lid'
],
32
'up'
=> (bool)
$params
[
'up'
],
33
];
34
}
35
40
public
function
getJsCommand
(
bool
$undo =
true
): array
41
{
42
$params
= parent::getJsCommand($undo);
43
$params
[
'params'
][
'direction'
] =
44
(
$params
[
'params'
][
'up'
] === $undo)
45
?
'moveDown'
46
:
'moveUp'
47
;
48
unset(
49
$params
[
'params'
][
'lid'
],
50
$params
[
'params'
][
'up'
],
51
);
52
53
return
$params
;
54
}
55
}
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\SortBlockAction
Definition
SortBlockAction.php:8
Bitrix\Landing\History\Action\SortBlockAction\getJsCommand
getJsCommand(bool $undo=true)
Definition
SortBlockAction.php:40
Bitrix\Landing\History\Action\SortBlockAction\enrichParams
static enrichParams(array $params)
Definition
SortBlockAction.php:27
Bitrix\Landing\History\Action\SortBlockAction\execute
execute(bool $undo=true)
Definition
SortBlockAction.php:11
Bitrix\Landing\History\Action\SortBlockAction\JS_COMMAND
const JS_COMMAND
Definition
SortBlockAction.php:9
Bitrix\Landing\Landing\createInstance
static createInstance($id, array $params=array())
Definition
landing.php:534
Bitrix\Landing\History\Action
Definition
AddBlockAction.php:3
Bitrix\Landing\Landing
Definition
cache.php:2
modules
landing
lib
History
Action
SortBlockAction.php
Создано системой
1.10.0