• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/item/exporter/canonical.php
  • Класс: BitrixTasksItemExporterCanonical
  • Вызов: Canonical::exportTypeValue
protected function exportTypeValue($v, $item)
{
	if(Dictionary::isA($v)) // all dictionaries goes to arrays
	{
		return $v->toArray(); // todo: there also may be sub-objects inside, deal with them...
	}
	elseif(is_object($v))
	{
		if(Structure::isA($v))
		{
			return $v->get();
		}
		elseif($v instanceof DateTime)
		{
			// todo: it is better to export dates in ISO format, with timezone offset
			return $v->toString();
		}
		elseif(method_exists($v, 'toString'))
		{
			return (string) $v;
		}
		else
		{
			return null;
		}
	}
	elseif(is_array($v)) // arrays exported as-is // todo: there also may be sub-objects inside, deal with them...
	{
		return $v;
	}
	else
	{
		// todo: there may be a date represented as string, so we need to ask $item->getFieldController() about an actual type and then convert
		// todo: to ISO string if needed
		return (string) $v;
	}
}