This module has been deprecated as part of Zikula 4 slimming diet.
A template-driven form mailer for Zikula. Formicula is a highly configurable contact mailer solution for Zikula Application Framework. You can create any kind of contact form with any number contact fields by changing templates. Forms can be controlled by permissions. It also supports multiple, permission controlled recipients, configurable notification emails, a simple captcha for spam protection, hooks to the Captcha module, javascript form validation and file uploads.
The 6.0.x versions in the main
branch target Zikula 3.0+.
See releases.
extensions
directory.public/formicula/cache
directory containing a .htaccess
file.
If this fails (should happen very rarely), you will be notified and have to create them on your own:
a) Create a directory public/formicula/cache
and make it writable for the web server (e.g. chmod 777
).
b) Create a .htacess
file within that directory containing the following lines to allow access to the
images created for the captcha:
SetEnvIf Request_URI "\.gif$" object_is_gif=gif
SetEnvIf Request_URI "\.png$" object_is_png=png
SetEnvIf Request_URI "\.jpg$" object_is_jpg=jpg
Order deny,allow
Deny from all
Allow from env=object_is_gif
Allow from env=object_is_png
Allow from env=object_is_jpg
/contact
as URL (whereby contact corresponds
to the module name defined for Formicula in the extensions list).
This uses form 0. To call a specific form id use /contact/?form=<formid>
e.g. /contact/?form=5
to use form #5
In the distribution package you will find sample forms 0, 1, 2 and 3.
0 is a normal contact form and form #1 and beyond are more extensive forms..htaccess
file!Each contact consists of several information:
It is possible to pass own contacts to formicula instead using the formicula database. To do this by a link you have to call the addSessionOwncontacts function in the User-API. This function will return you an integer which you should append with the index 'owncontacts' to the URL pointing to formicula. If you want to embed your form you can pass the owncontacts directly to the form by adding the owncontacts array to your arguments array.
The owncontacts array should contain the following values (per item) in both cases:
Everything you want to do with the form is handled in the templates. Store them in Resources/views/Form/ The '#' at the beginning of the template designates the number of form.
The templates for the forms are named as follows:
Form/#/userForm.html.twig
Form/#/userConfirm.html.twig
Form/#/userError.html.twig
Form/#/userMail.txt.twig
Form/#/userMail.html.twig
Form/#/adminMail.txt.twig
Form/#/adminmail.html.twig
This is the email that the admin gets after the user sends submits the userform.
The standard fields to be used in forms are under userdata
You can add as many custom fields to your form as you want. This makes it easy to create e.g. an online job application form if needed.
This makes it necessary to send certain information from the form page to the module. The custom fields are numbered in old versions and an associative array in newer versions.
These are:
Example:
<label class="mandatory" for="foobar">{% trans %}foobar{% endtrans %}</label><br />
<input type="hidden" name="custom[foobar][name]" value="{% trans %}foobar{% endtrans %}" />
<input type="hidden" name="custom[foobar][mandatory]" value="1" />
<input type="text" required name="custom[foobar][data]" id="foobar" size="35" maxLength="80" value="{{ customFields.foobar.data|default|e('html_attr') }}" />
To use a form you need the right to COMMENT.
Unregistered | ZikulaFormiculaModule:: | .* | comment all unregistered users are allowed to use all forms and write to all contacts
Unregistered | ZikulaFormiculaModule:: | 0:: | comment all unregistered users are allowed to use form 0 with all existing contacts.
Users | ZikulaFormiculaModule:: | 1:(2|3): | comment all members of the group Users are allowed to use form 1 and write to contact 2 and 3.
You can use external information in the form by sending them in the url used to call the form. These data are send in an associative array addinfo where the key is the name.
With
/contact/?form=2&addinfo[tid]=4&addinfo[pid]=17
you send two different information to the form 2 which can used in the userform template (in
this example 2_userform.html
) with
{{ addinfo.tid }} => 4
{{ addinfo.pid }} => 17
As you can see you can use this to e.g. load data from Pagesetter in the userform template.
The supplied templates use a html5 input validation with webshims lib polyfill fallback.
The simplecaptcha plugins adds an image with a very basic math equation (3 number from 1 to 2 and either +, - or *) to the form if the spam check is enabled. If the user enters a wrong value, Formicula redirects back to the page where it came from.
Formicula tries to create images in this order: gif, jpg, png. If all these image types are not supported by your server, captchas are deactivated, in this case Formicula turns the configuration option "Activate spamcheck" off. Please refer to https://www.php.net/manual/en/ref.image.php for more information.
Formicula also supports ztemp-directories located outside the websites root directory. In this case (when the temp directory points to an absolute path) the image is delivered by an internal function and not linked directly.