ninsuo / symfony-collection

[NOT MAINTAINED] A jQuery plugin that manages adding, deleting and moving elements from a Symfony form collection
https://symfony-collection.fuz.org/
MIT License
444 stars 88 forks source link

Symfony bootstrap 4 theme #129

Closed lolmx closed 6 years ago

lolmx commented 6 years ago

This pull request is related to #123.

I encountered the same problem raised by @codedmonkey and his solution solved the issue.

ninsuo commented 6 years ago

Thanks. Will add the tag.

ninsuo commented 6 years ago

I've received an email about BC breaks regarding this issue, well I told him to overwrite the option as I think that all in all, this change worth it 👍

For those interested:

Only Bootstrap 3: set the option elements_selector to > div Only Bootstrap 4: set the option elements_selector to > fieldset

lolmx commented 6 years ago

Maybe one nice solution is to allow to modify elements_selector with the given options? I tried that before submitting the pr, but didn't work (tbh i didn't go further in the why it did not).

Like, by default elements_selector: '> div, > fieldset', but overridable with options.

By the way i wrote > div, > fieldset because there are some cases where symfony still render a div tag in my project. I use symfony 3.4 and bootstrap 4. If my collection is a simple type (like TextType) it's rendered within a div, but when i work with a complex type (my use case was 3 selects) then symfony render the whole thing into a fieldset.

Furthermore, if overridable with options, people altering the default symfony form theme would still be able to use the plugin in their project.

What you think about that?

ninsuo commented 6 years ago

Overwritting elements_selector is possible in the options, strange that it didn't work for you. Code set the settings using a regular var settings = $.extend(true, {}, defaults, options); and thus it should work.

Gillu13 commented 6 years ago

I think this pull request is also related to issue #105