- Модуль: lists
- Путь к файлу: ~/bitrix/modules/lists/classes/general/listfield.php
- Класс: CListPropertyField
- Вызов: CListPropertyField::Update
public function Update($arFields)
{
if(isset($arFields["TYPE"]))
$newType = $arFields["TYPE"];
else
$newType = $this->GetTypeID();
if(is_array($this->_property) && !CListFieldTypeList::IsField($newType))
{
if (self::existPropertyCode($this->_iblock_id, $arFields["CODE"], $this->_property["ID"]))
{
throw new NotSupportedException(GetMessage("LIST_PROPERTY_FIELD_DUPLICATE_CODE"));
}
foreach($this->GetArray() as $id => $val)
if(array_key_exists($id, $arFields) && $id != "IBLOCK_ID")
$this->_property[$id] = $arFields[$id];
if(mb_strpos($newType, ":") !== false)
list($this->_property["PROPERTY_TYPE"], $this->_property["USER_TYPE"]) = explode(":", $newType);
else
{
$this->_property["PROPERTY_TYPE"] = $newType;
$this->_property["USER_TYPE"] = "";
}
$this->_property["CHECK_PERMISSIONS"] = "N";
$this->_property["ACTIVE"] = "Y";
$obProperty = new CIBlockProperty;
if($obProperty->Update($this->_property["ID"], $this->_property))
{
self::resetPropertyArrayCache();
if($this->_property["PROPERTY_TYPE"] == "L" && is_array($arFields["LIST"] ?? null))
CList::UpdatePropertyList($this->_property["ID"], $arFields["LIST"]);
return new CListPropertyField($this->_property["IBLOCK_ID"], "PROPERTY_".$this->_property["ID"], $arFields["NAME"], $arFields["SORT"]);
}
elseif (!empty($obProperty->LAST_ERROR))
{
throw new ArgumentException($obProperty->LAST_ERROR);
}
}
return null;
}