Last active
January 18, 2017 12:15
-
-
Save iredun/8a7d85433c524b9ebee117c7e5e5a983 to your computer and use it in GitHub Desktop.
Выводит инфоблоки в админке только текущего сайта (https://dev.1c-bitrix.ru/community/webdev/user/11948/blog/2692/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
AddEventHandler('main', 'OnBuildGlobalMenu', 'ASDOnBuildGlobalMenu'); | |
function ASDOnBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) | |
{ | |
$arSites = array( | |
'www.site.ru' => 's1', | |
'site.ru' => 's1', | |
); | |
$arIBsites = array(); | |
$rsIB = $GLOBALS['DB']->Query("SELECT * FROM b_iblock_site;"); | |
while ($arIB = $rsIB->Fetch()) | |
$arIBsites[$arIB['IBLOCK_ID']] = $arIB['SITE_ID']; | |
foreach ($aModuleMenu as $k => &$v) | |
{ | |
if($v['parent_menu']=='global_menu_content' && $v['module_id']=='iblock' && $v['page_icon']!='iblock_page_icon_settings') | |
{ | |
$cUnsets = 0; | |
$cAll = count($v['items']); | |
foreach ($v['items'] as $kk => $vv) | |
{ | |
$BID = array_pop(explode('/', $vv['items_id'])); | |
if ($arIBsites[$BID] != $arSites[$_SERVER['SERVER_NAME']]) | |
{ | |
unset($v['items'][$kk]); | |
$cUnsets++; | |
} | |
} | |
if ($cUnsets == $cAll) | |
unset($aModuleMenu[$k]); | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment