• Модуль: highloadblock
  • Путь к файлу: ~/bitrix/modules/highloadblock/classes/general/prop_directory.php
  • Класс: CIBlockPropertyDirectory
  • Вызов: CIBlockPropertyDirectory::PrepareSettings
static function PrepareSettings($arProperty): array
{
	$size = 1;
	$width = 0;
	$multiple = "N";
	$group = "N";
	$directoryTableName = '';

	if (!empty($arProperty["USER_TYPE_SETTINGS"]) && is_array($arProperty["USER_TYPE_SETTINGS"]))
	{
		if (isset($arProperty["USER_TYPE_SETTINGS"]["size"]))
		{
			$size = (int)$arProperty["USER_TYPE_SETTINGS"]["size"];
			if ($size <= 0)
				$size = 1;
		}

		if (isset($arProperty["USER_TYPE_SETTINGS"]["width"]))
		{
			$width = (int)$arProperty["USER_TYPE_SETTINGS"]["width"];
			if ($width < 0)
				$width = 0;
		}

		if (isset($arProperty["USER_TYPE_SETTINGS"]["group"]) && $arProperty["USER_TYPE_SETTINGS"]["group"] === "Y")
			$group = "Y";

		if (isset($arProperty["USER_TYPE_SETTINGS"]["multiple"]) && $arProperty["USER_TYPE_SETTINGS"]["multiple"] === "Y")
			$multiple = "Y";

		if (isset($arProperty["USER_TYPE_SETTINGS"]["TABLE_NAME"]))
			$directoryTableName = (string)$arProperty["USER_TYPE_SETTINGS"]['TABLE_NAME'];
	}

	$extendedSettings = false;
	$result = array(
		'size' =>  $size,
		'width' => $width,
		'group' => $group,
		'multiple' => $multiple,
		'TABLE_NAME' => $directoryTableName
	);
	$defaultValue = '';
	if ($directoryTableName !== '')
	{
		$iterator = HLHighloadBlockTable::getList([
			'select' => ['ID'],
			'filter' => ['=TABLE_NAME' => $directoryTableName]
		]);
		$row = $iterator->fetch();
		if (!empty($row))
		{
			$defaultValue = self::getDefaultXmlId($row['ID']);
			if ($defaultValue !== null)
				$extendedSettings = true;
		}
		unset($row, $iterator);
	}

	if (!$extendedSettings)
		return $result;

	$arProperty['USER_TYPE_SETTINGS'] = $result;
	$arProperty['DEFAULT_VALUE'] = $defaultValue;

	return $arProperty;
}