• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Timeline/Item/Activity/OpenLine.php
  • Класс: Bitrix\Crm\Service\Timeline\Item\Activity\OpenLine
  • Вызов: OpenLine::getContentBlocks
public function getContentBlocks(): array
{
	$result = [];
	$userCode = $this->getAssociatedEntityModel()->get('PROVIDER_PARAMS')['USER_CODE'];

	$lineName = OpenLineManager::getLineTitle($userCode);
	if ($lineName)
	{
		$result['lineTitle'] = (new ContentBlockWithTitle())
			->setTitle(Loc::getMessage('CRM_TIMELINE_BLOCK_TITLE_NAME'))
			->setContentBlock((new Link())->setValue($lineName)->setAction($this->getOpenChatAction()))
			->setInline()
		;
	}

	$clientBlock = $this->buildClientBlock(Client::BLOCK_WITH_FIXED_TITLE);
	if (isset($clientBlock))
	{
		$result['client'] = $clientBlock;
	}

	$sourceList = [];
	$providerId = $this->getAssociatedEntityModel()->get('PROVIDER_ID');
	if ($providerId && $provider = CCrmActivity::GetProviderById($providerId))
	{
		$sourceList = $provider::getResultSources();
	}

	if (!empty($sourceList))
	{
		$connectorType = OpenLineManager::getLineConnectorType($userCode);
		$channelName = $sourceList[$connectorType] ?? $sourceList['livechat'];
		$result['chatTitle'] = (new ContentBlockWithTitle())
			->setTitle(Loc::getMessage('CRM_TIMELINE_BLOCK_TITLE_CHANNEL'))
			->setContentBlock(ContentBlockFactory::createTitle($channelName))
			->setInline()
		;
	}

	if (empty($result))
	{
		$subject = (string)$this->getAssociatedEntityModel()->get('SUBJECT');
		if (!empty($subject))
		{
			$result['subject'] = ContentBlockFactory::createTextOrLink(
				$subject,
				$this->getOpenChatAction()
			);
		}
	}

	$clientMarkBlock = $this->buildClientMarkBlock();
	if (isset($clientMarkBlock))
	{
		$result['clientMark'] = $clientMarkBlock;
	}

	return $result;
}