Documentation

OnBeforeIBlockSectionAdd

bool
event_handler(
   array &arParams 
);
The event OnBeforeIBlockSectionAdd is fired from CIBlockSection:Add before inserting an the information block section. Can be used to decline insertion or to redefine fields.

Parameters

ParameterDescription
arParams An array of the new information block section fields.

Note
The parameter(s) of this handler are references to the original variables. Hence, altering their values from within the handler causes changing values of the source variables passed to the handler.

Returned value

To cancel insertion and terminate CIBlockSection:Add, throw an exception by calling ThrowException() and return false.

See Also

  • OnAfterIBlockSectionAdd event
  • CIBlockSection:Add

    Example

     
    <?
    // file /bitrix/php_interface/init.php
    // register handler
    AddEventHandler("iblock", "OnBeforeIBlockSectionAdd", Array("MyClass", "OnBeforeIBlockSectionAddHandler"));
    
    class MyClass
    {
        // create handler "OnBeforeIBlockSectionAdd"
        function OnBeforeIBlockSectionAddHandler(&$arFields)
        {
            if(strlen($arFields["CODE"])<=0)
            {
                global $APPLICATION;
                $APPLICATION->throwException("Enter the mnemonic code.");
                return false;
            }
        }
    }
    ?>
    © «Bitrix24», 2001-2022
    Up