- Модуль: catalog
- Путь к файлу: ~/bitrix/modules/catalog/lib/component/baseform.php
- Класс: BitrixCatalogComponentBaseForm
- Вызов: BaseForm::getUserFieldDescriptions
protected function getUserFieldDescriptions(): array
{
$filter = [
'=ENTITY_ID' => ProductTable::getUfId(),
];
$allSystemFields = ProductSystemField::getFieldNamesByRestrictions([]);
if (!empty($allSystemFields))
{
$filter['!@FIELD_NAME'] = $allSystemFields;
}
$result = [];
$iterator = UserFieldTable::getList([
'select' => array_merge(
['*'],
UserFieldTable::getLabelsSelect()
),
'filter' => $filter,
'order' => [
'SORT' => 'ASC',
'ID' => 'ASC',
],
'runtime' => [
UserFieldTable::getLabelsReference('', Loc::getCurrentLang()),
],
]);
while ($row = $iterator->fetch())
{
$description = [
'entity' => 'product',
'name' => $row['FIELD_NAME'],
'originalName' => $row['FIELD_NAME'],
'title' => $row['EDIT_FORM_LABEL'] ?? $row['FIELD_NAME'],
'hint' => $row['HELP_MESSAGE'],
'type' => $this->getUserFieldType($row),
'editable' => true,
'required' => $row['MANDATORY'] === 'Y',
'multiple' => $row['MULTIPLE'] === 'Y',
'placeholders' => null,
'defaultValue' => $row['SETTINGS']['DEFAULT_VALUE'] ?? '',
'optionFlags' => 1, // showAlways
'options' => [
'showCode' => 'true',
],
'data' => [],
];
switch ($description['type'])
{
case ControlType::CUSTOM:
$description['data'] += $this->getCustomControlParameters($description['name']);
break;
case ControlType::MULTI_LIST:
case ControlType::LIST:
$description['data'] += $this->getUserFieldListItems($row);
break;
}
$result[] = $description;
}
return $result;
}