Bitrix API

Base extends CBitrixComponent

AbstractYes

Table of Contents

Constants

ACTION_ADD_TO_BASKET  = 'ADD2BASKET'
ACTION_ADD_TO_COMPARE  = 'ADD_TO_COMPARE_LIST'
ACTION_BUY  = 'BUY'
ACTION_DELETE_FROM_COMPARE  = 'DELETE_FROM_COMPARE_LIST'
ACTION_SUBSCRIBE  = 'SUBSCRIBE_PRODUCT'
ERROR_404  = 2
ERROR_TEXT  = 1
PARAM_TITLE_MASK  = '/^[A-Za-z_][A-Za-z01-9_]*$/'
SORT_ORDER_MASK  = '/^(asc|desc|nulls)(,asc|,desc|,nulls)?$/i'

Properties

$__name  : mixed
$__parent  : CBitrixComponent
$__path  : mixed
$__template  : CBitrixComponentTemplate
$__templatePage  : mixed
$arParams  : mixed
$arResult  : mixed
$arResultCacheKeys  : array<string|int, mixed>

Methods

__construct()  : mixed
Base constructor.
__prepareComponentParams()  : void
Helper function for component parameters safe html escaping.
__showError()  : void
Function shows an internal error message.
abortResultCache()  : void
Function aborts the cache after it's start.
addChildCSS()  : void
Function registers children css file for cache.
addChildEpilog()  : void
Function registers children epilog file for cache.
addChildFrame()  : void
Registers child frame for cache.
addChildJS()  : void
Function registers children js file for cache.
addDeleteAction()  : void
Function adds an delete action to some area inside the component.
addEditAction()  : void
Function adds an edit action to some area inside the component.
addEditButton()  : void
Function adds a button to be displayed.
addIncludeAreaIcon()  : void
Function adds an Icon to the component area in the editing mode.
addIncludeAreaIcons()  : void
Function replaces Icons displayed for the component by an collection.
addViewTarget()  : void
Function registers new view target for the cache.
applyTemplateModifications()  : array<string|int, mixed>
Returns prepared all component parameters after verify template parameters .
checkEnlargedData()  : void
Check item properties for enlarge images.
clearComponentCache()  : void
Function clears entire component cache.
clearResultCache()  : void
Function deletes the cache created before.
endResultCache()  : void
Function ends the caching block of the component execution.
executeComponent()  : int|false
Function calls __includeComponent in order to execute the component.
getAction()  : string
Return current action.
getCacheID()  : string
Function returns an cache identifier based on component parameters and environment.
getCachePath()  : string
Function returns component cache path.
getDefaultFrameMode()  : mixed
getEditAreaId()  : string
Function returns component area id for editing mode.
getFrameMode()  : mixed
getIncludeAreaIcons()  : mixed
Function returns the collection of the Icons displayed for the component.
getLanguageId()  : mixed
getName()  : string
Function returns component name in form bitrix:component.name
getParent()  : CBitrixComponent
Function returns the parent component (if exists)
getPath()  : string
Function returns path to component relative to Web server DOCUMENT_ROOT in form /bitrix/components/bitrix/component.name
getProductsMap()  : array<string|int, mixed>
Returns ids map: SKU_PRODUCT_ID => PRODUCT_ID.
getRealFrameMode()  : mixed
getRelativePath()  : string
Function returns path to component in form /bitrix/component.name
getSettingsScript()  : string
Return settings script path with modified time postfix.
getSignedParameters()  : string|null
Returns signed parameters.
getSiteId()  : mixed
getSiteTemplateId()  : mixed
getTemplate()  : CBitrixComponentTemplate
Function returns the template object
getTemplateCachedData()  : mixed
Function returns current template css files or null if there is no template.
getTemplateEmptyPreview()  : mixed
getTemplateName()  : string
Function returns the name of the template
getTemplatePage()  : string
Function returns the template page witch was set with initComponentTemplate
includeComponent()  : mixed
Function executes the component. Returns the result of it's execution.
includeComponentClass()  : string
Function includes class of the component by component name bitrix:component.base
includeComponentEpilog()  : void
Function restores component epilog environment and executes it.
includeComponentLang()  : void
Function includes language files from within the component directory.
includeComponentTemplate()  : void
Function executes the template.
initComponent()  : bool
Function initializes the component. Returns true on success.
initComponentTemplate()  : bool
Function initializes the template of the component. Returns true on success.
isCacheDisabled()  : bool
Check if cache disabled.
isEnableCompatible()  : bool
Return state filling old keys in result data. This method makes no sense for the new components.
isExtendedMode()  : bool
Check if extended mode is enabled.
isMergeProductWhenAddedBasket()  : bool
Should merge products when adding to the basket (increase the quantity of products)?
onIncludeComponentLang()  : void
Event called from includeComponent before component execution.
onPrepareComponentParams()  : mixed
Processing of component parameters.
randString()  : string
Function returns next pseudo random value.
sendJsonAnswer()  : void
Send answer for AJAX request.
setFrameMode()  : void
Marks a component as capable of composite mode.
setLanguageId()  : mixed
setResultCacheKeys()  : void
Function marks the arResult keys to be saved to cache. Just like __sleep magic method do.
setSiteId()  : mixed
setSiteTemplateId()  : mixed
setTemplateCachedData()  : void
Function applies collection of the css files to the current template.
setTemplateEpilog()  : void
Function saves component epilog environment
setTemplateName()  : bool
Function sets the name of the template. Returns true on success.
showComponentTemplate()  : void
Function executes initialized template of the component.
startResultCache()  : string
Function starts the caching block of the component execution.

