: 666 (Data available since 06.02.2017)
As a matter of fact, today own component may have to be written only when an absolutely new functionality for the website is needed. Since the set of standard components is quite extensive, in most cases just expanding the functionality of the already available components will suffice and there is no need to write new components.
However, sooner or later a developer must learn to create their own components.
Standard Sequence of Operations
Component Creation Procedure
Make the required php code into a separate file in order to use it later as an invoked file. However, the component must also be connected to the system using a description file identifiable by the core of Bitrix Framework. As a result, a user can see the icon with the component name in the visual editor and can set up the component properties.
Remember that a component consists of a php code with terminated functionality made into a separate file, a file of component registration in the system and its parameter descriptions, and also localization files.
- Component registration
- Detachment of a required php code into a separate file.
- Create the description file .description.php
- Locate files in a folder in the own namespace.
- Setting up parameters in the component code
- Prepare files with text constants for the component and registration file:
- make changes in the code of both files of the component in order to use these constants (the localization file is connected using the function IncludeTemplateLangFile).
Attention! All keys in $MESS containing the name, description, and parameters of the component and also the identifiers of component branches in the component tree of the visual editor must be unique for the entire product.