PHP code example of vardumper / ibexa-form-builder-bundle
1. Go to this page and download the library: Download vardumper/ibexa-form-builder-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vardumper / ibexa-form-builder-bundle example snippets
// by content ID
$this->forward('vardumper\IbexaFormBuilderBundle\Controller\FormController::renderForm', [
'contentId' => 123,
]);
declare(strict_types=1);
namespace App\EventListener;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use vardumper\IbexaFormBuilderBundle\Event\{FormBuilderEvents, PreSubmitEvent};
#[AsEventListener(event: FormBuilderEvents::PRE_SUBMIT)]
final class SpamFilterListener
{
public function __invoke(PreSubmitEvent $event): void
{
$data = $event->getData();
if (isset($data['website']) && $data['website'] !== '') {
$event->cancel(); // honeypot field was filled — silently discard
return;
}
// Strip HTML from all string values before storage
$event->setData(array_map(
static fn (mixed $v) => is_string($v) ? strip_tags($v) : $v,
$data,
));
}
}
declare(strict_types=1);
namespace App\EventListener;
use GuzzleHttp\ClientInterface;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use vardumper\IbexaFormBuilderBundle\Event\{FormBuilderEvents, PostStoreSubmissionEvent};
#[AsEventListener(event: FormBuilderEvents::POST_STORE_SUBMISSION)]
final class CrmIntegrationListener
{
public function __construct(private readonly ClientInterface $httpClient)
{
}
public function __invoke(PostStoreSubmissionEvent $event): void
{
$submission = $event->getSubmission();
$this->httpClient->request('POST', 'https://crm.example.com/api/leads', [
'json' => [
'source_id' => $submission->getId(),
'form_id' => $submission->getContentId(),
'data' => $submission->getData(),
],
]);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.