• Модуль: lists
  • Путь к файлу: ~/bitrix/modules/lists/lib/entity/field.php
  • Класс: BitrixListsEntityField
  • Вызов: Field::getFields
private function getFields()
{
	$fields = [];

	foreach ($this->params["FIELDS"] as $fieldId => $fieldValue)
	{
		if (!in_array($fieldId, $this->fieldList))
		{
			continue;
		}

		if (is_array($fieldValue))
		{
			$fieldValue = array_change_key_case($fieldValue, CASE_UPPER);
		}

		$fields[$fieldId] = $fieldValue;
	}

	if (!is_array($fields["LIST"]))
	{
		$fields["LIST"] = [];
	}
	if (!empty($fields["LIST_TEXT_VALUES"]))
	{
		$maxSort = 0;
		$listMap = array();
		foreach ($fields["LIST"] as $key => $enum)
		{
			if ($enum["SORT"] > $maxSort)
			{
				$maxSort = intval($enum["SORT"]);
			}
			$listMap[trim($enum["VALUE"], " tnr")] = $enum["ID"];
		}
		foreach (explode("n", $fields["LIST_TEXT_VALUES"]) as $valueLine)
		{
			$value = trim($valueLine, " tnr");
			if ((string) $value <> '' && !isset($listMap[$value]))
			{
				$maxSort += 10;
				$listMap[$value] = "m".$maxSort;
				$fields["LIST"]["m".$maxSort] = array(
					"SORT" => $maxSort,
					"VALUE" => $value,
				);
			}
		}
	}
	if (!empty($fields["LIST_DEF"]) && is_array($fields["LIST_DEF"]))
	{
		foreach ($fields["LIST"] as $key => $enum)
		{
			$fields["LIST"][$key]["DEF"] = "N";
		}
		foreach ($fields["LIST_DEF"] as $def)
		{
			$def = intval($def);
			if ($def > 0 && isset($fields["LIST"][$def]))
			{
				$fields["LIST"][$def]["DEF"] = "Y";
			}
		}
	}

	return $fields;
}