Main terminology
Introduction
Purpose of dynamic blocks is to waive the use of Bitrix components in their standard representation. In such cases, base (html) block content remains unchanged and content changes dynamically when generating a page. Software developers, same as before, can allocate components inside blocks. However, some issues exist due to this:
- block design now can be customized in editor,
- designer now can have access to executable PHP files, which isn't always permitted by project security regulations.
in terms of everything else, dynamic blocks have a single purpose: show dynamic content at Sites24 pages.
Source
Source - mechanism, implementing data retrieval from external entity (product module, database, third-party site and etc.).
Source consists of two parts:
- customizable filter/completed preset for data retrieval and data loader
- data loader.
Creating a source is available only within a module (not in init.php) because the module ID is necessary for building list of sources and getting limits.
Customizable filter for data selection
It's a form (component) with specified selection conditions with option to view the results, matching the conditions. Such form must return conditions of selection in a specified format - block filter.
Completed preset for data selection
Non-customizable (hardcoded) block filter.
Data loader
Standardized interface for getting data from a source. Loader for any source must be a descendant of base class for getting data and must implement the same set of public methods (see description for class \Bitrix\Landing\Source\DataLoader).
Source registration
To use a custom source, it must be registered. Registration - passing the description for the source in a specific format via event registration handler. Once the description has been successfully validated (checked) (see Data format) the source is considered as registered and can be selected for dynamic block.
Dynamic block
Contents of such block is not completed by an administrator, but is taken from a source. Changing the content is performed automatically when updating the data, returned by the source.
Variants for dynamic blocks
There are 2 options: list of elements and a detailed element page.
Element list settings:
- Source
- Block filter
- Data sorting
- Block elements (nodes) with the list of fields and source properties, suitable for the node
Details page settings:
- Binding to the list of elements (source selection and block filter are taken from there)
- Block elements (nodes) with the list of fields and source properties, suitable for the node