• Модуль: salescenter
  • Путь к файлу: ~/bitrix/modules/salescenter/lib/integration/landingmanager.php
  • Класс: BitrixSalesCenterIntegrationLandingManager
  • Вызов: LandingManager::setPageWebFormId
protected function setPageWebFormId($landingId, $formId): Result
{
	$result = new Result();
	$form = CrmManager::getInstance()->getWebForms()[$formId];
	if (!$form)
	{
		return $result->addError(new Error('Form not found'));
	}
	$blocks = LandingSubtypeForm::getLandingFormBlocks($landingId);
	if (empty($blocks))
	{
		return $result->addError(new Error('Could not found block with form on the page'));
	}
	foreach ($blocks as $blockData)
	{
		if (!LandingSubtypeForm::setFormIdToBlock((int)$blockData['ID'], (int)$formId))
		{
			return $result->addError(new Error('Error while set form ID to block'));
		}
		if ($this->connectedWebForms !== null)
		{
			$this->connectedWebForms[] = [
				'blockId' => (int)$blockData['ID'],
				'formId' => (int)$formId,
				'landingId' => (int)$landingId,
			];
		}
	}

	return $result;
}