• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/component/selector/entity.php
  • Класс: BitrixIblockComponentSelectorEntity
  • Вызов: Entity::initEntitySettings
protected function initEntitySettings()
{
	$description = [
		'IBLOCK_ID' => null,
		'IBLOCK_NAME' => null,
		'IBLOCK_TYPE_ID' => null,
		'IBLOCK_SECTIONS' => 'N',
		'IBLOCK_SECTIONS_NAME' => null,
		'IBLOCK_ELEMENTS_NAME' => null,
		'SHOW_XML_ID' => (string)MainConfigOption::get('iblock', 'show_xml_id') === 'Y',
		'FILTER_ALL' => Loc::getMessage('ENTITY_SELECTOR_SLIDER_FILTER_EMPTY')
	];
	if ($this->arParams['IBLOCK_ID'] > 0)
	{
		$iterator = IblockIblockTable::getList([
			'select' => ['ID', 'IBLOCK_TYPE_ID', 'NAME'],
			'filter' => ['=ID' => $this->arParams['IBLOCK_ID'], '=ACTIVE' => 'Y']
		]);
		$iblock = $iterator->fetch();
		unset($iterator);
		if (!empty($iblock))
		{
			$description['IBLOCK_ID'] = $this->arParams['IBLOCK_ID'];
			$description['NAME'] = $iblock['NAME'];
			$iterator = IblockTypeTable::getList([
				'select' => ['ID', 'SECTIONS'],
				'filter' => ['=ID' => $iblock['IBLOCK_TYPE_ID']]
			]);
			$type = $iterator->fetch();
			unset($iterator);
			if (!empty($type))
			{
				$description['IBLOCK_TYPE_ID'] = $iblock['IBLOCK_TYPE_ID'];
				$description['IBLOCK_SECTIONS'] = $type['SECTIONS'];

				$iterator = IblockTypeLanguageTable::getList([
					'select' => ['IBLOCK_TYPE_ID', 'SECTIONS_NAME', 'ELEMENTS_NAME'],
					'filter' => ['=IBLOCK_TYPE_ID' => $iblock['IBLOCK_TYPE_ID'], '=LANGUAGE_ID' => LANGUAGE_ID]
				]);
				$messages = $iterator->fetch();
				unset($iterator);
				if (!empty($messages))
				{
					$description['IBLOCK_SECTIONS_NAME'] = $messages['SECTIONS_NAME'];
					$description['IBLOCK_ELEMENTS_NAME'] = $messages['ELEMENTS_NAME'];
				}
				unset($messages);
			}
			unset($type);
			$description['FILTER_ALL'] = Loc::getMessage('ENTITY_SELECTOR_SLIDER_FILTER_ALL_ELEMENTS');
		}
		unset($iblock);
	}
	$this->fillStorageNode(self::STORAGE_ENTITY_IBLOCK, $description);
	unset($description);
}