Documentation

GetProperties

Description and parameters

CDBResult CIBlock::GetProperties(
 int iblock_id, 
 array arOrder=Array(), 
 array arFilter=Array()
);
Returns iblock properties iblock_id with option to sort and extra filtration. Non-static method.

Note: by default, the method considers access permissions to an information block. You can disable this check in the parameter arFilter by passing the key "CHECK_PERMISSIONS" with value "N".


Call parameters

ParameterDescription
iblock_id Iblock code.
arOrder Array with sorting result. Contains pairs: "sort field"=>"sort categoty". For sort fields see. CIBlockProperty::GetList().
arFilter Array("filtered field"=>"filter value" [, ...]). View filtered fields and their values in [link= 506764]CIBlockProperty[/link]::GetList().

Returned value

Returns object CDBResult

See Also

Examples

<?
$res = CIBlock::GetProperties($IBLOCK_ID, Array(), Array("CODE"=>"SRC"));
if($res_arr = $res->Fetch())
$SrcPropID = $res_arr["ID"];
else
{
$arFields = Array(
"NAME" => "Import source",
"ACTIVE" => "Y",
"SORT" => "1000",
"DEFAULT_VALUE" => "",
"CODE" => "SRC",
"ROW_COUNT" => "1",
"COL_COUNT" => "10",
"MULTIPLE" => "N",
"MULTIPLE_CNT" => "",
"PROPERTY_TYPE" => "S",
"LIST_TYPE" => "L",
"IBLOCK_ID" => $IBLOCK_ID
);
$ibp = new CIBlockProperty;
$SrcPropID = $ibp->Add($arFields);
if(IntVal($SrcPropID)<=0)
$strWarning .= $ibp->LAST_ERROR."<br>";
}
?>

© «Bitrix24», 2001-2024
Up