1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
RemoveBlockAction.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Landing\History\Action;
4
5
use Bitrix\Landing\Block;
6
use Bitrix\Landing\File;
7
use Bitrix\Landing\Internals\BlockTable;
8
use Bitrix\Landing\Landing;
9
10
class
RemoveBlockAction
extends
AddBlockAction
11
{
12
protected
const
JS_COMMAND
=
'removeBlock'
;
13
14
public
function
execute
(
bool
$undo =
true
): bool
15
{
16
$landing = Landing::createInstance($this->params[
'lid'
]);
17
if
(
18
$landing->exist()
19
&& $landing->markDeletedBlock((
int
)$this->params[
'block'
],
true
)
20
)
21
{
22
$landing->resortBlocks();
23
24
return
true
;
25
}
26
27
return
false
;
28
}
29
30
public
function
delete
(): bool
31
{
32
if
(!isset($this->params[
'block'
]))
33
{
34
return
false
;
35
}
36
37
$blockId = (int)$this->params[
'block'
];
38
$query
= BlockTable::query()
39
->setSelect([
'ID'
,
'ACCESS'
])
40
->where(
'ID'
,
'='
, $blockId)
41
->where(
'DELETED'
,
'='
,
'Y'
)
42
->exec()
43
;
44
$block =
$query
->fetch();
45
if
(
46
$block
47
&& $block[
'ACCESS'
] === Block::ACCESS_X
48
)
49
{
50
BlockTable::delete($blockId);
51
File::deleteFromBlock
($blockId);
52
}
53
54
return
parent::delete();
55
}
56
}
Bitrix\Landing\File\deleteFromBlock
static deleteFromBlock($blockId, $fileId=array())
Определения
file.php:363
Bitrix\Landing\History\Action\AddBlockAction
Определения
AddBlockAction.php:9
Bitrix\Landing\History\Action\RemoveBlockAction
Определения
RemoveBlockAction.php:11
Bitrix\Landing\History\Action\RemoveBlockAction\execute
execute(bool $undo=true)
Определения
RemoveBlockAction.php:14
Bitrix\Landing\History\Action\RemoveBlockAction\JS_COMMAND
const JS_COMMAND
Определения
RemoveBlockAction.php:12
$query
$query
Определения
get_search.php:11
bitrix
modules
landing
lib
History
Action
RemoveBlockAction.php
Создано системой
1.14.0