Constants

ACTION_ADD_TO_BASKET

public mixed ACTION_ADD_TO_BASKET = 'ADD2BASKET'

ACTION_ADD_TO_COMPARE

public mixed ACTION_ADD_TO_COMPARE = 'ADD_TO_COMPARE_LIST'

ACTION_BUY

public mixed ACTION_BUY = 'BUY'

ACTION_DELETE_FROM_COMPARE

public mixed ACTION_DELETE_FROM_COMPARE = 'DELETE_FROM_COMPARE_LIST'

ACTION_SUBSCRIBE

public mixed ACTION_SUBSCRIBE = 'SUBSCRIBE_PRODUCT'

ERROR_404

public mixed ERROR_404 = 2

ERROR_TEXT

public mixed ERROR_TEXT = 1

PARAM_TITLE_MASK

public mixed PARAM_TITLE_MASK = '/^[A-Za-z_][A-Za-z01-9_]*$/'

SORT_ORDER_MASK

public mixed SORT_ORDER_MASK = '/^(asc|desc|nulls)(,asc|,desc|,nulls)?$/i'

Properties

$__template

public CBitrixComponentTemplate $__template = \null

$__templatePage

public mixed $__templatePage = ""

$arResultCacheKeys

public array<string|int, mixed> $arResultCacheKeys = \false

Methods

__construct()

Base constructor.

public __construct([CBitrixComponent|null $component = null ]) : mixed
Parameters
$component : CBitrixComponent|null = null

Component object if exists.

__prepareComponentParams()

Helper function for component parameters safe html escaping.

public final __prepareComponentParams(array[string] &$arParams) : void
Parameters
$arParams : array[string]

__showError()

Function shows an internal error message.

public __showError(string $errorMessage[, string $errorCode = "" ]) : void
Parameters
$errorMessage : string
$errorCode : string = ""

abortResultCache()

Function aborts the cache after it's start.

public final abortResultCache() : void

Note: must be called if component returns before endResultCache or includeComponentTemplate called.

addChildCSS()

Function registers children css file for cache.

public final addChildCSS(string $cssPath) : void
Parameters
$cssPath : string

addChildEpilog()

Function registers children epilog file for cache.

public final addChildEpilog(string $epilogFile) : void
Parameters
$epilogFile : string

addChildFrame()

Registers child frame for cache.

public final addChildFrame(StaticArea $frame) : void
Parameters
$frame : StaticArea

addChildJS()

Function registers children js file for cache.

public final addChildJS(string $jsPath) : void
Parameters
$jsPath : string

addDeleteAction()

Function adds an delete action to some area inside the component.

public final addDeleteAction(string $entryId, string $deleteLink[, string|bool $deleteTitle = false ][, array[string] $arParams = array() ]) : void
  • $arParams['CONFIRM'] = false - disable confirm;
  • $arParams['CONFIRM'] = 'Text' - confirm with custom text;
  • no $arParams['CONFIRM'] at all - confirm with default text
Parameters
$entryId : string
$deleteLink : string
$deleteTitle : string|bool = false
$arParams : array[string] = array()

addEditAction()

Function adds an edit action to some area inside the component.

public final addEditAction(string $entryId, string $editLink[, string|bool $editTitle = false ][, array[string] $arParams = array() ]) : void
Parameters
$entryId : string
$editLink : string
$editTitle : string|bool = false
$arParams : array[string] = array()

addEditButton()

Function adds a button to be displayed.

public final addEditButton(array[int] $arButton) : void
Parameters
$arButton : array[int]

addIncludeAreaIcon()

Function adds an Icon to the component area in the editing mode.

public final addIncludeAreaIcon(array[string] $arIcon) : void
Parameters
$arIcon : array[string]

addIncludeAreaIcons()

Function replaces Icons displayed for the component by an collection.

public final addIncludeAreaIcons(mixed $arIcons) : void
Parameters
$arIcons : mixed

addViewTarget()

Function registers new view target for the cache.

public final addViewTarget(string $target, string $content, int $pos) : void
Parameters
$target : string
$content : string
$pos : int

