Bitrix Site Manager

OnBeforeIBlockSectionAdd

bool
event_handler(
   array &arParams 
);
Fired from CIBlockSection::Add before the information block section is inserted. 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.

Return Values

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

See Also

  • OnAfterIBlockSectionAdd event
  • CIBlockSection::Add
  • Handling events

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