Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
RemoveBlockAction.php
1<?php
2
4
9
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}
static deleteFromBlock($blockId, $fileId=array())
Definition file.php:363
static createInstance($id, array $params=array())
Definition landing.php:534