Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddEventHandler('main', 'OnBuildGlobalMenu', function(&$globalMenu, &$moduleMenu)
- {
- global $USER;
- if ($USER->IsAdmin())
- {
- return;
- }
- $hideSections = [
- 'global_menu_services',
- 'global_menu_marketing'
- ];
- $hideTitles = [
- 'Настройка информационных блоков'
- ];
- foreach ($globalMenu as $section => $item)
- {
- $isHide = in_array($section, $hideSections);
- // Было бы неплохо добавить к переменной $isHide еще и проверку попадания в массив $hideTitles.
- if ($isHide)
- {
- unset($globalMenu[$section]);
- }
- }
- foreach ($moduleMenu as $name => $item)
- {
- $section = $item['parent_menu'];
- $title = $item['title'];
- $isHide = in_array($section, $hideSections) || in_array($title, $hideTitles);
- if ($isHide)
- {
- unset($moduleMenu[$key]);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement