• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/contactcenter.php
  • Класс: BitrixIntranetContactCenter
  • Вызов: ContactCenter::prepareMarketplaceApps
private function prepareMarketplaceApps(array $marketplaceApps): array
{
	$result = [];

	$installedMarketplaceApps = $this->getInstalledMarketplaceApps();
	foreach ($marketplaceApps['ITEMS'] as $marketplaceApp)
	{
		$onclick = "BX.SidePanel.Instance.open('" . Marketplace::getMainDirectory() . "detail/{$marketplaceApp['CODE']}/')";
		if (isset($installedMarketplaceApps[$marketplaceApp['CODE']]))
		{
			$applicationId = $installedMarketplaceApps[$marketplaceApp['CODE']]['ID'];
			$appCode = $installedMarketplaceApps[$marketplaceApp['CODE']]['CODE'];
			$onclick = "new BX.ContactCenter.MarketplaceApp('{$applicationId}', '{$appCode}')";
		}

		$title = $marketplaceApp['NAME'];
		if (mb_strlen($title) > 50)
		{
			$title = mb_substr($title, 0, 50).'...';
		}

		$img = $marketplaceApp['ICON_PRIORITY'] ?: $marketplaceApp['ICON'];
		$img = str_replace(' ', '%20', $img);

		$result[$marketplaceApp['CODE']] = [
			"NAME" => $title,
			"LOGO_CLASS" => 'ui-icon intranet-contact-marketplace-app',
			"IMAGE" => $img,
			"ONCLICK" => $onclick,
			"SELECTED" => isset($installedMarketplaceApps[$marketplaceApp['CODE']]),
			"MARKETPLACE_APP" => true,
		];
	}

	BitrixMainTypeCollection::sortByColumn($result, ['SELECTED' => SORT_DESC]);

	return $result;
}