- Модуль: lists
- Путь к файлу: ~/bitrix/modules/lists/lib/rest/restservice.php
- Класс: BitrixListsRestRestService
- Вызов: RestService::updateElement
static function updateElement(array $params, $n, CRestServer $server)
{
$param = new Param($params);
$iblock = new Iblock($param);
if (!$iblock->isExist())
{
self::throwError($iblock->getErrors(), "Iblock not found", Iblock::ERROR_IBLOCK_NOT_FOUND);
}
global $USER;
$rightParam = new RightParam($param);
$rightParam->setUser($USER);
$rightParam->setEntityId(Utils::getElementId($param->getParams()));
if (!CLists::isListFeatureEnabled($rightParam->getIblockTypeId()))
{
throw new AccessException('Available only on extended plans');
}
$elementRight = new ElementRight($rightParam);
$right = new Right($rightParam, $elementRight);
$right->checkPermission(ElementRight::EDIT);
if ($right->hasErrors())
{
self::throwError($right->getErrors());
}
$element = new Element($param);
if (!$element->isExist())
{
self::throwError($element->getErrors(), "Element not found", Element::ERROR_ELEMENT_NOT_FOUND);
}
if ($element->update())
{
return true;
}
else
{
self::throwError($element->getErrors());
}
}