• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/iblocktype.php
  • Класс: CIBlockType
  • Вызов: CIBlockType::Add
public function Add($arFields)
{
	/** @global CDatabase $DB */
	global $DB;
	/** @global CCacheManager $CACHE_MANAGER */
	global $CACHE_MANAGER;

	$arFields["SECTIONS"] = isset($arFields["SECTIONS"]) && $arFields["SECTIONS"] === "Y" ? "Y" : "N";
	$arFields["IN_RSS"] = isset($arFields["IN_RSS"]) && $arFields["IN_RSS"] === "Y" ? "Y" : "N";

	if (!$this->CheckFields($arFields))
		return false;

	$arInsert = $DB->PrepareInsert("b_iblock_type", $arFields);
	$DB->Query("INSERT INTO b_iblock_type(".$arInsert[0].") VALUES(".$arInsert[1].")");

	if (isset($arFields["LANG"]))
	{
		$this->SetLang($arFields["ID"], $arFields["LANG"]);
	}

	if (CACHED_b_iblock_type !== false)
	{
		$CACHE_MANAGER->cleanDir("b_iblock_type");
	}

	return $arFields["ID"];
}