• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Display/Field.php
  • Класс: Bitrix\Crm\Service\Display\Field
  • Вызов: Field::getFormattedValue
public function getFormattedValue(
	$fieldValue,
	?int $itemId = null,
	?Options $displayOptions = null
)
{
	if ($displayOptions === null || $itemId === null)
	{
		return '';
	}

	$context = $this->getContext();

	if ($this->isKanbanContext())
	{
		return $this->getFormattedValueForKanban($fieldValue, $itemId, $displayOptions);
	}

	if ($this->isGridContext())
	{
		$value = $this->getFormattedValueForGrid($fieldValue, $itemId, $displayOptions);
		return $this->convertToString($value, $displayOptions);
	}

	if ($this->isExportContext())
	{
		$value = $this->getFormattedValueForExport($fieldValue, $itemId, $displayOptions);
		return $this->convertToString($value, $displayOptions);
	}

	if ($this->isMobileContext())
	{
		return $this->getFormattedValueForMobile($fieldValue, $itemId, $displayOptions);
	}

	throw new Exception('Unknown context: ' . $context);
}