applyTemplateModifications()

Returns prepared all component parameters after verify template parameters .

public applyTemplateModifications() : array<string|int, mixed>
Return values
array<string|int, mixed>

checkEnlargedData()

Check item properties for enlarge images.

public static checkEnlargedData(array<string|int, mixed> &$item, string $propertyCode) : void
Parameters
$item : array<string|int, mixed>

Element description.

$propertyCode : string

Image property code.

clearComponentCache()

Function clears entire component cache.

public final static clearComponentCache(string $componentName[, string $siteId = "" ]) : void

Note: parameters must exactly match to startResultCache call.

Parameters
$componentName : string
$siteId : string = ""

clearResultCache()

Function deletes the cache created before.

public final clearResultCache([mixed $additionalCacheID = false ][, string|bool $cachePath = false ]) : void

Note: parameters must exactly match to startResultCache call.

Parameters
$additionalCacheID : mixed = false
$cachePath : string|bool = false

endResultCache()

Function ends the caching block of the component execution.

public final endResultCache() : void

Note: automaticly called by includeComponentTemplate.

executeComponent()

Function calls __includeComponent in order to execute the component.

public executeComponent() : int|false
Return values
int|false

getAction()

Return current action.

public getAction() : string
Return values
string

getCacheID()

Function returns an cache identifier based on component parameters and environment.

public getCacheID([mixed $additionalCacheID = false ]) : string
Parameters
$additionalCacheID : mixed = false
Return values
string

getCachePath()

Function returns component cache path.

public final getCachePath() : string
Return values
string

getDefaultFrameMode()

public getDefaultFrameMode() : mixed

getEditAreaId()

Function returns component area id for editing mode.

public final getEditAreaId(string $entryId) : string
Parameters
$entryId : string
Return values
string

getFrameMode()

public getFrameMode() : mixed

getIncludeAreaIcons()

Function returns the collection of the Icons displayed for the component.

public final getIncludeAreaIcons() : mixed
Tags
@return

array[int][string]mixed

getLanguageId()

public getLanguageId() : mixed

getName()

Function returns component name in form bitrix:component.name

public final getName() : string

Note: component must be inited by initComponent method.

Return values
string

getPath()

Function returns path to component relative to Web server DOCUMENT_ROOT in form /bitrix/components/bitrix/component.name

public final getPath() : string

Note: component must be inited by initComponent method.

Return values
string

getProductsMap()

Returns ids map: SKU_PRODUCT_ID => PRODUCT_ID.

public static getProductsMap([array<string|int, mixed> $originalIds = array() ]) : array<string|int, mixed>
Parameters
$originalIds : array<string|int, mixed> = array()

Input products ids.

Return values
array<string|int, mixed>

getRealFrameMode()

public getRealFrameMode() : mixed

getRelativePath()

Function returns path to component in form /bitrix/component.name

public final getRelativePath() : string

Note: component must be inited by initComponent method.

Return values
string

getSettingsScript()

Return settings script path with modified time postfix.

public static getSettingsScript(string $componentPath, string $settingsName) : string
Parameters
$componentPath : string

Path to component.

$settingsName : string

Settings name.

Return values
string

getSignedParameters()

Returns signed parameters.

public final getSignedParameters() : string|null

The list contains parameters which are presented in \CBitrixComponent::listKeysSignedParameters().

Tags
see
CBitrixComponent::listKeysSignedParameters()
Return values
string|null

getSiteTemplateId()

public getSiteTemplateId() : mixed

getTemplate()

Function returns the template object

public final getTemplate() : CBitrixComponentTemplate

Note: component must be inited by initComponent method.

Return values
CBitrixComponentTemplate

getTemplateCachedData()

Function returns current template css files or null if there is no template.

public final getTemplateCachedData() : mixed

Note: component must be inited by initComponent method.

Tags
@return

array[string][int]string

getTemplateEmptyPreview()

public getTemplateEmptyPreview() : mixed

getTemplateName()

Function returns the name of the template

public final getTemplateName() : string

Note: component must be inited by initComponent method.

Return values
string

getTemplatePage()

Function returns the template page witch was set with initComponentTemplate

public final getTemplatePage() : string

Note: component must be inited by initComponent method.

Return values
string

includeComponent()

Function executes the component. Returns the result of it's execution.

public final includeComponent(string $componentTemplate, array<string|int, mixed> $arParams, CBitrixComponent|null $parentComponent[, mixed $returnResult = false ]) : mixed

Note: component must be inited by initComponent method.

Parameters
$componentTemplate : string
$arParams : array<string|int, mixed>
$parentComponent : CBitrixComponent|null
$returnResult : mixed = false

includeComponentClass()

Function includes class of the component by component name bitrix:component.base

