CIBlockType
Class CIBlockType
Fields:
- ID string(50) mandatory
- SECTIONS bool optional default 'Y'
- EDIT_FILE_BEFORE string(255) optional
- EDIT_FILE_AFTER string(255) optional
- IN_RSS bool optional default 'N'
- SORT int optional default 500
Table of Contents
Properties
- $LAST_ERROR : string
Methods
- Add() : bool
- Creates new iblock type in the database.
- CheckFields() : bool
- Helper internal function.<br> Checks correctness of the information. Called by Add and Update methods.
- Delete() : bool|CDBResult
- Deletes iblock type including all iblocks.<br> When there is an error occured on iblock deletion it stops and returns false.
- GetByID() : CDBResult
- Returns iblock type information by ID.
- GetByIDLang() : array<string|int, mixed>|bool
- Returns iblock type information with additional language depended on messages.<br>
- getLastError() : string
- Returns last errors.
- GetList() : CDBResult
- Returns list of iblock types.
- Update() : bool
- Updates iblock type in the database.
Properties
$LAST_ERROR
public
string
$LAST_ERROR
= ''
Contains an error message in case of error in last Update or Add functions.
Methods
Add()
Creates new iblock type in the database.
public
Add(array<string|int, mixed> $arFields) : bool
For arFields see class description.
In addition it may contain key "LANG" with and array of language depended on parameters.
For example:
$arFields = array(
"ID" => "test",
"LANG" => array(
"en" => array(
"NAME" => "Test",
"ELEMENT_NAME" => "Test element",
"SECTION_NAME" => "Test section",
),
),
);
Parameters
- $arFields : array<string|int, mixed>
Return values
boolCheckFields()
Helper internal function.<br> Checks correctness of the information. Called by Add and Update methods.
public
CheckFields(array<string|int, mixed> $arFields[, bool $ID = false ]) : bool
List of errors returned by LAST_ERROR member variable.
Parameters
- $arFields : array<string|int, mixed>
- $ID : bool = false
-
iblock type ID. false - if new one.
Return values
boolDelete()
Deletes iblock type including all iblocks.<br> When there is an error occured on iblock deletion it stops and returns false.
public
static Delete(string $ID) : bool|CDBResult
Parameters
- $ID : string
-
iblock type ID.
Return values
bool|CDBResultGetByID()
Returns iblock type information by ID.
public
static GetByID(string $ID) : CDBResult
Parameters
- $ID : string
-
iblock type ID
Tags
Return values
CDBResultGetByIDLang()
Returns iblock type information with additional language depended on messages.<br>
public
static GetByIDLang(string $ID, string $LID[, bool $bFindAny = true ]) : array<string|int, mixed>|bool
Additional to language depended on fields:
- NAME - Name of the type
- SECTION_NAME - How sections are called
- ELEMENT_NAME - How elements are called
if (CModule::IncludeModule('iblock'))
{
$rsTypeLang = CIBlockType::GetByIDLang('test', 'en');
$arTypeLang = $rsTypeLang->GetNext();
if ($arTypeLang)
{
echo '<pre>', htmlspecialcharsEx(print_r($arTypeLang, true)), '</pre>';
}
}
Parameters
- $ID : string
-
iblock type ID
- $LID : string
-
language ID
- $bFindAny : bool = true
-
Forces strict search
Return values
array<string|int, mixed>|boolgetLastError()
Returns last errors.
public
getLastError() : string
Return values
stringGetList()
Returns list of iblock types.
public
static GetList([array<string|int, mixed> $arOrder = array("SORT" => "ASC") ][, array<string|int, mixed> $arFilter = array() ]) : CDBResult
Parameters
- $arOrder : array<string|int, mixed> = array("SORT" => "ASC")
-
Order of the list.
keys are case insensitive:- SORT - by SORT field.
- ID - by ID field.
- NAME - by language depended NAME field (must be used with LANGUAGE_ID in the filter).
- DESC - in descending order.
- ASC - in ascending order.
- $arFilter : array<string|int, mixed> = array()
-
Filter criteria.
keys are case insensitive:- ID - uses like operator and is case insensitive.
- =ID - when contains string uses strict equal operator.
- =ID - when contains array[]string uses in operator.
- NAME - uses like operator and is case insensitive.
- LANGUAGE_ID - uses strict equal operator and is case sensitive.
Tags
Return values
CDBResultUpdate()
Updates iblock type in the database.
public
Update(string $ID, array<string|int, mixed> $arFields) : bool
Parameters
- $ID : string
- $arFields : array<string|int, mixed>