- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/grid/task/row/content/crmfield.php
- Класс: BitrixTasksGridTaskRowContentCrmField
- Вызов: CrmField::prepare
public function prepare(): string
{
$row = $this->getRowData();
$parameters = $this->getParameters();
if (empty($row['UF_CRM_TASK']))
{
return Loc::getMessage('TASKS_GRID_TASK_ROW_CONTENT_CRM_FIELD_NOT_PRESENT') ?? '';
}
$collection = [];
foreach ($row['UF_CRM_TASK'] as $value)
{
[$type, $id] = explode('_', $value);
if ($type !== $parameters['CRM_FIELD_ID'])
{
continue;
}
$typeId = CCrmOwnerType::ResolveID(CCrmOwnerTypeAbbr::ResolveName($type));
$title = CCrmOwnerType::GetCaption($typeId, $id);
$url = CCrmOwnerType::GetEntityShowPath($typeId, $id);
if (!isset($collection[$type]))
{
$collection[$type] = [];
}
if ($title)
{
$safeTitle = htmlspecialcharsbx($title);
$collection[$type][] = "{$safeTitle}";
}
}
$html = [];
if ($collection)
{
$html[]= '';
foreach ($collection as $type => $items)
{
if (empty($items))
{
continue;
}
$html[] = implode(', ', $items);
$html[] = '
';
}
$html[]= '';
}
return implode('', $html);
}