Documentation

OnBeforeIBlockSectionDelete

bool
event_handler(
 int ID
);
The event OnBeforeIBlockSectionDelete is 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.

Returned value

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

See Also

  • CIBlockSection::Delete>

    Example

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