• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/template/entity/elementproperty.php
  • Класс: BitrixIblockTemplateEntityElementProperty
  • Вызов: ElementProperty::loadFromDatabase
protected function loadFromDatabase()
{
	if (!isset($this->fields) && $this->iblockId > 0)
	{
		$this->fields = array();
		$this->fieldMap = array();

		$propertyList = CIBlockElement::getProperty(
			$this->iblockId,
			$this->id,
			array("sort" => "asc"),
			array("EMPTY" => "N")
		);
		while ($property = $propertyList->fetch())
		{
			if ($property["VALUE_ENUM"] != "")
			{
				$value = $property["VALUE_ENUM"];
			}
			elseif ($property["PROPERTY_TYPE"] === "E")
			{
				$this->elementLinkProperties[$property["ID"]] = $property["VALUE"];
				if ($property["CODE"] != "")
					$this->elementLinkProperties[mb_strtolower($property["CODE"])] = $property["VALUE"];
				$value = new ElementPropertyElement($property["VALUE"]);
			}
			elseif ($property["PROPERTY_TYPE"] === "G")
			{
				$this->sectionLinkProperties[$property["ID"]] = $property["VALUE"];
				if ($property["CODE"] != "")
					$this->sectionLinkProperties[mb_strtolower($property["CODE"])] = $property["VALUE"];
				$value = new ElementPropertySection($property["VALUE"]);
			}
			else
			{
				if($property["USER_TYPE"] <> '')
				{
					$value = new ElementPropertyUserField($property["VALUE"], $property);
				}
				else
				{
					$value = $property["VALUE"];
				}
			}

			$this->fieldMap[$property["ID"]] = $property["ID"];
			if ($property["CODE"] != "")
				$this->fieldMap[mb_strtolower($property["CODE"])] = $property["ID"];

			if ($property["MULTIPLE"] == "Y")
				$this->fields[$property["ID"]][] = $value;
			else
				$this->fields[$property["ID"]] = $value;
		}
	}
	return is_array($this->fields);
}