3namespace Bitrix\Iblock\BizprocType;
5use Bitrix\Bizproc\BaseType;
6use Bitrix\Bizproc\FieldType;
17 public static function getType()
19 return FieldType::STRING;
27 protected static function formatValuePrintable(FieldType $fieldType, $value)
29 $userType = static::getUserType($fieldType);
30 if (is_array($value) && isset($value[
'VALUE']))
33 if (!empty($userType[
'GetPublicViewHTML']))
36 $userType[
'GetPublicViewHTML'],
38 array(
'LINK_IBLOCK_ID' => $fieldType->getOptions()),
39 array(
'VALUE' => $value),
48 return parent::formatValuePrintable($fieldType, $value);
57 public static function convertTo(FieldType $fieldType, $value, $toTypeClass)
59 if (is_array($value) && isset($value[
'VALUE']))
64 if (class_exists(
'\Bitrix\Bizproc\BaseType\StringType'))
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();
86 public static function renderControlSingle(FieldType $fieldType,
array $field, $value, $allowSelection, $renderMode)
88 $selectorValue =
null;
95 $userType = static::getUserType($fieldType);
97 if (!empty($userType[
'GetPublicEditHTML']))
99 if (is_array($value) && isset($value[
'VALUE']))
102 $renderResult = call_user_func_array(
103 $userType[
'GetPublicEditHTML'],
106 'LINK_IBLOCK_ID' => $fieldType->getOptions(),
108 \Bitrix\Main\Application::getInstance()
116 'FORM_NAME' => $field[
'Form'],
117 'VALUE' => static::generateControlName($field)
124 $renderResult = static::renderControl($fieldType, $field, $value, $allowSelection, $renderMode);
128 $renderResult .= static::renderControlSelector($field, $selectorValue,
true,
'', $fieldType);
131 return $renderResult;
142 public static function renderControlMultiple(FieldType $fieldType,
array $field, $value, $allowSelection, $renderMode)
144 $selectorValue =
null;
145 $typeValue =
array();
146 if (!is_array($value) || is_array($value) && \CBPHelper::isAssociativeArray($value))
149 foreach ($value as $v)
157 $userType = static::getUserType($fieldType);
159 if (!empty($userType[
'GetPublicEditHTMLMulty']))
161 foreach ($typeValue as
$k => &$fld)
163 if (!is_array($fld) || !isset($fld[
'VALUE']))
164 $fld =
array(
'VALUE' => $fld);
165 if ($fld[
'VALUE'] ===
null)
166 unset($typeValue[
$k]);
168 $typeValue = array_values($typeValue);
170 $renderResult = call_user_func_array(
171 $userType[
'GetPublicEditHTMLMulty'],
173 array(
'LINK_IBLOCK_ID' => $fieldType->getOptions()),
176 'FORM_NAME' => $field[
'Form'],
177 'VALUE' => static::generateControlName($field)
187 if (empty($typeValue))
190 foreach ($typeValue as
$k => $v)
192 $singleField = $field;
193 $singleField[
'Index'] =
$k;
194 $controls[] = static::renderControlSingle(
203 $renderResult = static::wrapCloneableControls($controls, static::generateControlName($field));
208 $renderResult .= static::renderControlSelector($field, $selectorValue,
true,
'', $fieldType);
211 return $renderResult;
223 if (is_array($value) && isset($value[
'VALUE']))
226 $userType = static::getUserType($fieldType);
228 if (array_key_exists(
'GetLength', $userType))
230 if (call_user_func_array(
231 $userType[
'GetLength'],
233 array(
'LINK_IBLOCK_ID' => $fieldType->getOptions()),
234 array(
'VALUE' => $value)
242 if ($value !=
null && array_key_exists(
'CheckFields', $userType))
244 $errors = call_user_func_array(
245 $userType[
'CheckFields'],
247 array(
'LINK_IBLOCK_ID' => $fieldType->getOptions()),
248 array(
'VALUE' => $value)
255 static::addError(
array(
256 'code' =>
'ErrorValue',
258 'parameter' => static::generateControlName($field),
262 elseif ($value ===
'' && !array_key_exists(
'GetLength', $userType))
268 protected static function getUserType(FieldType $fieldType)
270 return \CIBlockProperty::getUserType(mb_substr($fieldType->getType(), 2));
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
static requireModule($moduleName)
static isExpression($text)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
HTMLToTxt($str, $strSiteUrl="", $aDelete=[], $maxlen=70)
extractValue(array $fieldProperties, $value)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)