heimrichhannot / contao-formhybrid
Contains functionality for handling form submissions in the contao frontend.
Installs: 9 621
Dependents: 15
Suggesters: 1
Security: 0
Stars: 1
Watchers: 7
Forks: 0
Open Issues: 0
Type:contao-module
Requires
- php: ^7.0 || ^8.0
- contao-community-alliance/composer-plugin: ~2.4 || ~3.0
- contao/core-bundle: ^4.4
- firebase/php-jwt: ^4.0
- heimrichhannot/contao-ajax: ^1.1.1
- heimrichhannot/contao-be_explanation: ~1.0
- heimrichhannot/contao-haste_plus: ^1.6
- heimrichhannot/contao-inserttag_download: ~1.0
- heimrichhannot/contao-notification_center_plus: ~1.0
- heimrichhannot/contao-status_messages: ^1.0 || ^2.0
- heimrichhannot/contao-submissions: ^1.0.14
- heimrichhannot/contao-versions: ~1.0 || ~2.0
Suggests
- heimrichhannot/contao-exporter: Export entities to pdf
- dev-master
- 3.25.0
- 3.24.0
- 3.23.3
- 3.23.2
- 3.23.1
- 3.23.0
- 3.22.2
- 3.22.1
- 3.22.0
- 3.21.3
- 3.21.2
- 3.21.1
- 3.21.0
- 3.20.0
- 3.19.1
- 3.19.0
- 3.18.1
- 3.18.0
- 3.17.0
- 3.16.5
- 3.16.4
- 3.16.3
- 3.16.2
- 3.16.1
- 3.16.0
- 3.15.1
- 3.15.0
- 3.14.1
- 3.14.0
- 3.13.0
- 3.12.0
- 3.11.0
- 3.10.7
- 3.10.6
- 3.10.4
- 3.10.3
- 3.10.2
- 3.10.1
- 3.10.0
- 3.9.4
- 3.9.3
- 3.9.2
- 3.9.1
- 3.9.0
- 3.8.2
- 3.8.1
- 3.8.0
- 3.7.0
- 3.6.0
- 3.5.4
- 3.5.3
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.4
- 3.4.3
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.0
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- v2.x-dev
- 2.11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.39
- 2.0.38
- 2.0.37
- 2.0.36
- 2.0.35
- 2.0.34
- 2.0.33
- 2.0.32
- 2.0.31
- 2.0.30
- 2.0.29
- 2.0.28
- 2.0.27
- 2.0.26
- 2.0.25
- 2.0.24
- 2.0.23
- 2.0.22
- 2.0.21
- 2.0.20
- 2.0.19
- 2.0.18
- 2.0.17
- 2.0.16
- 2.0.15
- 2.0.14
- 2.0.13
- 2.0.12
- 2.0.11
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.1.16
- 1.1.15
- 1.1.14
- 1.1.13
- 1.1.12
- 1.1.11
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2024-10-12 11:44:05 UTC
README
Contains functionality for handling form submissions in the contao frontend.
Usage is simple: Include the default palette (FORMHYBRID_PALETTE_DEFAULT) in config.php into your module's tl_module file and remove the fields you don't need for your module.
-> Click here for a diagram visualizing the interaction between the modules formhybrid, formhybrid_list, frontendedit and submissions.
Features
- form validation
- transforming of special field's values depending on their dca properties (e.g. date)
- ajax handling
- store submissions using submissions module if necessary
- optIn entity activation and notification handling
- optOut entity handling
Usage
Install
With composer and Contao 4 Managed Edition:
composer require heimrichhannot/contao-formhybrid ~2.8
Palette handling
- permanentFields must be declared within editableFields in order to get right field position
- a field declared in editableFields whose selector isnt active or is not part of editable fields itself is removed from the final field set
- fields from active selectors that are not within editableFields are removed from final fields
Inserttags
- {{form::FIELDNAME}} returns the formatted value from the field (select value instead of key)
- {{form_value::FIELDNAME}} returns the value of the field
- {{form_submission::FIELDNAME}} returns "field-label : formated field value"
- {{if}}
- {{elseif}}
- {{else}}
- {{endif}}
Developers
Notification center tokens
Formhybrid is notification center ready. It is possible to send 2 E-Mails on Form Submission to the sender (confirmation notification) and one to receiver (submission notification). The following tokens are provided for usage:
Config Callbacks
Additional eval dca config parameters
Frontend Form
We recommend to use Contao Frontendedit. If you can't or need more advanced options:
- Create a module and add all palette fields you want (see config.php FORMHYBRID_PALETTE_DEFAULT and tl_module.php)
- add following code to your module::compile() method to render the form
use HeimrichHannot\FormHybrid\Form;
[...]
$objForm = new Form($this);
$this->Template->form = $objForm->generate();
[...]
More advanced configurations can be archived by extending the Form class and overwrite methods. Following methods are availiable to overwrite (no complete list, see Form and DC_Hybrid classes):
Hooks
JavaScript Events
Opt in handling
FormHybrid comes with build in opt-in handling. Following steps are required to use it:
- add
formHybridAddOptIn
to your modules palette - add
\HeimrichHannot\FormHybrid\FormHybrid::addOptInFieldToTable([TABLE_NAME])
at the end of your entity dca file and update your database - create an opt in notification in notification center and provide
##opt_in_link##
inside text or html
Opt out handling
FormHybrid comes with build in opt-out handling. After calling the opt-out link the entity will be deleted. Following steps are required to use it:
- add
formHybridAddOptOut
to your modules palette and activate it in module configuration - add
\HeimrichHannot\FormHybrid\FormHybrid::addOptOutFieldToTable([TABLE_NAME])
at the end of your entity dca file and update your database - call
HeimrichHannot\FormHybrid\TokenGenerator
in your notification generation code with the opt-out-token from the database, to generate the opt-out-email-token and -url. - add
opt_out_token
andopt_out_link
to your notification center tokens and call them in your messages
Attention: If you enhance already existing data with opt-out-handling, tokens are not automatically generated for existing entries and unsubscription is not possible for existing entries! You need to check if the entry already has an token in your code, before generating opt-out link! Example:
if ($module->formHybridAddOptOut && !$recipientsModel->optOutToken) { $recipientsModel->optOutToken = Form::generateUniqueToken(); $recipientsModel->save(); }
Dublicate entity flag
Set Form::isDuplicateEntityError
to true, to stop before saving and throw error message.
Customization
Add custom submit label
Add your label to $GLOBALS['TL_LANG']['MSC']['formhybrid']['submitLabels']
.