CPhotogalleryElement :: OnBeforeIBlockElementDelete: Bitrix method

      
<?php 
//  CPhotogalleryElement :: OnBeforeIBlockElementDelete()
//  /dist/bitrix/modules/photogallery/classes/general/element.php:132

    
function OnBeforeIBlockElementDelete($ID)
    {
        
$ID doubleval($ID);
        if (
CPhotogalleryElement::CheckElement($ID$arElement$arSection$arGallery))
        {
            
$arGallery["UF_GALLERY_SIZE"] = (doubleval($arGallery["UF_GALLERY_SIZE"]) - $arElement["FILE"]["FILE_SIZE"]); 
            
$GLOBALS["UF_GALLERY_SIZE"] = ($arGallery["UF_GALLERY_SIZE"] <= $arGallery["UF_GALLERY_SIZE"]); 
            
$GLOBALS["PHOTOGALLERY_VARS"]["arGalleries"][$arGallery["ID"]]["UF_GALLERY_SIZE"] = $GLOBALS["UF_GALLERY_SIZE"]; 
            
$arFields = array(
                
"IBLOCK_ID" => $arElement["IBLOCK_ID"], 
                
"UF_GALLERY_SIZE" => $GLOBALS["UF_GALLERY_SIZE"]);
            
$bs = new CIBlockSection;
            
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_".$arElement["IBLOCK_ID"]."_SECTION"$arFields);
            
$res $bs->Update($arGallery["ID"], $arFieldsfalsefalse);
        }
        return 
true;
    }