onBeforeFolderRecycle
Event is triggered when moving folder to recycle bin or restoring from recycle bin. Event isn't triggered when directly deleting such folder (for this purpose, use standard ORM method).
Parameters
Method | Description | Available from version |
---|---|---|
id | Folder ID. | |
delete | Flag:
|
The event also allows restricting moving to recycle bin.
Example
$eventManager = \Bitrix\Main\EventManager::getInstance(); $eventManager->addEventHandler('landing', 'onBeforeFolderRecycle', function(\Bitrix\Main\Event $event) { $result = new \Bitrix\Main\Entity\EventResult; $id = $event->getParameter('id'); $delete = $event->getParameter('delete'); AddMessage2Log( ('record ' . $id) . ($delete ? ' moved to recycle bin' : ' restored from recycle bin') ); // Restriction to putting to recycle bin. When required - comment the code. /*$result->setErrors(array( new \Bitrix\Main\Entity\EntityError( 'Deleting is denied!', 'DELETE_DISABLED' ) ));*/ return $result; } );
© «Bitrix24», 2001-2024