• Модуль: highloadblock
  • Путь к файлу: ~/bitrix/modules/highloadblock/classes/general/prop_directory.php
  • Класс: CIBlockPropertyDirectory
  • Вызов: CIBlockPropertyDirectory::getDefaultXmlId
static function getDefaultXmlId($identifier): ?string
{
	$result = null;
	$entity = HLHighloadBlockTable::compileEntity($identifier);
	$fields = $entity->getFields();
	if (isset($fields['UF_DEF']) && isset($fields['UF_XML_ID']))
	{
		$entityClassName = $entity->getDataClass();

		$select = ['ID', 'UF_XML_ID'];
		$order = [];
		if (isset($fields['UF_SORT']))
		{
			$select[] = 'UF_SORT';
			$order['UF_SORT'] = 'ASC';
		}
		if (isset($fields['UF_NAME']))
		{
			$select[] = 'UF_NAME';
			$order['UF_NAME'] = 'ASC';
		}
		$order['ID'] = 'ASC';

		$iterator = $entityClassName::getList([
			'select' => $select,
			'filter' => ['=UF_DEF' => 1],
			'order' => $order,
			'limit' => 1
		]);
		$row = $iterator->fetch();
		if (!empty($row))
			$result = $row['UF_XML_ID'];
		unset($row, $iterator);
		unset($entityClassName);
	}
	unset($fields, $entity);

	return $result;
}