28 $name = (string)($params[
'NAME'] ??
'');
34 $type = $params[
'TYPE'] ??
null;
36 if (Types::RANGE === $type)
40 $params[
'min'] ??
null,
41 $params[
'max'] ??
null,
42 $params[
'step'] ??
null,
45 elseif (Types::MONEY === $type)
49 if (isset($params[
'CURRENCY_LIST']) && is_array($params[
'CURRENCY_LIST']))
52 foreach ($params[
'CURRENCY_LIST'] as $key => $value)
56 if (isset($value[
'NAME'], $value[
'VALUE']))
58 $currencyList[$value[
'NAME']] = $value[
'VALUE'];
62 trigger_error(
'Invalid currency list format', E_USER_WARNING);
68 $currencyList[$key] = $value;
75 if (isset($params[
'HTML_ENTITY']))
77 $config->setHtml($params[
'HTML_ENTITY'] ===
true);
80 elseif (Types::DROPDOWN === $type || Types::MULTISELECT === $type)
84 if (isset($params[
'items']) && is_array($params[
'items']))
86 $items = $params[
'items'];
88 elseif (isset($params[
'DATA'][
'ITEMS']))
90 foreach ($params[
'DATA'][
'ITEMS'] as $item)
92 $items[$item[
'VALUE']] = $item[
'NAME'];
96 $config =
new ListConfig($name, $items, $type);
98 elseif (Types::CUSTOM === $type)
102 if (isset($params[
'HTML']))
104 $config->setHtml((
string)$params[
'HTML']);
109 $config =
new Config($name, $type);
112 if (isset($params[
'PLACEHOLDER']))
114 $config->setPlaceholder((
string)$params[
'PLACEHOLDER']);
117 if (isset($params[
'DISABLED']))
119 $config->setDisabled(
120 is_bool($params[
'DISABLED']) ? $params[
'DISABLED'] : $params[
'DISABLED'] ===
'Y'