Download the PHP package asmitta-01/formflow-bundle without Composer
On this page you can find all versions of the php package asmitta-01/formflow-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download asmitta-01/formflow-bundle
More information about asmitta-01/formflow-bundle
Files in asmitta-01/formflow-bundle
Package formflow-bundle
Short Description Multi-step forms for your Symfony project.
License MIT
Homepage https://github.com/Asmitta-01/MultiStepFormFlowBundle
Informations about the package formflow-bundle
MultiStepFormFlowBundle
This is a fork of the package craue/CraueFormFlowBundle version 3.7.0. You can check it to know all the features of this package. In this fork i focus on the usage and installation on Symfony 7.
:warning: Note: This fork doesn't support a Symfony version prior to 6.0.
Installation
Follow this guide for the installation.
Usage
This section shows how to create a 3-step form flow for a user. The package provides 03 approaches but i will focus on one: One form type for the entire flow. This approach makes it easy to turn an existing (common) form into a form flow. We will use this FormType:
1. Create a flow class
2. Update the form type class
There is an option called flow_step
you can use to decide which fields will be added to the form
according to the step to render.
3. Register your flow as a service
4. Setup your controller
4. Create a form template(view)
You only need one template for a flow.
The instance of your flow class is passed to the template in a variable called flow
so you can use it to render the
form according to the current step.
Buttons
You can customize the default button look by using these variables to add one or more CSS classes to them:
asmitta_formflow_button_class_last
will apply either to the next or finish buttonasmitta_formflow_button_class_finish
will specifically apply to the finish buttonasmitta_formflow_button_class_next
will specifically apply to the next buttonasmitta_formflow_button_class_back
will apply to the back buttonasmitta_formflow_button_class_reset
will apply to the reset button
Example with Bootstrap button classes:
In the same way you can customize the button labels:
asmitta_formflow_button_label_last
for either the next or finish buttonasmitta_formflow_button_label_finish
for the finish buttonasmitta_formflow_button_label_next
for the next buttonasmitta_formflow_button_label_back
for the back buttonasmitta_formflow_button_label_reset
for the reset button
Example:
You can also remove the reset button by setting asmitta_formflow_button_render_reset
to false
.
The buttons are displayed in a div
with the class _asmitta_formflowbuttons. You can override its rules in your CSS file.
Handle Unmapped Fields
If you have unmapped fields in your form, you can handle them at the end of the form fill.
In our previous example, assuming the first_name
is unmapped we'll need to handle it ourself.
Symfony UX Turbo
Working with Symfony Turbo the flow in the view might not work correctly. You should disable it on that view or send a specific code with the controller.
-
Disabling Turbo: o disable Turbo on a specific page in Symfony, you can use the
data-turbo
attribute. For example: - Sending a http code with the controller:
All versions of formflow-bundle with dependencies
symfony/framework-bundle Version ^6.0 || ^7.0
symfony/config Version ^6.0 || ^7.0
symfony/dependency-injection Version ^6.0 || ^7.0
symfony/event-dispatcher Version ^6.0 || ^7.0
symfony/form Version ^6.0 || ^7.0
symfony/http-foundation Version ^6.0 || ^7.0
symfony/http-kernel Version ^6.0 || ^7.0
symfony/options-resolver Version ^6.0 || ^7.0
symfony/security-core Version ^6.0 || ^7.0
symfony/translation Version ^6.0 || ^7.0
symfony/validator Version ^6.0 || ^7.0
symfony/yaml Version ^6.0 || ^7.0