Views: 859 (Data available since 06.02.2017)
The needs of website owners are very diverse. The standard functionality of Bitrix Framework cannot resolve all tasks that may be set for the developer when it comes to creating Internet project. API must be used to implement non-standard tasks. API of infoblocks should be studied with special attention. They are most widely used in programming.
Attention! Direct database queries are strongly discouraged. In this case, the operation of system basic functions is not guaranteed. In addition, it may lead to data disintegration.
API of a module consists of several high-level functions to select data in the public section of a website and a set of classes with low level methods for a more specialized work.
Before using the module, please make sure it is installed and activate it using the following structure:
//here module functions and classes can be used
Functions with simple parameters and preset filters may be used to obtain data during display in the public section of the website. These functions select by default the values that are suitable for the sorting location, namely only those active, related to the current website, suitable in terms of access rights, etc.
All work with dates through API (insert, selection, filters, etc.) is done in the format of the current website or, if in the administrative part, in the format of the current language.
Some API functions are available at all times, i.e. described in the main module, and some functions depend on the module used and can be present or absence in different versions of the product.
For most classes of Bitrix Framework the following functions are available:
- Data selection (
- Adding a new element (
- Updating and deleting an element (
- Deleting an element (
- And other functions.
For most modules, a specialized class structure, event mechanism, and additional functions are available. In particular, for the module of Information blocks the description is provided for:
- All tables used in the database, including table fields.
- Classes for work with infoblock types, infoblocks, elements, sections, and fields.
- Events occurring when adding, changing, and deleting module objects.
- Functions that extend kernel possibilities.
- Means to create the userís forms for editing and the userís data types.
- Other information.
The lessons of this chapter will address some examples of using the API of information blocks.