• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/controller/property.php
  • Класс: BitrixSaleControllerProperty
  • Вызов: Property::getCommonSettings
protected function getCommonSettings()
{
	$personType = $this->getPersonType($this->personTypeId);
	$groupOptions = $this->getPropertyGroupOptions();

	$commonSettings = [
		'PERSON_TYPE_ID' => [
			'TYPE' => 'NUMBER',
			'LABEL' => Loc::getMessage('SALE_PERS_TYPE'),
			'MIN' => 0,
			'STEP' => 1,
			'HIDDEN' => 'Y',
			'REQUIRED' => 'Y',
			'RLABEL' => $personType['NAME']
		],
		'PROPS_GROUP_ID' => [
			'TYPE' => 'ENUM',
			'LABEL' => Loc::getMessage('F_PROPS_GROUP_ID'),
			'OPTIONS' => $groupOptions
		],
		'NAME' => [
			'TYPE' => 'STRING',
			'LABEL' => Loc::getMessage('F_NAME'),
			'MAXLENGTH' => 255,
			'REQUIRED' => 'Y'
		],
		'CODE' => [
			'TYPE' => 'STRING',
			'LABEL' => Loc::getMessage('F_CODE'),
			'MAXLENGTH' => 50
		],
		'ACTIVE' => [
			'TYPE' => 'Y/N' ,
			'LABEL' => Loc::getMessage('F_ACTIVE'),
			'VALUE' => 'Y'
		],
		'UTIL' => [
			'TYPE' => 'Y/N',
			'LABEL' => Loc::getMessage('F_UTIL')
		],
		'USER_PROPS' => [
			'TYPE' => 'Y/N',
			'LABEL' => Loc::getMessage('F_USER_PROPS')
		],
		'IS_FILTERED' => [
			'TYPE' => 'Y/N',
			'LABEL' => Loc::getMessage('F_IS_FILTERED'),
			'DESCRIPTION' => Loc::getMessage('MULTIPLE_DESCRIPTION')
		],
		'SORT' => [
			'TYPE' => 'NUMBER',
			'LABEL' => Loc::getMessage('F_SORT'),
			'MIN' => 0,
			'STEP' => 1,
			'VALUE' => 100
		],
		'DESCRIPTION' => [
			'TYPE' => 'STRING',
			'LABEL' => Loc::getMessage('F_DESCRIPTION'),
			'MULTILINE' => 'Y',
			'ROWS' => 3,
			'COLS' => 40
		],
		'XML_ID' => [
			'TYPE' => 'STRING',
			'LABEL' => 'XML_ID',
			'MAXLENGTH' => 255,
		],
	];

	if (!empty($this->property['ID']))
	{
		$commonSettings = array_merge(
			[
				'ID' => [
					'TYPE' => 'NUMBER',
					'LABEL' => 'ID',
					'MIN' => 0,
					'STEP' => 1,
					'HIDDEN' => 'Y',
					'RLABEL' => $this->property['ID']
				]
			],
			$commonSettings
		);
	}

	$commonSettings += Manager::getCommonSettings($this->property, null );

	if (!empty($commonSettings['TYPE']['OPTIONS']))
	{
		foreach ($commonSettings['TYPE']['OPTIONS'] as $key => $option)
		{
			$commonSettings['TYPE']['OPTIONS'][$key] = mb_substr($option, 0, mb_strpos($option, '[') - 1);
		}
	}

	/*if (!$this->checkMultipleField($this->property))
	{
		$commonSettings['MULTIPLE']['DISABLED'] = 'Y';
		$commonSettings['MULTIPLE']['NO_DISPLAY'] = 'Y';
		unset($commonSettings['IS_FILTERED']['DESCRIPTION']);
	}*/

	$commonSettings['MULTIPLE']['DESCRIPTION'] = Loc::getMessage('MULTIPLE_DESCRIPTION');
	unset($commonSettings['VALUE']);

	$commonSettings['DEFAULT_VALUE'] = array(
			'REQUIRED' => 'N',
			'DESCRIPTION' => null,
			'VALUE' => $this->property['DEFAULT_VALUE'],
			'LABEL' => Loc::getMessage('F_DEFAULT_VALUE'),
		) + $this->property;

	if ($this->property['TYPE'] === 'ENUM')
	{
		$defaultOptions = $this->property['MULTIPLE'] === 'Y'
			? []
			: ['' => Loc::getMessage('NO_DEFAULT_VALUE')];

		if (!empty($this->property['VARIANTS']))
		{
			foreach ($this->property['VARIANTS'] as $row)
			{
				$defaultOptions[$row['VALUE']] = $row['NAME'];
			}
		}

		$commonSettings['DEFAULT_VALUE']['OPTIONS'] = $defaultOptions;
	}
	elseif ($this->property['TYPE'] === 'LOCATION')
	{
		if ($this->property['IS_LOCATION'] === 'Y' || $this->property['IS_LOCATION4TAX'] === 'Y')
		{
			unset($commonSettings['MULTIPLE']);
		}
	}

	return $commonSettings;
}