UserFieldBase::formatValuePrintable

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. UserFieldBase
  4. formatValuePrintable
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/bizproc/fieldtype/userfieldbase.php
  • Класс: Bitrix\Crm\Integration\BizProc\FieldType\UserFieldBase
  • Вызов: UserFieldBase::formatValuePrintable
static function formatValuePrintable(FieldType $fieldType, $value)
{
	global $APPLICATION, $USER_FIELD_MANAGER;

	$sType = static::getUserType($fieldType);

	$arUserFieldType = $USER_FIELD_MANAGER->GetUserType($sType);
	$arUserField = array(
		'ENTITY_ID' => 'CRM_LEAD',
		'FIELD_NAME' => 'UF_XXXXXXX',
		'USER_TYPE_ID' => $sType,
		'SORT' => 100,
		'MULTIPLE' => $fieldType->isMultiple() ? 'Y' : 'N',
		'MANDATORY' => $fieldType->isRequired() ? 'Y' : 'N',
		'EDIT_FORM_LABEL' => $arUserFieldType['DESCRIPTION'],
		'VALUE' => $value,
		'USER_TYPE' => $arUserFieldType
	);
	if ($sType == 'iblock_element' || $sType == 'iblock_section')
	{
		$options = $fieldType->getOptions();
		if (is_array($options))
		{
			$arUserField['SETTINGS'] = $options;
		}
		else
		{
			$arUserField['SETTINGS']['IBLOCK_ID'] = $options;
		}
	}
	elseif ($sType == 'crm_status')
	{
		$options = $fieldType->getOptions();
		if (is_array($options))
		{
			$arUserField['SETTINGS'] = $options;
		}
		else
		{
			$arUserField['SETTINGS']['ENTITY_TYPE'] = $options;
		}
	}
	elseif ($sType == 'boolean' && ($value === 'Y' || $value === 'N'))
	{
		//Convert bizproc boolean values (Y/N) in to UF boolean values (1/0)
		$arUserField['VALUE'] = $value = ($value === 'Y') ? 1 : 0;
	}

	ob_start();
	$APPLICATION->IncludeComponent(
		'bitrix:system.field.view',
		$sType,
		array(
			'arUserField' => $arUserField,
			'bVarsFromForm' => false,
			'form_name' => "",
			'printable' => true,
			'FILE_MAX_HEIGHT' => 400,
			'FILE_MAX_WIDTH' => 400,
			'FILE_SHOW_POPUP' => true
		),
		false,
		array('HIDE_ICONS' => 'Y')
	);

	return HTMLToTxt(ob_get_clean());
}

Добавить комментарий