Documentation

Component for rendering custom fields

Description

The main version 20.0.800 provides new API for rendering custom field controls.

Calling a component and its parameters are similar for all components, only component name is changed.

All components contain templates for desktop and mobile app, support option to change control's external appearance using standard template mechanism.

Components are deemed as system components and aren't displayed in the visual editor. They can be found in the site physical structure inside the folder /bitrix/components/bitrix/[component_name].

List of components

Component Description
iblock.field.sectionDesigned for rendering custom user fields iblock_section (list to iblock section) using new API.
iblock.field.elementDesigned for rendering user custom fields iblock_element (list to iblock element) using new API.

Additional

You can also use universal API:

$renderer = new \Bitrix\Iblock\UserField\Renderer($userField, $additionalParameters);
return $renderer->render();

Parameters

ParameterDescription
$userFieldArray with user field metainformation. Can be retrieved by епу method GetUserFields of class CUserTypeManager.
$additionalParametersArray containing necessary settings depending on template that shows control. Specifically, this array passes the following elements:
  • mode - component template name;
  • mediaType - template page name, currently or .default, or mobile. Empty value is equivalent to .default.

Example of component call iblock.field.section

<?
$APPLICATION->IncludeComponent(
            'bitrix:iblock.field.section',
            '',
            [
                'userField' => $userField,
                'additionalParameters' => $additionalParameters,
            ]
        );
?>
© «Bitrix24», 2001-2024
Up