Bitrix API

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
bool

CheckFields()

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
bool

Delete()

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|CDBResult

GetByID()

Returns iblock type information by ID.

public static GetByID(string $ID) : CDBResult
Parameters
$ID : string

iblock type ID

Tags
see
CIBlockType
if (CModule::IncludeModule('iblock')) { $rsType = CIBlockType::GetByID('test'); $arType = $rsType->GetNext(); if ($arType) { echo '<pre>', htmlspecialcharsEx(print_r($arType, true)), '</pre>'; } }
Return values
CDBResult

GetByIDLang()

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>|bool

getLastError()

Returns last errors.

public getLastError() : string
Return values
string

GetList()

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).
values are case insensitive:
  • 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.
values with zero string length are ignored.

Tags
example

iblocktype.php

Return values
CDBResult

Update()

Updates iblock type in the database.

public Update(string $ID, array<string|int, mixed> $arFields) : bool

$arFields is the same as for method.

Parameters
$ID : string
$arFields : array<string|int, mixed>
Tags
see
CIBlockType::Add
Return values
bool

        
On this page

Search results