-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FormField] Add new propertyNameSuffix to + Consistency between open & close #6555
[FormField] Add new propertyNameSuffix to + Consistency between open & close #6555
Conversation
c353ace
to
771588c
Compare
I'd assume you have fixed this for the same reason that I have created the PR below - multiple fields with same names/ids cause issues. See my PR that adds Uniqid by default to tabs to prevent said issues. #6517 |
Nop, the case I wanted to address is to allow to remove any ids generation and replace it by a known value. With in mind, overriding template capability. I started to do some PRs to use more native SF form capabilities ( #6536 ) IMHO, we should not rely on any id generation to create SF Form, it prevent native form functionalities like form template overriding to be used. I did not encountered your case yet. (Am I lucky? ;) ) And after a quick look at your PR, I think there are different. |
Well, lets reverse it; I'd assume that this feature has the potential to fix my experienced issue as well when delivered in a broader scale (for every field). 👍 |
@WedgeSama thanks for this contribution. I like it but I have a couple of suggestions. This feature looks the same as Symfony Form's So, I propose the following changes:
If you agree, I can make this changes for you while merging. Cheers! |
The PR does more then that:
IMO, the important features of the PR are the 2. and the 4. I thought of somethink to change the PR with your suggestions while keeping the keys features:
This will solve the 2. & 4. but not 1. nor 3. And 3. will be hard (maybe impossible without 1.?) but can live without it. @javiereguiluz if your OK with those behaviors, I'll do the changes 😉 PS: Still can address the 1. in another PR but maybe we need to discuse more of how we can do it |
The main problem here is that I don't know the Symfony Form component well 😐 so I'm missing things. In any case, there's only one thing in your PR that scares me. This change: The Just asking: Instead of changing ... could we keep Thanks |
771588c
to
e3a077c
Compare
…and close suffix Allow to set a specific suffix to all `FormField` (tab, fieldset, row and column) in place of a random Ulid. Still use Ulid if nothing given. The suffix allow to easily override template by knowing the form name (instead of random one). The suffix given is kept between open and closed type. The suffix name is only used by `FormField`.
e3a077c
to
6870a01
Compare
True, I did not see that the I created With this, I can keep all features listed above + preserve I think we got something now @javiereguiluz 😉 PS : Plus I added more tests ^^ |
@javiereguiluz let me know if you need anything about the PR 😉 |
Benjamin, sorry it took so long to merge this. Thanks again for contributing it ... and thanks too for adding tests 🙇 While merging I added some docs for the feature: 4718260 |
Yes you are right, completely forget to add doc with it🤦 Thanks ^^ |
These changes look quite useful however have they introduced a problem with the default templates when you have multiple fieldsets? In EasyAdminBundle/crud/detail.html.twig the macro render_fieldset_open(field) uses field.property for the fieldset id and the button uses this to target it. The id is now the same ea_form_fieldset for all fieldsets with no mention of the custom property siffix or the random ulid one thus if you have multiple fieldsets clicking the button on one of them opens or closes all fieldsets. Changing the 3 references of {{ field.property }} to {{ field.propertyNameWithSuffix }} looks to restore normal functionality. |
@WedgeSama all done and tested, looks good to me. |
This PR was merged into the 4.x branch. Discussion ---------- Fix Fieldset collapse with new suffix. Fix fieldset collapsing that do not use the right property to create the `id` HTML attribute. #6555 (comment) Commits ------- 4969c7e Fix Fieldset collapse with new suffix. #6555 (comment)
Allow to set a specific suffix to all
FormField
(tab, fieldset, row and column) in place of a random Ulid.Still use Ulid if nothing given.
The suffix allow to easily override template by knowing the form name (instead of random one).
The suffix given is kept between open and closed type.
The suffix must be valid like a SF form name.
Usage example: