Documentation

Component

\Bitrix\Main\Engine\Response\Component - methods for handling components.

When component must be loaded in ajax, you need use action to return \Bitrix\Main\Engine\Response\Component. Constructor signature matches with $APPLICATION->IncludeComponent($name, $template, $parameters)

new \Bitrix\Main\Engine\Response\Component('bitrix:disk.file.view', '', [
    'FILE_ID' => $fileId,            
]);

Generates response for component:

{
    "status": string,
    "data": {
      "html": string,
        "assets": {
            "css": array,
            "js": array,
            "string": array
        },
      "additionalParams": array      
    },
    "errors": array
}

Methods

Method Description Available from version
__construct(
   $componentName,
   $componentTemplate = '',
   array $componentParams = [],
   array $additionalResponseParams = [],
   $dataKeys = []
)
Constructor method. Parameters:
  • $componentName {string} component name, for example, "bitrix:disk.file.view".
  • $componentTemplate {string} - component template name, default value: ".default".
  • $componentParams {array} - array with component parameters, empty array by default.
  • $additionalResponseParams {array} - array, passed in JSON response by separate key. Convenient for use, if you need to print associative data with component.
  • $dataKeys {array} - array that lists all keys of component arResult, which must be returned in JSON response.

© «Bitrix24», 2001-2024
Up