28 public static function getPublicView($arUserField, $arAdditionalParameters = array())
30 $value = static::getFieldValue($arUserField, $arAdditionalParameters);
32 $arUserField[
'VALUE'] = $value;
34 return static::getApplication($arUserField, array(),
'view');
37 public static function getPublicEdit($arUserField, $arAdditionalParameters = array())
39 $fieldName = static::getFieldName($arUserField, $arAdditionalParameters);
40 $value = static::getFieldValue($arUserField, $arAdditionalParameters);
42 $arUserField[
'VALUE'] = $value;
44 return static::getApplication($arUserField, array(
59 protected static function getApplication($arUserField, $arHtmlControl, $mode =
'edit')
63 $fieldName = $arHtmlControl[
'NAME'];
64 $value = static::normalizeFieldValue($arUserField[
'VALUE']);
67 $currentPlacementHandler =
null;
68 foreach($placementHandlerList as $placementInfo)
72 $currentPlacementHandler = $placementInfo;
78 if($currentPlacementHandler !==
null)
84<div style=
"display: none;" id=
"uf_rest_value_<?=$arUserField['FIELD_NAME']?>">
86 foreach($value as $res):
88 <input type=
"hidden" name=
"<?=$fieldName?>" value=
"<?=HtmlFilter::encode($res)?>" />
95 $placementSid = $APPLICATION->includeComponent(
99 'ID' => $currentPlacementHandler[
'APP_ID'],
100 'PLACEMENT_ID' => $currentPlacementHandler[
'ID'],
101 'PLACEMENT' => UserFieldType::PLACEMENT_UF_TYPE,
102 'SHOW_LOADER' =>
'N',
104 'PLACEMENT_OPTIONS' => array(
106 'ENTITY_ID' => $arUserField[
'ENTITY_ID'],
107 'FIELD_NAME' => $arUserField[
'FIELD_NAME'],
108 'ENTITY_VALUE_ID' => $arUserField[
'ENTITY_VALUE_ID'],
109 'VALUE' => $arUserField[
'MULTIPLE'] ===
'N' ? $value[0] : $value,
110 'MULTIPLE' => $arUserField[
'MULTIPLE'],
111 'MANDATORY' => $arUserField[
'MANDATORY'],
112 'XML_ID' => $arUserField[
'XML_ID'],
115 'FRAME_HEIGHT' =>
'200px',
119 array(
'HIDE_ICONS' =>
'Y')
126 new BX.rest.UserField(
'<?=$placementSid?>', {
127 value: <?=\CUtil::phpToJsObject($arUserField[
'VALUE'])?>,
128 callback:
function(value)
131 if($mode ===
'edit'):
133 if(!
BX.type.isArray(value))
139 for(var i = 0; i < value.length; i++)
141 html +=
'<input type="hidden" name="<?=$fieldName?>" value="'+
BX.util.htmlspecialchars(value[i])+
'" />';
144 BX(
'uf_rest_value_<?=$arUserField['FIELD_NAME
']?>').innerHTML = html;
146 var input =
BX(
'uf_rest_value_<?=$arUserField['FIELD_NAME
']?>').firstChild;
149 BX.fireEvent(input,
'change');
161 $html = ob_get_clean();
164 \CJSCore::init(array(
'rest_userfield'));
166 return static::getHelper()->wrapDisplayResult($html);