Custom controller implementation

Standard iblock REST controller \Bitrix\Iblock\Controller\DefaultElement includes the following methods:

getElementEntityAllowedListPermitted iblock fields \Bitrix\Iblock\ElementTable::getMap. They are selected by default, if the query didn't indicate select.
getAllowedListList of permitted fields for retrieval. Iblock fields from method getElementEntityAllowedList and all iblock properties are permitted by default. If you want to use other fields and especially relations, you need to list all IDs in this parameter.
getActionGets a single element by ID.
listActionGets several elements.

Allows to create a full controller, as well as inherit from standard controller with redefining necessary methods.

After describing your own controller class, register it in the Service locator Service locator is a design template for convenient use of app services.

Learn more here: Bitrix Framework.
with identifier iblock.element.{IBLOCK_API_CODE}.rest.controller, where {IBLOCK_API_CODE} - API symbolic code value (API_CODE) of your iblock. For example:

By default, controller operate only within REST context. Starting from version 20.100.200, you can access public unlimited access to iblock data via AJAX-controller mechanism. To do it, you need to clear all pre-filters:

class MyElement extends \Bitrix\Iblock\Controller\DefaultElement
    protected function getDefaultPreFilters()
        return [];

© «Bitrix24», 2001-2024