Добрый день. Код компоненте меню, файла result_modifier.php
<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
if (!empty($arResult))
{
$obCache = new CPHPCache();
if ($obCache->InitCache($arParams['CACHE_TIME'], serialize($arFilter), "/template/menu"))
{
$arFormatted = $obCache->GetVars();
}
elseif ($obCache->StartDataCache())
{
\Bitrix\Main\Loader::includeModule("iblock");
if(defined("BX_COMP_MANAGED_CACHE"))
{
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache("/template/menu");
}
$arSections = array();
$arFilter = array('<=DEPTH_LEVEL'=> '3', 'ELEMENT_SUBSECTIONS' => 'Y');
$res = CIBlockSection::GetList(Array(), $arFilter, true);
while($arRes = $res->GetNext())
{
if(!$iblock_id) $iblock_id = $arRes['IBLOCK_ID'];
$arSections[$arRes['NAME'].'_'.$arRes['DEPTH_LEVEL'].'_'.$arRes['SECTION_PAGE_URL']] = $arRes;
$debug[] = $arRes;
}
$top_key = -1;
$sub_key = -1;
foreach($arResult as $key => $arItem):
$arItem['PARAMS']['ELEMENT_CNT'] = $arSections[$arItem['TEXT'].'_'.$arItem['DEPTH_LEVEL'].'_'.$arItem['LINK']]['ELEMENT_CNT'];
switch ($arItem["DEPTH_LEVEL"]):
case 1:
$top_key++;
$arFormatted[$top_key] = $arItem;
$sub_key = -1;
break;
case 2:
$sub_key++;
$arFormatted[$top_key]["ITEMS"][$sub_key] = $arItem;
break;
case 3:
if($sub_key >= 0)
{
$arFormatted[$top_key]["ITEMS"][$sub_key]["ITEMS"][] = $arItem;
}
break;
endswitch;
endforeach;
if(defined("BX_COMP_MANAGED_CACHE"))
{
if($iblock_id)$CACHE_MANAGER->RegisterTag("iblock_id_".$iblock_id);
$CACHE_MANAGER->EndTagCache();
}
$obCache->EndDataCache($arFormatted);
}
$arResult = $arFormatted;
}
echo "<pre style='text-align:left;'>";print_r($arResult);echo "</pre>";
?>
Помогите, пожалуйста.