OnBeforeBlogUpdate
bool Handler function( int ID, array &arParams );
This event is called in the CBlog::Update method before modifying a blog and can be used to cancel the modification or to redefine certain fields.
Function parameters
Parameter | Description |
---|---|
ID | Modified blog ID. |
arParams | Array of fields of blog. |
All parameters of this handler are links to initial variables. That's why, if you modify parameter value inside the handler, it will lead to modified initial variable, received by handler function.
Returned value
To cancel the adding process and to terminate execution of the CBlog::Update method, you must create an exception in the handler function by theSee Also
- "OnBlogUpdate" event
- CBlog::Update
Example
<? // file /bitrix/php_interface/init.php // register the handler AddEventHandler("blog", "OnBeforeBlogUpdate", Array("MyClass", "OnBeforeBlogUpdateHandler")); class MyClass { // create the event handler "OnBeforeBlogUpdate" public static function OnBeforeBlogUpdateHandler($ID, &$arFields) { if(strlen($arFields["DESCRIPTION"])<=0) { global $APPLICATION; $APPLICATION->throwException("Enter blog description"); return false; } } } ?>
© «Bitrix24», 2001-2024