Skip to content

Latest commit

 

History

History
98 lines (65 loc) · 2.1 KB

index.md

File metadata and controls

98 lines (65 loc) · 2.1 KB

Sulu Form Bundle

Simple handling from Symfony Forms in Sulu.io.
You can use this Bundle to create and handle dynamic forms.

Features

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.

Installation

composer require sulu/sulu-form-bundle

Add to AbstractKernel (app/AbstractKernel.php)

new Sulu\Bundle\FormBundle\SuluFormBundle(),

Config

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%"

Create Database

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.

Install assets

php bin/adminconsole assets:install --symlink --relative

Generate translations

php bin/adminconsole sulu:translate:export

Routing

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

Permissions

Make sure you've set the correct permissions in the Sulu backend for this bundle!

Usage

Additional form fields

Varnish

Using varnish have a look at the CSRF documentation.