F
F
F(x)2019-08-15 12:20:45
1C-Bitrix
F(x), 2019-08-15 12:20:45

How to check before deleting an element from an infoblock?

OnBeforeIBlockElementDeleteHandler is not executed at all. https://dev.1c-bitrix.ru/api_help/iblock/events/on... used this event. But the ID does not come at all. Is it possible to get it via var_dump?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2019-08-15
@winer

AddEventHandler("iblock", "OnBeforeIBlockElementDelete", Array("MyClass", "OnBeforeIBlockElementDeleteHandler"));

class MyClass
{
  function OnBeforeIBlockElementDeleteHandler($ID)
  {
    $res = CIBlockElement::GetByID($ID);
    if($arItem = $res->GetNext()){
      \Bitrix\Main\Diag\Debug::dumpToFile($arItem, 'arItem');
    }
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question