• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/publicaction/landing.php
  • Класс: Bitrix\Landing\PublicAction\Landing
  • Вызов: Landing::addByTemplate
static function addByTemplate($siteId, $code, array $fields = [])
{
	$result = new PublicActionResult();
	$error = new \Bitrix\Landing\Error;

	$willAdded = false;
	$siteId = intval($siteId);
	$fields = self::checkAddingInMenu($fields, $willAdded);

	$res = LandingCore::addByTemplate($siteId, $code, $fields);

	if ($res->isSuccess())
	{
		$result->setResult($res->getId());
		if (
			!$willAdded &&
			isset($fields['ADD_IN_MENU']) &&
			isset($fields['TITLE']) &&
			$fields['ADD_IN_MENU'] == 'Y'
		)
		{
			Site::addLandingToMenu($siteId, [
				'ID' => $res->getId(),
				'TITLE' => $fields['TITLE']
			]);
		}
	}
	else
	{
		$error->addFromResult($res);
		$result->setError($error);
	}

	return $result;
}