qbus / contao-configform-bundle
Define forms using config files instead of the form generator.
Installs: 40
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:contao-bundle
pkg:composer/qbus/contao-configform-bundle
Requires
- php: ^5.6 || ^7.0
- contao/core-bundle: ^4.4.0
- qbus/contao-transient-form: ^1.0.0
This package is auto-updated.
Last update: 2025-10-14 12:28:57 UTC
README
Use config files instead of the form generator to define forms. This makes forms more easily portable.
The forms behave the same way Form Generator forms do because they are rendered, validated and processed by the Contao core. This means, for instance:
- Form hooks, like
compileFormFieldsandprepareFormData, are available; - Form settings like
sendViaEmailcan be used.
Example usage
Create a config file templates/[theme-name/]formconfig_contact.php:
<?php
return [
'tl_form' => [
'title' => 'Contact',
'sendViaEmail' => true,
'format' => 'email',
'subject' => 'Contact via website form',
'tableless' => true
],
'tl_form_field' => [
[
'type' => 'text',
'name' => 'email',
'label' => 'Email',
'mandatory' => true,
'rgxp' => 'email'
],
[
'type' => 'text',
'name' => 'subject',
'label' => 'Subject',
'mandatory' => true
],
[
'type' => 'textarea',
'name' => 'message',
'label' => 'Message',
'mandatory' => true,
'size' => serialize([8,12])
],
[
'type' => 'submit',
'slabel' => 'Send'
]
]
];
In the Contao backend, create a front end module of the type Form from config file and select the config.
Use the module wherever the form shall be inserted.