Hi. It would be nice if I could write e.g. shipping method plugin which requires some additional info (api key, api url, ...).
Currently if I extend the type Sylius\Bundle\ShippingBundle\Form\Type\ShippingMethodType, I also have to replace this template: https://github.com/Sylius/Sylius/blob/552cf811e88bc41909b864e0d755ff7cfef2ee17/src/Sylius/Bundle/AdminBundle/Resources/views/ShippingMethod/_form.html.twig in order to show the new fields (so there has to be instructions for users of the bundle on how to replace the template so that the additional fields appear).
This would be possible if all form-templates would make use of {{form_rest(form)}}?
but in most cases you will need to change the order of the fields in your template?
Maybe this can be tackled with ordered forms or smth (https://github.com/egeloen/ivory-ordered-form I didn't use it so far)
yes, that would solve it. (also it's enough to render the whole form as {{ form(form) }})
It is most probable that we will add sonata block to allow you to inject to this form. But we will not use {{ form(form) }} almost for sure. We need to order fields and give them proper attributes in HTML files
👍 sontata blocks seems like a good idea
sure, sonata is possible and good enough for my current use-case. If you created/used some existing form extension which would allow to set position, then it would cover even more use cases probably. As to html side, you could use form themes probably to render the individual fields correctly (in case you wanted to group them into some groups - you could add some extension with group option which would be passed into form view and then use form theme to render it correctly).
But as I said - sonata blocks are good enough for my current use case.
@nenadalm Nice, I will close this then and we will document it in more detail for 1.0. :)
As far i can see it is possible with sonata blocks. But the block-events do not exist in the AdminBundle which prevents one to add fields without overwriting the whole template.
The block-events should be added to each form of the AdminBundle?
The problem is that the user has to implement the Template-part for each bundle. If multiple bundles want to modify the form (e.g. add some fields to the Customer) this cannot be done without an admin touching the template.
The following scenario is not fulfilled atm:
I want to install 2 Plugins
Each of them adds one single field to the Admin-UI
I just want to install the Bundle and don't want to touch the template at all.
If you have to adjust the template manually you have to follow each plugins updates and c&p the changed parts in your own template.
Adding the block-events everywhere prevents that. Or did i misunderstand?
Most helpful comment
As far i can see it is possible with sonata blocks. But the block-events do not exist in the AdminBundle which prevents one to add fields without overwriting the whole template.
The block-events should be added to each form of the AdminBundle?
The problem is that the user has to implement the Template-part for each bundle. If multiple bundles want to modify the form (e.g. add some fields to the Customer) this cannot be done without an admin touching the template.
The following scenario is not fulfilled atm:
If you have to adjust the template manually you have to follow each plugins updates and c&p the changed parts in your own template.
Adding the block-events everywhere prevents that. Or did i misunderstand?