- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/classes/general/iblock.php
- Класс: CAllIBlock
- Вызов: CAllIBlock::fillUrlElementDataCache
static function fillUrlElementDataCache(int $id): void
{
if ($id <= 0)
{
return;
}
if (isset(self::$urlElementDataCache[$id]))
{
return;
}
$element = IblockElementTable::getRow([
'select' => [
'ID',
'IBLOCK_ID',
'CODE',
'XML_ID',
'IBLOCK_SECTION_ID',
],
'filter' => [
'=ID' => $id,
]
]);
if ($element !== null)
{
$element['ID'] = (int)$element['ID'];
$element['IBLOCK_ID'] = (int)$element['IBLOCK_ID'];
$element['CODE'] = (string)$element['CODE'];
$element['XML_ID'] = (string)$element['XML_ID'];
$element['IBLOCK_SECTION_ID'] = (int)$element['IBLOCK_SECTION_ID'];
$element['IBLOCK_SECTION_CODE'] = '';
$sectionId = $element['IBLOCK_SECTION_ID'];
if ($sectionId > 0)
{
if (!isset(self::$urlSectionDataCache[$sectionId]))
{
self::$urlSectionDataCache[$sectionId] = false;
$section = IblockSectionTable::getRow([
'select' => [
'ID',
'CODE',
],
'filter' => [
'=ID' => $sectionId,
'=IBLOCK_ID' => $element['IBLOCK_ID'],
]
]);
if ($section !== null)
{
$section['ID'] = (int)$section['ID'];
$section['CODE'] = (string)$section['CODE'];
self::$urlSectionDataCache[$sectionId] = $section;
}
}
if (!empty(self::$urlSectionDataCache[$sectionId]))
{
$element['IBLOCK_SECTION_CODE'] = self::$urlSectionDataCache[$sectionId]['CODE'];
}
}
self::$urlElementDataCache[$id] = $element;
}
else
{
self::$urlElementDataCache[$id] = false;
}
}