Description and parameters

bool CIBlock::Update(
 int ID,
 array arFields

Method updates parameters for iblock with ID. You can modify fields as well as cancel parameter edit by adding the event handler OnBeforeIBlockUpdate. Upon successful adding of iblock, the event handler OnAfterIBlockUpdate is added. Non-static method.

Call parameters

IDUpdated iblock ID.
arFieldsArray("field"=>"value", ...). Contains values for all iblock fields.
Additionally, the field SITE_ID can contain the array with site IDs with modified iblock bound.
Also, you can set access permissions for various groups to the iblock using the field "GROUP_ID", containing array with group codes matchings with corresponding access permissions. See CIBlock::SetPermission()).
When the field "FIELDS" is set, executes field settings (see. CIBlock::SetFields).

Returned value

Method returns true on success, or false on error and object's property LAST_ERROR will contain error text.

See Also


$ib = new CIBlock;
$arFields = Array(
"NAME" => $NAME,
"CODE" => $CODE,
"IBLOCK_TYPE_ID" => $type,
"SITE_ID" => Array("en", "de"),
"SORT" => $SORT,
"GROUP_ID" => Array("2"=>"D", "3"=>"R")
if ($ID > 0)
$res = $ib->Update($ID, $arFields);
$ID = $ib->Add($arFields);
$res = ($ID>0);

© «Bitrix24», 2001-2023