• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/ads/leadads/form.php
  • Класс: Bitrix\Crm\Controller\Ads\LeadAds\Form
  • Вызов: Form::getAction
public function getAction(string $type, $accountId, $formId, $proxyId = null): AjaxJson
{
	if (!$service = $this->getService($proxyId))
	{
		$this->addError(
			new Error("Service not available.")
		);

		return $this->errorResponse();
	}

	if (!$form = $service->getForm($type))
	{
		$this->addError(
			new Error("Wrong type {$type}.")
		);

		return $this->errorResponse();
	}

	if ((int)$accountId !== 0)
	{
		$form->setAccountId($accountId);
	}
	$formResponse = $form->getForm($formId);

	if (!$formResponse->isSuccess())
	{
		$this->addErrors(
			$formResponse->getErrors()
		);

		return $this->errorResponse();
	}


	return $this->successResponse([
		"form" => $formResponse->fetch()
	]);
}