PHP code example of netzmacht / contao-form-bundle

1. Go to this page and download the library: Download netzmacht/contao-form-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/ */

    

netzmacht / contao-form-bundle example snippets


// Symfony form generator, provided as service form.factory
$form = $formFactory->create(Netzmacht\ContaoFormBundle\Form\FormGeneratorType::class, null, ['formId' => 5]);

// That's all. Now you can use a symfon form having your form generator form fields.


// Symfony form generator, provided as service form.factory
assert($dc instanceof Contao\DataContainer);
$form = $formFactory->create(
    Netzmacht\ContaoFormBundle\Form\DcaFormType::class, 
    null, 
    ['dataContainer' => 'tl_content', 'fields' => ['text'], 'driver' => $dc]
);

$builder
    ->add(
        'field',
        FieldType::class,
        [
            'contaoWidget' => ['class' => 'generic-class', 'be_class' => 'clr w50', 'fe_class' => 'frontend-class'],
        ]
    )
twig
{% form_theme form '@NetzmachtContaoForm/form/contao_backend.html.twig' %}
{{ form(form) }}