Bitrix Site Manager

OnBeforeIBlockSectionUpdate

bool
event_handler(
 array &arParams 
);
Fired from the method CIBlockSection::Update before an information block section is modified. Can be used to decline modifying a section or to redefine fields.

Parameters

ParameterDescription
arParams An array of fields of the information block section to be updated.

Note
The parameter of this handler is a reference to the original variable. Hence, altering the value(s) from within the handler causes changing values of the source variable passed to the handler.

Return Values

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

See Also

  • OnAfterIBlockSectionUpdate event
  • CIBlockSection::Update
  • Handling events

    Example

    
    <?
    // file /bitrix/php_interface/init.php
    // register handler
    AddEventHandler("iblock", "OnBeforeIBlockSectionUpdate", Array("MyClass", "OnBeforeIBlockSectionUpdateHandler"));
    
    class MyClass
    {
        // create handler "OnBeforeIBlockSectionUpdate"
        function OnBeforeIBlockSectionUpdateHandler(&$arFields)
        {
            if(strlen($arFields["CODE"])<=0)
            {
                global $APPLICATION;
                $APPLICATION->throwException("Enter the mnemonic code. (ID:".$arFields["ID"].")");
                return false;
            }
        }
    }
    ?>