public function __construct($iblock_id, $field_id, $label, $sort) { parent::__construct($iblock_id, $field_id, $label, $sort); //Cache iblock metadata in order to reduce queries if (!array_key_exists($this->_iblock_id, self::$prop_cache)) { self::$prop_cache[$this->_iblock_id] = array(); $rsProperties = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $this->_iblock_id, "CHECK_PERMISSIONS" => "N", "ACTIVE" => "Y")); while ($arProperty = $rsProperties->Fetch()) { self::$prop_cache[$this->_iblock_id][$arProperty["ID"]] = $arProperty; } } //init from cache if (preg_match("/^PROPERTY_(\\d+)\$/", $field_id, $match) && array_key_exists($match[1], self::$prop_cache[$this->_iblock_id])) { $this->_property = self::$prop_cache[$this->_iblock_id][$match[1]]; if ($this->_property["USER_TYPE"]) { $this->_type = CListFieldTypeList::GetByID($this->_property["PROPERTY_TYPE"] . ":" . $this->_property["USER_TYPE"]); } else { $this->_type = CListFieldTypeList::GetByID($this->_property["PROPERTY_TYPE"]); } } if (!is_object($this->_type)) { $this->_type = CListFieldTypeList::GetByID("S"); } }
public function __construct($iblock_id, $field_id, $label, $sort) { parent::__construct($iblock_id, $field_id, $label, $sort); if (preg_match("/^PROPERTY_(\\d+)\$/", $field_id, $match)) { $this->_property = $this->getPropertyArrayFromCache($match[1]); } if ($this->_property) { if ($this->_property["USER_TYPE"]) { $this->_type = CListFieldTypeList::GetByID($this->_property["PROPERTY_TYPE"] . ":" . $this->_property["USER_TYPE"]); } else { $this->_type = CListFieldTypeList::GetByID($this->_property["PROPERTY_TYPE"]); } } if (!is_object($this->_type)) { $this->_type = CListFieldTypeList::GetByID("S"); } }