- Модуль: catalog
- Путь к файлу: ~/bitrix/modules/catalog/lib/component/baseform.php
- Класс: BitrixCatalogComponentBaseForm
- Вызов: BaseForm::getUserTypePropertyDescription
protected function getUserTypePropertyDescription(Property $property): array
{
$propertySettings = $this->getPropertySettings($property);
if ($property->getPropertyType() === 'S' && $property->getUserType() === 'HTML')
{
$defaultValue = $property->getDefaultValue();
if ($defaultValue)
{
if ($property->isMultiple())
{
foreach ($defaultValue as &$item)
{
$item = $item['TEXT'] ?? null;
}
}
else
{
$defaultValue = $defaultValue['TEXT'] ?? null;
}
}
return [
'type' => 'html',
'defaultValue' => $defaultValue,
];
}
$userTypeMethod = $propertySettings['PROPERTY_USER_TYPE'][self::USER_TYPE_METHOD] ?? null;
if ($userTypeMethod && is_callable($userTypeMethod))
{
$values = $property->getPropertyValueCollection()->getValues();
$description = $userTypeMethod($propertySettings, $values);
if ($property->getCode() === 'CML2_LINK')
{
$description['editable'] = false;
}
$specialTypes = ['custom', 'money', 'multimoney'];
if (in_array($description['type'], $specialTypes, true))
{
$name = static::preparePropertyNameFromProperty($property);
$descriptionData = $description['data'] ?? [];
if ($description['type'] === 'custom')
{
$descriptionData += $this->getCustomControlParameters($name);
}
elseif ($description['type'] === 'money' || $description['type'] === 'multimoney')
{
$descriptionData['affectedFields'] = [
$name . '[CURRENCY]',
$name . '[AMOUNT]',
];
$descriptionData['currency'] = [
'name' => $name . '[CURRENCY]',
'items' => $this->getCurrencyList(),
];
$descriptionData['amount'] = $name . '[AMOUNT]';
$descriptionData['currencyCode'] = $name . '[CURRENCY]';
$descriptionData['formatted'] = $name . '[FORMATTED_AMOUNT]';
$descriptionData['formattedWithCurrency'] = $name . '[FORMATTED_AMOUNT_WITH_CURRENCY]';
}
$description['data'] = $descriptionData;
}
if (empty($description['data']))
{
$description['data'] = [];
}
$description['data']['isProductProperty'] = true;
return $description;
}
return [];
}