Documentation

OnBeforeIBlockElementUpdate

bool handler function(
   array &arParams 
);
The event OnBeforeIBlockElementUpdate is called in the method CIBlockElement::Update before modifying an iblock element and can be used to cancel a modification to re-define specific fields.

Parameters

ParameterDescription
arParams array of fields for the modified iblock element.

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

Create an exception in the event handler via the method $APPLICATION->ThrowException() and return false false, it cancels execution of the method CIBlockElement::Update.

See Also

Example of handler function:

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


© «Bitrix24», 2001-2024
Up