• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/component/selector/entity.php
  • Класс: BitrixIblockComponentSelectorEntity
  • Вызов: Entity::prepareResult
protected function prepareResult()
{
	$this->initClientScope();

	$this->getData();

	$filter = [];
	if ($this->isUsedGridFilter())
	{
		$entityFilter = MainFilterFactory::createEntityFilter(
			IblockFilterEntityList::ELEMENT,
			[
				'ID' => $this->getFilterId(),
				'IBLOCK_ID' => $this->getStorageItem(self::STORAGE_ENTITY_IBLOCK, 'IBLOCK_ID')
			]
		);

		$usedFields = $this->gridFilterConfig->getUsedFields();
		if(empty($usedFields))
		{
			$usedFields = $entityFilter->getDefaultFieldIDs();
		}

		$filter = [
			'FILTER_ID' => $this->getFilterId(),
			'GRID_ID' => $this->getGridId(),
			'FILTER' => $entityFilter->getFieldArrays($usedFields),
			'FILTER_PRESETS' => [],
			'DISABLE_SEARCH' => $this->getQuickSearchField() === null,
			'ENABLE_LABEL' => true,
			'ENABLE_LIVE_SEARCH' => true,
			'LAZY_LOAD' => [
				'CONTROLLER' => [
					'getList' => 'iblock.filter.element.getlist',
					'getField' => 'iblock.filter.element.getfield',
					'componentName' => $this->getName(),
					'signedParameters' => BitrixMainComponentParameterSigner::signParameters(
						$this->getName(),
						[
							'IBLOCK_ID' => $this->getStorageItem(self::STORAGE_ENTITY_IBLOCK, 'IBLOCK_ID')
						]
					)
				]
			]
		];
	}

	$grid = [
		'GRID_ID' => $this->getGridId(),
		'COLUMNS' => array_values($this->getColumns()),

		'NAV_OBJECT' => $this->navigation,
		'~NAV_PARAMS' => ['SHOW_ALWAYS' => false],
		'SHOW_ROW_CHECKBOXES' => $this->arParams['MULTIPLE_SELECT'],
		'SHOW_GRID_SETTINGS_MENU' => true,
		'SHOW_PAGINATION' => true,
		'SHOW_PAGESIZE' => true,
		'SHOW_SELECTED_COUNTER' => $this->arParams['MULTIPLE_SELECT'],
		'SHOW_TOTAL_COUNTER' => true,
		//'ACTION_PANEL' => $controlPanel,
		"TOTAL_ROWS_COUNT" => $this->navigation->getRecordCount(),

		'ALLOW_COLUMNS_SORT' => true,
		'ALLOW_COLUMNS_RESIZE' => true,
		'ALLOW_SORT' => true,
		'AJAX_MODE' => 'Y',
		'AJAX_OPTION_JUMP' => 'N',
		'AJAX_OPTION_STYLE' => 'N',
		'AJAX_OPTION_HISTORY' => 'N'
	];
	if ($this->isUsedImplicitPageNavigation())
		$grid['NAV_STRING'] = $this->navigationString;

	$grid['PAGE_SIZES'] = [];
	foreach ($this->getPageSizes() as $size)
	{
		$grid['PAGE_SIZES'][] = [
			'NAME' => (string)$size,
			'VALUE' => $size
		];
	}
	unset($size);

	$grid['SORT'] = $this->getStorageItem(self::STORAGE_GRID, 'GRID_ORDER');
	$grid['SORT_VARS'] = $this->getStorageItem(self::STORAGE_GRID, 'GRID_ORDER_VARS');

	$grid['ROWS'] = $this->getGridRows();

	$settings = [
		'USE_MODE' => $this->getUseMode(),
		'RESULT_ACTION' => $this->resultAction,
		'FILTER' => [
			'PAGETITLE' => $this->arParams['PAGETITLE_FILTER']
		]
	];

	$this->arResult = [
		'FILTER' => $filter,
		'GRID' => $grid,
		'SETTINGS' => $settings
	];
	unset($grid, $filter);
}