Documentation

onBeforeLandingRecycle

Event is executed when landing page moved into/restored from into recycle bin. Event is not triggered when directly deleting a physical page, use the standard method ORM for this purpose (Learn more).

Parameters

Class Description Available from version
id Landing page ID.
delete Flag (Y – moving to recycle bin; N – returning from recycle bin).

Event allows denying moving into recycle bin and a required code must be commented in the example.

Пример

$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler('landing', 'onBeforeLandingRecycle',
   function(\Bitrix\Main\Event $event)
   {
      $result = new \Bitrix\Main\Entity\EventResult;

      $id = $event->getParameter('id');
      $delete = $event->getParameter('delete');

      AddMessage2Log(
         ('запись ' . $id) .
         ($delete ? ' moved to recycle bin' : ' returned from recycle bin')
      );

      /*$result->setErrors(array(
         new \Bitrix\Main\Entity\EntityError(
            'Deleting denied!',
            'DELETE_DISABLED'
         )
      ));*/

      return $result;
   }
);


© «Bitrix24», 2001-2024