Forms
This section is deprecated. However, as of now, the Sylius E-Commerce project is still resorting to this configuration so you might want to check it out.
Have you noticed how Sylius generates forms for you? Of course, for many use-cases you may want to create a custom form.
Custom Resource Form
Create a FormType class for your resource
src/Form/Type/BookType.php
Note
The getBlockPrefix method returns the prefix of the template block name for this type.
Register the FormType as a service
Warning
the registration of a form type is only needed when the form is extending the AbstractResourceType
or when it has some custom constructor dependencies.
Configure the form for your resource
config/routes/sylius_resource.yaml
That's it. Your new class will be used for all forms!
Last updated