• Модуль: lists
  • Путь к файлу: ~/bitrix/modules/lists/lib/entity/iblock.php
  • Класс: Bitrix\Lists\Entity\Iblock
  • Вызов: Iblock::add
public function add()
{
	$this->param->checkRequiredInputParams(["IBLOCK_TYPE_ID", "IBLOCK_CODE", ["FIELDS" => ["NAME"]]]);
	if ($this->param->hasErrors())
	{
		$this->errorCollection->add($this->param->getErrors());
		return false;
	}

	$iblockObject = new \CIBlock();
	$result = $iblockObject->add($this->getFields());

	if ($result)
	{
		if (!empty($this->params["SOCNET_GROUP_ID"]) && Loader::includeModule("socialnetwork"))
		{
			\CSocNetGroup::setLastActivity($this->params["SOCNET_GROUP_ID"]);
		}
		return (int)$result;
	}
	else
	{
		if ($iblockObject->LAST_ERROR)
		{
			$this->errorCollection->setError(new Error($iblockObject->LAST_ERROR, self::ERROR_ADD_IBLOCK));
		}
		else
		{
			$this->errorCollection->setError(new Error("Unknown error", self::ERROR_ADD_IBLOCK));
		}

		return false;
	}
}