Answer the question
In order to leave comments, you need to log in
How to hide empty sections from infoblock in Bitrix menu.section?
Goodnight. The task is as follows: you need to remove all empty sections from menu_ext (import of the bitrix:menu.sections component).
Component code:
https://pastebin.com/bXctZxLj
I already tried to add lines there
if(0 == $arSection["ELEMENT_CNT"])
{
//var_dump($arSection["ID"]);
unset($arSection["ID"]);
}
Answer the question
In order to leave comments, you need to log in
Well, as an example, just do not add to the array
while($arSection = $rsSections->GetNext())
{
if($arSection["ELEMENT_CNT"])
{
$arResult["SECTIONS"][] = array(
"ID" => $arSection["ID"],
"DEPTH_LEVEL" => $arSection["DEPTH_LEVEL"],
"~NAME" => $arSection["~NAME"],
"~SECTION_PAGE_URL" => $arSection["~SECTION_PAGE_URL"],
);
$arResult["ELEMENT_LINKS"][$arSection["ID"]] = array();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question