M
M
Michael Kim2021-04-03 19:57:03
API
Michael Kim, 2021-04-03 19:57:03

How to display menu items via API?

Is it possible to display the menu items for the current request?

you need something like:

/**
 * @var $curPage string url of current page
 * @var $menuType string type of menu
**/
function getMenuItems($curPageUrl, $menuType)
{
$result = [];
    // ... здесь запрос на 
return $result;
}


Is it possible to implement this?
CMain::GetMenu
$obMenu = $APPLICATION->GetMenu(
'left',
true,
false,
'/'
); // object(CMenu)#72 (9) { ["type"]=> string(7) "footer2" ["arMenu"]=> array(0) { } ["bMenuCalc"]=> bool(false) ["MenuDir"]=> string(1) "/" ["MenuExtDir"]=> string(0) "" ["MenuTemplate"]=> string(0) "" ["template"]=> string(0) "" ["LAST_ERROR"]=> string(0) "" ["debug"]=> NULL }


The key of interest is 'arMenu', where the menu items appear.
Whether this method solves my problem - I don’t understand, because I haven't gotten the desired result yet.
I ask you to help experts, can anyone solve a similar problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question