web-to-lead forms

This commit is contained in:
Yuri Kuznetsov
2024-11-23 11:05:25 +02:00
parent 56735e9358
commit ec2fc5916c
49 changed files with 2323 additions and 143 deletions
@@ -60,6 +60,7 @@ class ExampleLoader implements Loader
$this->processRequestUrl($entity);
$this->processRequestPayload($entity);
$this->processFormUrl($entity);
}
private function processRequestUrl(LeadCapture $entity): void
@@ -121,4 +122,21 @@ class ExampleLoader implements Loader
$entity->set('exampleRequestPayload', $requestPayload);
}
private function processFormUrl(LeadCapture $entity): void
{
$formId = $entity->getFormId();
$siteUrl = $this->config->getSiteUrl();
if (!$entity->hasFormEnabled() || !$formId) {
/** @noinspection PhpRedundantOptionalArgumentInspection */
$entity->set('formUrl', null);
return;
}
$formUrl = "$siteUrl?entryPoint=leadCaptureForm&id=$formId";
$entity->set('formUrl', $formUrl);
}
}