pirasterize / sonata-form-builder
A drag&drop form builder for sonata admin
Installs: 2 931
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 3
Forks: 13
Open Issues: 1
Type:symfony-bundle
Requires
- php: ^8.1
- ext-json: *
- doctrine/orm: ^2.5
- gregwar/captcha-bundle: ^2.2
- sonata-project/admin-bundle: ^4.0
- sonata-project/block-bundle: ^4.0
- sonata-project/exporter: ^3.0
- symfony/config: ^5.4
- symfony/dependency-injection: ^5.4
- symfony/event-dispatcher: ^5.4
- symfony/form: ^5.4
- symfony/framework-bundle: ^5.4
- symfony/http-foundation: ^5.4
- symfony/http-kernel: ^5.4
- symfony/mailer: ^5.4
- symfony/options-resolver: ^5.4
- symfony/routing: ^5.4
- symfony/twig-bundle: ^5.4
- symfony/validator: ^5.4
- dev-master
- v0.53
- v0.52
- v0.51
- v0.50
- v0.48
- v0.47
- v0.46
- v0.45
- v0.44
- v0.43
- v0.42
- v0.41
- v0.40
- v0.39
- v0.38
- v0.37
- v0.36
- v0.35
- v0.34
- v0.33
- v0.32
- v0.31
- v0.30
- v0.29
- v0.28
- v0.27
- v0.26
- v0.25
- v0.24
- v0.23
- v0.22
- v0.21
- v0.20
- v0.19
- v0.18
- v0.17
- v0.16
- v0.15
- v0.14
- v0.13
- v0.12
- v0.11
- v0.10
- v0.9
- v0.8
- v0.7
- v0.6
- v0.5
- v0.4
- v0.3
- v0.2
- v0.1.1
- v0.1
This package is not auto-updated.
Last update: 2025-03-28 20:29:00 UTC
README
A Drag & Drop Form builder inspired from the Git package https://github.com/minikomi/Bootstrap-Form-Builder and adapted for Sonata-Admin with bootstrap v3 and Jquery
You need Bootstrap v3 and Jquery on your Javascript/CSS requirements and a recent Sonata Admin installation.
##Install the bundle
###Step 1: Download the bundle
You can download and put on your /src directory (like this src/Pirastru/FormBuilderBundle) or insert on your vendor directory with the follow command :
php -dmemory_limit=1G ./composer.phar require pirasterize/sonata-form-builder
If you have a >minimum-stability< error is because your symfony installation accept only stable packages. Edit composer.json file and change "minimum-stability" from "stable" to "dev" :
...
"minimum-stability": "dev",
...
###Step 2: Enable the bundle
Insert the follow line on your AppKernel.php in your symfony :
class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Gregwar\CaptchaBundle\GregwarCaptchaBundle(), new Pirastru\FormBuilderBundle\PirastruFormBuilderBundle() ); // ... } // ... }
###Step 3: Configuration
Add the following configuration to your app/config/config.yml
:
gregwar_captcha: ~
Add the following configuration to your app/config/parameters.yml
:
formbuilder_email_from: jeanmichel@basquiat.com
###Step 4: Setup the database schema
$php app/console doctrine:schema:update --force
###Step 5: Setup the routing
Append the following code to app/config/routing.yml or better to separate app/config/routing_admin.yml :
sonata_form_builder: resource: '@PirastruFormBuilderBundle/Controller/FormBuilderController.php' type: annotation
###Step 6: Sonata admin setup
In order to have on your list of Admin entities the Form Builder you must put on your configuration file (this case app/config/sonata/sonata_admin.yml), inside of the directive of 'sonata_admin' the follow code :
sonata_admin: .... dashboard: .... groups: ... sonata.admin.group.formbuilder: label: Form Builder items: - pirastru_form_builder.admin
###Step 7: Sonata blocks setup
In order to have on the list of blocks the Form Builder Block available on a page put on your configuration file (app/config/sonata/sonata_block.yml) the follow line :
sonata_block: .... blocks: .... pirastru_form_builder.block:
###Step 8: Install assets
Run the follow command on your console to install assets :
$php app/console assets:install
##To see the result
Check on your Sonata Admin Entities you should see the 'Form Builder' Menu than create a new drag&drop form. After that create a page from sonata page or edit an existing one and put from the list of available blocks the block called "Form Builder Drag&Drop". On Options choose the Form you just created, and take a look on the page.
##Building the bootstrap form builder Install RequireJS
npm install -g requirejs
And run following command in directory Resources/public/BootstrapFormBuilder
:
r.js -o assets/js/lib/build.js
##Todo
- Fields in differents sizes
- Translations
- tests
- remove form fields that are not needed in export - Button/Captcha/Privacycheck