Views: 2132 (Data available since 06.02.2017)
All components are stored in the /bitrix/components/ folder. The system components are in the /bitrix/components/bitrix/ folder. The content of this folder is updated by the update system and must not be modified by users.
Note! Modifying the system component folder /bitrix/components/bitrix/ can have unpredictable effects.
Users can store their own components in any subfolder of /bitrix/components/, or in the /bitrix/components/ root.
The name of a subfolder in /bitrix/components/ is the component namespace. For example, all system components belong to the bitrix namespace. When creating a custom component, you should create a namespace and put custom components there.
For example, a system component news exists located in the bitrix namespace. If you need a custom news component implementing functions unavailable in the standard system component, you should create a namespace (subfolder) in /bitrix/components/ (for example, demo) and put the custom component news there. The two components news will be available in different namespaces: bitrix:news and demo:news; both of them will be shown in the component tree in the visual editor.
Names of the components are as follows identifier1.identifier2…. For example, catalog, catalog.list, catalog.section.element, etc. The names should be built hierarchically starting from the general term and ending with specific purpose of the component. For example,the component showing the list of goods of this group may have the name catalog.section.elements. The full name of the component is the name of the component indicating the namespace. The full name looks like name_space:component_name. For example, bitrix:catalog.list. If the component is located outside the namespace, the namespace will not be specified. For example, catalog.section.
In the most general terms, the component connects as follows:
componentName, // component name
componentTemplate, // component template, empty line if default template is used
arParams=array(), // parameters
The following preset variables are available inside the component (file component.php):
$componentName – full name of a component (e.g.: bitrix:news.list).
$componentTemplate – the template with which the component is retrieved.
$arParams – entry parameters of the component (i.e. parameters with which the component is retrieved). Parameters are also available by their names.
$componentPath – a path to the component from the website root (e.g.:
$parentComponentName – name of the parent component (empty if there is no parent).
$parentComponentPath –path to the parent component from the website root (empty if there is no parent).
$parentComponentTemplate – template of the parent component (empty if there is no parent).
$arResult — result, read/change. Affects the member of the component class with the same name.
$this — naturally a link to the current component retrieved (CBitrixComponent class object), all class methods can be used.
In addition, the variables
$APPLICATION, $USER, $DB are named as global in the component.