• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Timeline/Item/LogMessage/Creation.php
  • Класс: Bitrix\Crm\Service\Timeline\Item\LogMessage\Creation
  • Вызов: Creation::getContentBlocks
public function getContentBlocks(): ?array
{
	$result = [];

	$assocEntityTypeId = $this->getModel()->getAssociatedEntityTypeId();
	if ($assocEntityTypeId === \CCrmOwnerType::Activity)
	{
		$subject = $this->getAssociatedEntityModel()->get('SUBJECT');
		if ($subject)
		{
			$result['subject'] = (new Link())
				->setValue($subject)
				->setAction(
					(new Action\JsEvent('Activity:View'))
						->addActionParamInt('activityId', $this->getModel()->getAssociatedEntityId())
				)
			;
		}

		$description = $this->getAssociatedEntityModel()->get('DESCRIPTION_RAW');
		if ($description)
		{
			$result['description'] = (new Text())->setValue(TruncateText($description, 128));
		}

		return $result;
	}

	$descriptionBlock = $this->getDescriptionBlock();
	if ($descriptionBlock)
	{
		$result['description'] = $descriptionBlock;
	}

	$legend = $this->getHistoryItemModel()->get('LEGEND');
	if ($legend)
	{
		$result['legend'] = (new Text())
			->setValue($legend);
	}

	$baseItem = $this->getHistoryItemModel()->get('BASE');
	if (is_array($baseItem))
	{
		$url = isset($baseItem['ENTITY_INFO']['SHOW_URL'])
			? new Uri($baseItem['ENTITY_INFO']['SHOW_URL'])
			: null;

		$result['baseItem'] = (new LineOfTextBlocks())
			->addContentBlock(
				'title',
				ContentBlockFactory::createTitle((string)$baseItem['CAPTION'])
			)
			->addContentBlock(
				'data',
				ContentBlockFactory::createTextOrLink(
					(string)$baseItem['ENTITY_INFO']['TITLE'],
					$url ? new Redirect($url) : null
				)->setIsBold(true)
			)
		;
	}

	return $result;
}