10if (Loader::requireModule(
'bizproc'))
12 class UserTypeProperty
extends BaseType\Base
17 public static function getType()
19 return FieldType::STRING;
27 protected static function formatValuePrintable(FieldType $fieldType, $value)
29 $userType = static::getUserType($fieldType);
31 $value = $value[
'VALUE'];
33 if (!
empty($userType[
'GetPublicViewHTML']))
36 $userType[
'GetPublicViewHTML'],
38 array(
'LINK_IBLOCK_ID' => $fieldType->getOptions()),
39 array(
'VALUE' => $value),
45 $result = str_replace(
'<a href="">',
'<a>', $result);
48 return parent::formatValuePrintable($fieldType, $value);
57 public static function convertTo(FieldType $fieldType, $value,
$toTypeClass)
60 $value = $value[
'VALUE'];
62 $value = (string) $value;
65 return BaseType\StringType::convertTo($fieldType, $value,
$toTypeClass);
66 return BaseType\String::convertTo($fieldType, $value,
$toTypeClass);
73 public static function getConversionMap()
75 return BaseType\StringType::getConversionMap();
89 if (\CBPActivity::isExpression($value))
95 $userType = static::getUserType($fieldType);
97 if (!
empty($userType[
'GetPublicEditHTML']))
100 $value = $value[
'VALUE'];
103 $userType[
'GetPublicEditHTML'],
106 'LINK_IBLOCK_ID' => $fieldType->getOptions(),
116 'FORM_NAME' => $field[
'Form'],
117 'VALUE' => static::generateControlName($field)
146 if (!
is_array($value) ||
is_array($value) && \CBPHelper::isAssociativeArray($value))
147 $value =
array($value);
149 foreach ($value
as $v)
151 if (\CBPActivity::isExpression(
$v))
157 $userType = static::getUserType($fieldType);
159 if (!
empty($userType[
'GetPublicEditHTMLMulty']))
165 if (
$fld[
'VALUE'] ===
null)
171 $userType[
'GetPublicEditHTMLMulty'],
173 array(
'LINK_IBLOCK_ID' => $fieldType->getOptions()),
176 'FORM_NAME' => $field[
'Form'],
177 'VALUE' => static::generateControlName($field)
194 $controls[] = static::renderControlSingle(
203 $renderResult = static::wrapCloneableControls($controls, static::generateControlName($field));
222 $value = parent::extractValue($fieldType, $field, $request);
224 $value = $value[
'VALUE'];
226 $userType = static::getUserType($fieldType);
231 $userType[
'GetLength'],
233 array(
'LINK_IBLOCK_ID' => $fieldType->getOptions()),
234 array(
'VALUE' => $value)
245 $userType[
'CheckFields'],
247 array(
'LINK_IBLOCK_ID' => $fieldType->getOptions()),
248 array(
'VALUE' => $value)
251 if (
sizeof($errors) > 0)
254 foreach ($errors
as $e)
255 static::addError(
array(
256 'code' =>
'ErrorValue',
258 'parameter' => static::generateControlName($field),
268 protected static function getUserType(FieldType $fieldType)
270 return \CIBlockProperty::getUserType(
mb_substr($fieldType->getType(), 2));
extractValue(array $fieldProperties, $value)