Component for rendering UF-field
Component class
The class must be descendant of BaseUfComponentand implement the method getUserTypeId that returns a field type ID to be handled by specific component.
Component name
Component names are generated as per the following principle:
<moduleName>.field.<componentName>
For example, main.field.string.
Component operation details
- Currently there are two available variants to render a field:
- desktop
- mobile app (tablet, phone and etc.)
Component's
MEDIA_TYPE
is responsible for this option (type's name inside a template). Accordingly, it can be specified either in the template .default, or into mobile. When required, additionalMEDIA_TYPE
can be added. WhenMEDIA_TYPE
is not specified, it uses .default.php type. - Also,
MODE
(template name) can be specified. The component uses the .default template, whenMODE
is not specified or the template with such name is missing in a specific component. It means there is not need to create template for all types of fields and only necessary field types are enough. Default template will be used for the rest of templates. You can pass an array of required templates listed by their priority and the component will select the closest existing template. - The same applied to the
MEDIA_TYPE
(type) inside theMODE
(template). When indicated type is missing, a default type is going to be used, specifically the .default.php. When such type is missing and the template itself is nonexistent, a standard error is printed, for example,Cannot find 'main.view' template with page '.default'
.
Main templates for existing UF-fields
- .default
- main.view - field value rendering, specifically it applies in CRM entities;
- main.edit - field control rendering in the editing mode. Specifically applies in CRM entities;
- main.public_text - gets printed field value. For example, for substituting to email templates;
- main.filter_html - getting controls for old filter in the admin section;
- main.edit_form - editing field in the admin section;
- main.admin_settings - field configuration block;
- main.admin_list_edit_html - field rendering in the edit mode in admin section grids;
- main.admin_list_view_html - field rendering in the display mode in admin section grids.
Additional information
© «Bitrix24», 2001-2024