22 private int $iblockId;
24 private string $listMode;
26 public static function getId(): string
33 $this->iblockId = $iblockId;
34 $this->rights = $rights;
35 $this->listMode = $listMode;
40 return $this->iblockId;
45 return $this->listMode;
52 [$elementIds, $sectionIds] = $this->prepareItemIds($request, $isSelectedAllRows, $filter);
57 $this->removeElements($elementIds)->
getErrors()
64 $this->removeSections($sectionIds)->
getErrors()
71 private function removeElements(array $ids):
Result
82 if (!$this->rights->canDeleteElement($id))
84 $message =
Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_REMOVE_ACTIONS_ITEM_ACCESS_DENIED', [
94 if (!CIBlockElement::Delete($id))
96 $ex = $APPLICATION->GetException();
99 $result->addError(
new Error(
105 $result->addError(
new Error(
107 'IBLOCK_GRID_PANEL_UI_ACTIONS_ITEM_REMOVE_ERROR_DELETE',
121 private function removeSections(array $ids): Result
128 $result =
new Result();
130 foreach ($ids as $id)
132 if (!$this->rights->canDeleteSection($id))
134 $message =
Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_REMOVE_ACTIONS_ITEM_ACCESS_DENIED', [
144 if (!CIBlockSection::Delete($id))
146 $ex = $APPLICATION->GetException();
149 $result->addError(
new Error(
155 $result->addError(
new Error(
157 'IBLOCK_GRID_PANEL_UI_ACTIONS_ITEM_REMOVE_ERROR_DELETE',
static getMessage($code, $replace=null, $language=null)