• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/grid/task/row/content/userfield/crm.php
  • Класс: BitrixTasksGridTaskRowContentUserFieldCrm
  • Вызов: Crm::prepare
public function prepare(): string
{
	$row = $this->getRowData();

	if (empty($row['UF_CRM_TASK']))
	{
		return Loc::getMessage('TASKS_GRID_TASK_ROW_CONTENT_USER_FIELD_CRM_NOT_PRESENT') ?? '';
	}

	sort($row['UF_CRM_TASK']);

	$collection = [];
	foreach ($row['UF_CRM_TASK'] as $value)
	{
		[$type, $id] = explode('_', $value);
		$typeId = CCrmOwnerType::ResolveID(CCrmOwnerTypeAbbr::ResolveName($type));
		$title = CCrmOwnerType::GetCaption($typeId, $id);
		$url = CCrmOwnerType::GetEntityShowPath($typeId, $id);

		if (!isset($collection[$typeId]))
		{
			$collection[$typeId] = [];
		}

		if ($title)
		{
			$safeTitle = htmlspecialcharsbx($title);
			$collection[$typeId][] = "{$safeTitle}";
		}
	}

	$html = [];
	if ($collection)
	{
		$html[] = '
'; $previousTypeId = null; foreach ($collection as $typeId => $items) { if (empty($items)) { continue; } $html[] = '
'; if ($typeId !== $previousTypeId) { $factory = Container::getInstance()->getFactory($typeId); $typeTitle = htmlspecialcharsbx($factory ? $factory->getEntityDescription() : ''); $html[] = "{$typeTitle}:"; } $html[] = implode(', ', $items); $html[] = '
'; $previousTypeId = $typeId; } $html[] = '
'; } return implode('', $html); }