Reputation: 121
How to add a custom form to sulu CMS (example: complex contact form) and save values to database? Is there any good example? Documentation does not mention about custom development.
Regards,
Upvotes: 3
Views: 1790
Reputation: 2056
As long as your forms are static (meaning the content manager is not able to choose which fields are appearing), you can simply do what is described in the Symfony documentation.
There are two (probably even more) different possibilities to include Symfony forms:
The first one is to create your own route and controller, working with Symfony forms as you would do in any other Symfony application.
The second one is to use the template system of Sulu as described in our documentation. Then you can add a few fields for content management around the form the content manager can use. In the template defined in the <view>
tag of the XML you can again use Symfony form stuff. If you need any special information from the system you can even change the <controller>
tag of the XML, to pass more than only the data from the content management.
There are also some ideas concerning a more sophisticated form manager floating around, but that's far from being published.
Upvotes: 2