147 public static function createByUserType(
string $propertyType,
string $userType, array $propertyFields, ?
string $htmlName =
'USER_TYPE_SETTINGS'): self
149 $self =
new self($propertyType, $userType);
150 $userTypeFields = CIBlockProperty::GetUserType($userType);
152 $excludeSettingsHtmlUserTypes = [
157 isset($userTypeFields[
"GetSettingsHTML"])
158 && !in_array($userType, $excludeSettingsHtmlUserTypes,
true)
159 && is_callable($userTypeFields[
"GetSettingsHTML"])
163 $htmlCode = call_user_func_array(
164 $userTypeFields[
"GetSettingsHTML"],
174 if (!empty($htmlCode) && is_string($htmlCode))
176 $self->settingsHtml = $htmlCode;
179 if (isset($config[
'SHOW']) && is_array($config[
'SHOW']))
181 $self->appendShowedFields($config[
'SHOW']);
184 if (isset($config[
'HIDE']) && is_array($config[
'HIDE']))
186 $self->appendHiddenFields($config[
'HIDE']);
189 if (isset($config[
'SET']) && is_array($config[
'SET']))
191 $self->setValues = $config[
'SET'];
195 if (isset($userTypeFields[
"GetPropertyFieldHtml"]) && is_callable($userTypeFields[
"GetPropertyFieldHtml"]))
197 $htmlCode = call_user_func_array(
198 $userTypeFields[
"GetPropertyFieldHtml"],
202 'VALUE' => $propertyFields[
'DEFAULT_VALUE'] ??
null,
206 'VALUE' =>
'DEFAULT_VALUE',
208 'MODE' =>
'EDIT_FORM',
214 if (!empty($htmlCode) && is_string($htmlCode))
216 $self->defaultValueHtml = $htmlCode;
234 if (!empty($this->hiddenFields))
237 in_array($fieldName, $this->hiddenFields,
true)
238 && !in_array($fieldName, $this->showedFields,
true)