Simple handling from Symfony Forms in Sulu.io.
You can use this Bundle to create and handle dynamic forms.
This Bundle will allow the content manager to create custom forms
in the backend which can selected with a content type to be displayed at a specific page.
Also this Bundle handles the problem with the CSRF Token
and HTTP Cache
.
A simple Controller is provided to handle a Symfony Form with CSRF Token.
The mail
dispatching is handled by the bundle.
composer require sulu/sulu-form-bundle
Add to AbstractKernel (app/AbstractKernel.php)
new Sulu\Bundle\FormBundle\SuluFormBundle(),
Activate esi for csrf token reload on cache pages
by change the following lines in app/config/config.yml
.
framework:
esi: ~
fragments: ~
Configure the default sender and receivers email address (optional):
sulu_form:
mail:
from: "%sulu_admin.email%"
to: "%sulu_admin.email%"
Execute the following command to get the sqls to update your database.
php bin/adminconsole doctrine:schema:update --dump-sql
You can use --force
to run the sqls but be carefully which other
sql statements are executed.
php bin/adminconsole assets:install --symlink --relative
php bin/adminconsole sulu:translate:export
Add the following lines to app/config/admin/routing.yml
sulu_form_api:
type: rest
resource: "@SuluFormBundle/Resources/config/routing_api.yml"
prefix: /admin/api
Make sure you've set the correct permissions in the Sulu backend for this bundle!
- Dynamic Forms
- Static Forms (deprecated)
Using varnish have a look at the CSRF documentation.