• Модуль: lists
  • Путь к файлу: ~/bitrix/modules/lists/lib/rest/restservice.php
  • Класс: BitrixListsRestRestService
  • Вызов: RestService::addSection
static function addSection(array $params, $n, CRestServer $server)
{
	$param = new Param($params);
	$params = $param->getParams();

	global $USER;
	$rightParam = new RightParam($param);
	$rightParam->setUser($USER);
	$rightParam->setEntityId($params["IBLOCK_SECTION_ID"]);

	if (!CLists::isListFeatureEnabled($rightParam->getIblockTypeId()))
	{
		throw new AccessException('Available only on extended plans');
	}

	$right = new Right($rightParam, new SectionRight($rightParam));
	$right->checkPermission(SectionRight::ADD);
	if ($right->hasErrors())
	{
		self::throwError($right->getErrors());
	}

	$section = new Section($param);
	$sectionId = $section->add();
	if ($section->hasErrors())
	{
		self::throwError($section->getErrors());
	}

	return $sectionId;
}