Documentation

OnBeforeIBlockPropertyAdd

bool
event_handler(
   array &arParams 
);
The event OnBeforeIBlockPropertyAdd is fired from CIBlockProperty:Add before the new information block property is added. Can be used to cancel operation or to redefine fields.

Parameters

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

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 values

To cancel the operation and terminate CIBlockProperty:Add, throw an exception by calling ThrowException() and return false.

See Also

  • OnAfterIBlockPropertyAdd event
  • CIBlockProperty:Add

    Example

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