public final static includeComponentClass(string $componentName) : string
Parameters
$componentName : string
Return values
string

includeComponentEpilog()

Function restores component epilog environment and executes it.

public final includeComponentEpilog(array[string] $arEpilogInfo) : void
Parameters
$arEpilogInfo : array[string]

includeComponentLang()

Function includes language files from within the component directory.

public final includeComponentLang([string $relativePath = "" ][, string|bool $lang = false ]) : void

For example: $this->includeComponentLang("ajax.php") will include "lang/en/ajax.php" file.

Note: component must be inited by initComponent method.

Parameters
$relativePath : string = ""
$lang : string|bool = false

includeComponentTemplate()

Function executes the template.

public final includeComponentTemplate([string $templatePage = "" ][, string $customTemplatePath = "" ]) : void

Note: component must be inited by initComponent method.

Parameters
$templatePage : string = ""
$customTemplatePath : string = ""

initComponent()

Function initializes the component. Returns true on success.

public final initComponent(string $componentName[, string|bool $componentTemplate = false ]) : bool

It is absolutly necessery to call this function before any component usage.

Parameters
$componentName : string
$componentTemplate : string|bool = false
Return values
bool

initComponentTemplate()

Function initializes the template of the component. Returns true on success.

public final initComponentTemplate([string $templatePage = "" ][, string|bool $siteTemplate = false ][, string $customTemplatePath = "" ]) : bool

Instansiates the template object and calls it's init function.

Note: component must be inited by initComponent method.

Parameters
$templatePage : string = ""
$siteTemplate : string|bool = false
$customTemplatePath : string = ""
Return values
bool

isCacheDisabled()

Check if cache disabled.

public isCacheDisabled() : bool
Return values
bool

isEnableCompatible()

Return state filling old keys in result data. This method makes no sense for the new components.

public isEnableCompatible() : bool
Return values
bool

isExtendedMode()

Check if extended mode is enabled.

public isExtendedMode() : bool
Return values
bool

isMergeProductWhenAddedBasket()

Should merge products when adding to the basket (increase the quantity of products)?

public isMergeProductWhenAddedBasket() : bool

If not exists parameter 'USE_MERGE_WHEN_ADD_PRODUCT_TO_BASKET' return true

Return values
bool

onIncludeComponentLang()

Event called from includeComponent before component execution.

public onIncludeComponentLang() : void

Includes component.php from within lang directory of the component.

onPrepareComponentParams()

Processing of component parameters.

public onPrepareComponentParams(array<string|int, mixed> $params) : mixed
Parameters
$params : array<string|int, mixed>

Raw component parameters values.

randString()

Function returns next pseudo random value.

public randString([int $length = 6 ]) : string
Parameters
$length : int = 6
Tags
see
RandomSequence::randString
Return values
string

sendJsonAnswer()

Send answer for AJAX request.

public static sendJsonAnswer([array<string|int, mixed> $result = [] ]) : void
Parameters
$result : array<string|int, mixed> = []

Ajax result.

setFrameMode()

Marks a component as capable of composite mode.

public setFrameMode(bool $mode) : void

You should use is to mark a whole component as composite incompatible.

Parameters
$mode : bool

setLanguageId()

public setLanguageId(string $languageId) : mixed
Parameters
$languageId : string

setResultCacheKeys()

Function marks the arResult keys to be saved to cache. Just like __sleep magic method do.

public final setResultCacheKeys(array[int] $arResultCacheKeys) : void

Note: it's call adds key, not replacing.

Parameters
$arResultCacheKeys : array[int]

setSiteId()

public setSiteId(string $siteId) : mixed
Parameters
$siteId : string

setSiteTemplateId()

public setSiteTemplateId(string $siteTemplateId) : mixed
Parameters
$siteTemplateId : string

setTemplateCachedData()

Function applies collection of the css files to the current template.

public final setTemplateCachedData(array[string][int] $templateCachedData) : void

Note: component must be inited by initComponent method.

Parameters
$templateCachedData : array[string][int]

setTemplateEpilog()

Function saves component epilog environment

public final setTemplateEpilog(array[string] $arEpilogInfo) : void
Parameters
$arEpilogInfo : array[string]

setTemplateName()

Function sets the name of the template. Returns true on success.

public final setTemplateName(string $templateName) : bool

Note: component must be inited by initComponent method.

Parameters
$templateName : string
Return values
bool

showComponentTemplate()

Function executes initialized template of the component.

public final showComponentTemplate() : void

Note: component must be inited by initComponent method.

startResultCache()

Function starts the caching block of the component execution.

public final startResultCache([int|bool $cacheTime = false ][, mixed $additionalCacheID = false ][, string|bool $cachePath = false ]) : string
Parameters
$cacheTime : int|bool = false
$additionalCacheID : mixed = false
$cachePath : string|bool = false
Return values
string

        
On this page

Search results