ChannelOpenLine::getConnectors

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. ChannelOpenLine
  4. getConnectors
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/sitebutton/channel/channelopenline.php
  • Класс: Bitrix\Crm\SiteButton\Channel\ChannelOpenLine
  • Вызов: ChannelOpenLine::getConnectors
static function getConnectors($lineId): array
{
	$nameList = ImConnector\Connector::getListConnectorReal(40);
	if (Manager::isWidgetSelectDisabled())
	{
		$connectors = [];
		$connectorList = ImConnector\Connector::getListConnectedConnector($lineId);
		$virtualId = 1;
		foreach ($connectorList as $connectorCode => $connectorName)
		{
			$connectors[$connectorCode] = [
				'id' => 'virtual:' . ($virtualId++),
				'url' => 'https://bitrix24.com/',
				'url_im' => 'https://bitrix24.com/',
				'name' => $connectorName,
				'connector_name' => $connectorName,
			];
		}
	}
	else
	{
		$connectors = ImConnector\Connector::infoConnectorsLine($lineId);
	}

	if (count($connectors) == 0)
	{
		return [];
	}

	$list = [];
	$iconCodeMap = ImConnector\Connector::getIconClassMap();
	foreach ($connectors as $code => $connector)
	{
		if (in_array($code, self::$excludedConnectors))
		{
			continue;
		}

		if (
			empty($connector['url'])
			&& empty($connector['url_im'])
			&& !in_array($code, self::$connectorWithGeneratedUrl)
		)
		{
			continue;
		}

		$id = str_replace('.', '-', $code);
		if (!empty($connector['name']))
		{
			$title = $connector['name'];
		}
		elseif (isset($nameList[$code]))
		{
			$title = $nameList[$code];
		}
		else
		{
			$title = $connector['connector_name'];
		}

		$list[] = [
			'id' => $id,
			'code' => $code,
			'icon' => $connector['icon'] ?? $iconCodeMap[$code],
			'title' => $title,
			'name' => $connector['connector_name'],
			'desc' => $connector['desc'] ?? $connector['name'],
			'url' => $connector['url_im'] ?? $connector['url']
		];
	}

	return $list;
}

Добавить комментарий