- Модуль: crmmobile
- Путь к файлу: ~/bitrix/modules/crmmobile/lib/CustomSections/TabSorter.php
- Класс: BitrixCrmMobileCustomSectionsTabSorter
- Вызов: TabSorter::sort
static function sort(array &$mCRMTabs, ?int $customSectionId): void
{
if (empty($mCRMTabs))
{
return;
}
$customSection = null;
if ($customSectionId !== null)
{
$customSection = IntranetManager::getCustomSectionByEntityTypeId($mCRMTabs[0]['id']);
$wTabsOrder = self::getCustomSectionTabsOrder($customSection);
}
else
{
$wTabsOrder = ControlPanelTabsSortHelper::getWebCrmTabsOrder();
}
if (empty($wTabsOrder))
{
return;
}
usort($mCRMTabs, static function ($tab1, $tab2) use ($wTabsOrder, $customSection) {
if ($customSection)
{
$tab1SortIndex = self::getCustomSectionTabSortIndex($tab1['id'], $wTabsOrder, $customSection);
$tab2SortIndex = self::getCustomSectionTabSortIndex($tab2['id'], $wTabsOrder, $customSection);
}
else
{
$tab1SortIndex = ControlPanelTabsSortHelper::getEntityTypeSortIndexInCTRPanelTabs(
$tab1['id'],
$wTabsOrder
);
$tab2SortIndex = ControlPanelTabsSortHelper::getEntityTypeSortIndexInCTRPanelTabs(
$tab2['id'],
$wTabsOrder
);
}
if ($tab1SortIndex === $tab2SortIndex)
{
return 0;
}
return ($tab1SortIndex < $tab2SortIndex) ? -1 : 1;
});
}