TablerBundle icon indicating copy to clipboard operation
TablerBundle copied to clipboard

[Feature] Image Check Checkbox/Radio Inputs

Open ExtremTechniker opened this issue 11 months ago • 3 comments

Please add some FormType and form themes to add the Image Check Checkbox and Radio Inputs.

image

image

Form structure should be like the examples from tabler.io https://tabler.io/docs/forms/form-image-check

ExtremTechniker avatar Mar 21 '24 15:03 ExtremTechniker

And I wondered if thosed where ever used outside of the preview. Seems yes 😁

If anyone wants to contribute a PR, please let me know!

kevinpapst avatar Mar 22 '24 08:03 kevinpapst

Yeah I also thought no one would use it. But I'm helping a colleague with his footpicker an in one form you can pick an restaurant and there will be the logo be displayed.

Would it be possible to add this as an formtype extension because we are using the doctrine entity type which is based on the choice type. And I think all possible choice types should have the possibility to display as image check

ExtremTechniker avatar Mar 22 '24 20:03 ExtremTechniker

You need to attach meta data to each entry for the logo url, so the default doctrine entity type is probably the wrong form type. Afair symfony recommends populating the list of entities yourself in such cases.

Just use a normal ChoiceType and set choices = your array of entities. Then add a form_widget twig block to render the needed html.

kevinpapst avatar Mar 22 '24 20:03 kevinpapst