Bitrix Site Manager

OnBeforeIBlockPropertyDelete

bool
event_handler(
 int ID
);
Fired before the information block property is deleted 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.

Return Values

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

See Also

  • CIBlockProperty::Delete
  • Handling events

    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;
            }
        }
    }
    ?>