Bitrix Site Manager

CIBlock::GetProperties

CDBResult
CIBlock::GetProperties(
 int iblock_id, 
 array arOrder=Array(), 
 array arFilter=Array()
);
Returns properties of an information block by its identifier. The returned properties may be sorted and the filter may be applied.

Parameters

ParameterDescription
iblock_id Information block ID.
arOrder Optional sort order. Array of the format Array(by1=>order1[, by2=>order2 [, ..]]) where by is the field for sorting. See CIBlockProperty::GetList() for the full description of the sorting fields.
arFilter Optional additional filter by fields in the form of Array("Filtered field"=>"Value", ...). See CIBlockProperty::GetList() for the full description of fields and values.

Return Values

Returns an instance of CDBResult.

See Also

  • Property fields
  • CIBlockProperty::GetList()

    Example


    <?
    $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>";
    }
    ?>