46 if (isset($this->elementLinkProperties[$entity]))
48 if (!is_object($this->elementLinkProperties[$entity]))
49 $this->elementLinkProperties[$entity] =
new Element($this->elementLinkProperties[$entity]);
50 return $this->elementLinkProperties[$entity];
52 elseif (isset($this->sectionLinkProperties[$entity]))
54 if (!is_object($this->sectionLinkProperties[$entity]))
55 $this->sectionLinkProperties[$entity] =
new Element($this->sectionLinkProperties[$entity]);
56 return $this->sectionLinkProperties[$entity];
59 return parent::resolve($entity);
71 parent::setFields($fields);
73 is_array($this->fields)
74 && $this->iblockId > 0
78 $propertyList = \Bitrix\Iblock\PropertyTable::getList(array(
79 "select" => array(
"*"),
80 "filter" => array(
"=IBLOCK_ID" => $this->iblockId),
82 while ($row = $propertyList->fetch())
84 if ($row[
"USER_TYPE_SETTINGS"])
86 $row[
"USER_TYPE_SETTINGS"] = unserialize(
87 $row[
"USER_TYPE_SETTINGS"],
88 array(
'allowed_classes' =>
false)
93 if ($row[
"CODE"] !=
"")
97 foreach ($fields as $propertyCode => $propertyValues)
99 if (is_array($propertyValues))
101 foreach ($propertyValues as $i => $propertyValue)
103 if (is_array($propertyValue) && array_key_exists(
"VALUE", $propertyValue))
105 if ($propertyValue[
"VALUE"] !=
"")
106 $propertyValues[$i] = $propertyValue[
"VALUE"];
108 unset($propertyValues[$i]);
116 $fieldCode = mb_strtolower($propertyCode);
118 if ($property[
"PROPERTY_TYPE"] ===
"L")
120 if (is_numeric($propertyValues))
124 elseif (is_array($propertyValues))
127 foreach ($propertyValues as $propertyValue)
129 if (is_numeric($propertyValue))
135 $value = $propertyValues;
138 elseif ($property[
"PROPERTY_TYPE"] ===
"E")
140 if ($propertyValues instanceof
Element)
142 $this->elementLinkProperties[$fieldCode] = $propertyValues;
143 $value = $propertyValues->getField(
"name");
145 elseif (is_numeric($propertyValues))
147 $this->elementLinkProperties[$fieldCode] = $propertyValues;
150 elseif (is_array($propertyValues))
153 foreach ($propertyValues as $propertyValue)
155 if (is_numeric($propertyValue))
161 $value = $propertyValues;
164 elseif ($property[
"PROPERTY_TYPE"] ===
"G")
166 if ($propertyValues instanceof
Section)
168 $this->sectionLinkProperties[$fieldCode] = $propertyValues;
169 $value = $propertyValues->getField(
"name");
171 elseif (is_numeric($propertyValues))
173 $this->sectionLinkProperties[$fieldCode] = $propertyValues;
176 elseif (is_array($propertyValues))
179 foreach ($propertyValues as $propertyValue)
181 if (is_numeric($propertyValue))
187 $value = $propertyValues;
192 if($property[
"USER_TYPE"] <>
'')
194 if(is_array($propertyValues))
197 foreach($propertyValues as $propertyValue)
209 $value = $propertyValues;
213 $this->fieldMap[$fieldCode] = $property[
"ID"];
214 $this->fieldMap[$property[
"ID"]] = $property[
"ID"];
215 if ($property[
"CODE"] !=
"")
216 $this->fieldMap[mb_strtolower($property[
"CODE"])] = $property[
"ID"];
218 $this->fields[$property[
"ID"]] = $value;
232 if (!isset($this->fields) && $this->iblockId > 0)
234 $this->fields = array();
235 $this->fieldMap = array();
237 $propertyList = \CIBlockElement::getProperty(
240 array(
"sort" =>
"asc"),
241 array(
"EMPTY" =>
"N")
243 while ($property = $propertyList->fetch())
245 if ($property[
"VALUE_ENUM"] !=
"")
247 $value = $property[
"VALUE_ENUM"];
249 elseif ($property[
"PROPERTY_TYPE"] ===
"E")
251 $this->elementLinkProperties[$property[
"ID"]] = $property[
"VALUE"];
252 if ($property[
"CODE"] !=
"")
253 $this->elementLinkProperties[mb_strtolower($property[
"CODE"])] = $property[
"VALUE"];
256 elseif ($property[
"PROPERTY_TYPE"] ===
"G")
258 $this->sectionLinkProperties[$property[
"ID"]] = $property[
"VALUE"];
259 if ($property[
"CODE"] !=
"")
260 $this->sectionLinkProperties[mb_strtolower($property[
"CODE"])] = $property[
"VALUE"];
265 if($property[
"USER_TYPE"] <>
'')
271 $value = $property[
"VALUE"];
275 $this->fieldMap[$property[
"ID"]] = $property[
"ID"];
276 if ($property[
"CODE"] !=
"")
277 $this->fieldMap[mb_strtolower($property[
"CODE"])] = $property[
"ID"];
279 if ($property[
"MULTIPLE"] ==
"Y")
280 $this->fields[$property[
"ID"]][] = $value;
282 $this->fields[$property[
"ID"]] = $value;
285 return is_array($this->fields);