• Модуль: highloadblock
  • Путь к файлу: ~/bitrix/modules/highloadblock/lib/datamanager.php
  • Класс: BitrixHighloadblockDataManager
  • Вызов: DataManager::convertValuesBeforeSave
static function convertValuesBeforeSave($data, $userfields)
{
	$multiValues = array();

	foreach ($data as $k => $v)
	{
		if ($k == 'ID')
		{
			continue;
		}

		$userfield = $userfields[$k];

		if ($userfield['MULTIPLE'] == 'N')
		{
			$inputValue = array($v);
		}
		else
		{
			$inputValue = $v;
		}

		$tmpValue = array();

		foreach ($inputValue as $singleValue)
		{
			$tmpValue[] = static::convertSingleValueBeforeSave($singleValue, $userfield);
		}

		// write value back
		if ($userfield['MULTIPLE'] == 'N')
		{
			$data[$k] = $tmpValue[0];
		}
		else
		{
			// remove empty (false) values
			$tmpValue = array_filter($tmpValue, array('static', 'isNotNull'));

			$data[$k] = $tmpValue;
			$multiValues[$k] = $tmpValue;
		}
	}

	return array($data, $multiValues);
}