• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/entitybankdetail.php
  • Класс: Bitrix\Crm\EntityBankDetail
  • Вызов: EntityBankDetail::prepareViewData
public function prepareViewData($fields, $fieldsInView = array(), $options = array())
{
	$optionValueHtml = false;
	$optionValueText = true;

	if (is_array($options) && isset($options['VALUE_HTML'])
		&& ($options['VALUE_HTML'] === 'Y' || $options['VALUE_HTML'] === true))
	{
		$optionValueHtml = true;
	}

	if (is_array($options) && isset($options['VALUE_TEXT']) &&
		!($options['VALUE_TEXT'] === 'Y' || $options['VALUE_TEXT'] === true))
	{
		$optionValueText = false;
	}
	else if ($optionValueHtml)
	{
		$optionValueText = false;
	}

	if (!is_array($fieldsInView))
		$fieldsInView = array();

	$result = array(
		'title' => '',
		'fields' => array()
	);

	$fieldsInfo = $this->getFormFieldsInfo();

	foreach ($fields as $fieldName => $fieldValue)
	{
		if ($fieldValue instanceof Main\Type\DateTime)
			$fieldValue = $fieldValue->toString();

		if ($fieldName === 'NAME')
		{
			$result['title'] = $fieldValue;
		}
		else
		{
			if (isset($fieldsInfo[$fieldName])
				&& (empty($fieldsInView) || in_array($fieldName, $fieldsInView, true)))
			{
				$fieldInfo = $fieldsInfo[$fieldName];
				$textValue = strval($fieldValue);

				$resultItem = array(
					'name' => $fieldName,
					'title' => $fieldInfo['title'],
					'type' => $fieldInfo['type'],
					'formType' => $fieldInfo['formType']
				);
				if ($optionValueText)
				{
					$resultItem['textValue'] = $textValue;
				}
				if ($optionValueHtml)
				{
					$resultItem['htmlValue'] = nl2br(htmlspecialcharsbx($textValue));
				}
				$result['fields'][] = $resultItem;
			}
		}
	}

	return $result;
}