Documentation

OnBeforeIBlockPropertyDelete

bool
event_handler(
 int ID
);
The event OnBeforeIBlockPropertyDelete is fired before deleting an information block property by a call to CIBlockProperty:Delete. A common task of this handler is to cancel or approve the deletion.

Parameters

ParameterDescription
ID The ID of the property to be deleted.

Returned value

To cancel deletion and terminate CIBlockProperty:Delete, throw an exception by calling ThrowException() and return false.

See Also

  • CIBlockProperty:Delete

    Example

     
    <?
    // file /bitrix/php_interface/init.php
    // register handler
    AddEventHandler("iblock", 
                    "OnBeforeIBlockPropertyDelete", 
                    Array("MyClass", "OnBeforeIBlockPropertyDeleteHandler"));
    
    class MyClass
    {
        // create handler "OnBeforeIBlockPropertyDelete"
        function OnBeforeIBlockPropertyDeleteHandler($ID)
        {
            if($ID==1)
            {
                global $APPLICATION;
                $APPLICATION->throwException("The property ID=1 cannot be deleted.");
                return false;
            }
        }
    }
    ?>
    © «Bitrix24», 2001-2022
    Up