A
A
Alexey-V2021-12-10 17:02:10
1C-Bitrix
Alexey-V, 2021-12-10 17:02:10

How to access a specific menu item?

Good day. I have a question that I can’t find an answer to in the search, or the solution method is the one that I already know, but I can’t use it. The problem is that you can not use the extended mode. How to access a specific menu item and apply an authorization check to it, if the user is not authorized then styles are applied?

<?if ($arItem["DEPTH_LEVEL"] == 1):?>
        <li><a href="" class="<?if ($arItem["SELECTED"]):?>root-item-selected<?else:?>root-item<?endif?>"
         <?if (!$USER->isAuthorized()):?>style="color: #00ff43;" <?endif?> 
        title="<?=GetMessage("MENU_ITEM_ACCESS_DENIED")?>"><?=$arItem["TEXT"]?></a></li>
      <?else:?>
        <li><a href="" class="denied" title="<?=GetMessage("MENU_ITEM_ACCESS_DENIED")?>"><?=$arItem["TEXT"]?></a></li>
      <?endif?>


I tried everything, but not what is needed is happening, or the parents are affected or without descendants, but one is needed

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