ChannelOpenLine::getResources

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. ChannelOpenLine
  4. getResources
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/sitebutton/channel/channelopenline.php
  • Класс: Bitrix\Crm\SiteButton\Channel\ChannelOpenLine
  • Вызов: ChannelOpenLine::getResources
static function getResources()
{
	if (!self::canUse())
	{
		return [];
	}

	//condition for changes in ui 18.5.5
	if (
		file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/js/ui/icons/service/ui.icons.service.css')
		&& file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/js/ui/icons/service/images/')
	)
	{
		$iconAssetPath = '/bitrix/js/ui/icons/service/ui.icons.service.css';
		$pathToIcons = '/bitrix/js/ui/icons/service/images/';

		$cssAssetIcons = new WebPacker\Resource\CssAsset($iconAssetPath);
		$content = str_replace(
			$pathToIcons,
			WebPacker\Builder::getDefaultSiteUri() . $pathToIcons,
			$cssAssetIcons->getContent()
		);
		$cssAssetIcons->setContent($content);

		$iconsBase = '/bitrix/js/ui/icons/base/ui.icons.base.css';
		$iconsB24 = '/bitrix/js/ui/icons/b24/ui.icons.b24.css';
		$iconsDisk = '/bitrix/js/ui/icons/disk/ui.icons.disk.css';
		$cssAssetIconsBase = new WebPacker\Resource\CssAsset($iconsBase);
		$cssAssetIconsB24 = new WebPacker\Resource\CssAsset($iconsB24);
		$cssAssetIconsDisk = new WebPacker\Resource\CssAsset($iconsDisk);

		$result = [
			$cssAssetIconsBase,
			$cssAssetIcons,
			$cssAssetIconsB24,
			$cssAssetIconsDisk
		];
	}
	else
	{
		$iconAssetPath = '/bitrix/js/ui/icons/ui.icons.css';
		$pathToIcons = '/bitrix/js/ui/icons/images/service/';

		$cssAssetIcons = new WebPacker\Resource\CssAsset($iconAssetPath);
		$content = str_replace(
			$pathToIcons,
			WebPacker\Builder::getDefaultSiteUri() . $pathToIcons,
			$cssAssetIcons->getContent()
		);
		$cssAssetIcons->setContent($content);
		$result = [$cssAssetIcons];
	}

	$cssCustomConnectors = ImConnector\CustomConnectors::getStyleCss();
	if ($cssCustomConnectors)
	{
		$result[] = (new WebPacker\Resource\CssAsset())->setContent($cssCustomConnectors);
	}

	return $result;
}

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