• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/publicaction/utils.php
  • Класс: BitrixLandingPublicActionUtils
  • Вызов: Utils::getCatalogEntity
static function getCatalogEntity($entityId, $entityType)
{
	$result = null;
	$entityId = (int)$entityId;

	if (Loader::includeModule('iblock'))
	{
		$isElement = $entityType == self::TYPE_CATALOG_ELEMENT;
		if ($isElement)
		{
			$res = CIBlockElement::getList(
				array(),
				array(
					'ID' => $entityId,
					'CHECK_PERMISSIONS' => 'Y'
				),
				false,
				array(
					'nTopCount' => 1
				),
				array(
					'ID', 'NAME', 'DETAIL_PICTURE', 'IBLOCK_SECTION_ID'
				)
			);
		}
		else
		{
			$res = CIBlockSection::getList(
				array(),
				array(
					'ID' => $entityId,
					'CHECK_PERMISSIONS' => 'Y'
				),
				false,
				array(
					'ID', 'NAME', 'IBLOCK_SECTION_ID'
				),
				array(
					'nTopCount' => 1
				)
			);
		}
		if ($entity = $res->fetch())
		{
			$chain = array();
			static::makeCatalogEntityNavChain(
				$entity['IBLOCK_SECTION_ID'],
				$chain
			);
			$result = array(
				'id' => $entity['ID'],
				'name' => $entity['NAME'],
				'sectionId' => $entity['IBLOCK_SECTION_ID'],
				'image' => $isElement
							? CFile::getPath($entity['DETAIL_PICTURE'])
							: '',
				'type' => self::TYPE_CATALOG,
				'subType' => $entityType,
				'chain' => $chain
			 );
		}
	}

	return $result;
}