Bitrix Site Manager

OnBeforeIBlockSectionDelete

bool
event_handler(
 int ID
);
Fired before a section is deleted by calling CIBlockSection::Delete. A common task of this handler is to cancel or approve the deletion.

Parameters

ParameterDescription
ID The ID of the section to be deleted.

Return Values

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

See Also

  • CIBlockSection::Delete
  • Handling events

    Example

    
    <?
    // file /bitrix/php_interface/init.php
    // register handler
    AddEventHandler("iblock",
                    "OnBeforeIBlockSectionDelete", 
                    Array("MyClass", "OnBeforeIBlockSectionDeleteHandler"));
    
    class MyClass
    {
        // create handler "OnBeforeIBlockSectionDelete"
        function OnBeforeIBlockSectionDeleteHandler($ID)
        {
            if($ID==1)
            {
                global $APPLICATION;
                $APPLICATION->throwException("section ID=1 cannot be deleted.");
                return false;
            }
        }
    }
    ?>