SyliusCmsPlugin icon indicating copy to clipboard operation
SyliusCmsPlugin copied to clipboard

[Autocomplete] What is the purpose of `choice_name` and `choice_value`?

Open fsoedjede opened this issue 3 years ago • 1 comments

Thanks for this plugin.

I'm sorry in advance if my question is not relevant. I just started learning Sylius and using this plugin last week. Please feel free to tell me and close the issue.

I'm asking this question because when digging in the code to understand how the autocomplete works, I found those fields in the template: https://github.com/BitBagCommerce/SyliusCmsPlugin/blob/v3.2.2/src/Resources/views/Form/theme.html.twig#L19-L20

I found those field seems to be needed in the js file: https://github.com/BitBagCommerce/SyliusCmsPlugin/blob/v3.2.2/src/Resources/assets/admin/js/bitbag/bitbag-media-autocomplete.js#L12-L13

They are not used anywhere in the file.

My understanding is that those fields may be there to allow some customizations but it's not clear how.

Thanks in advance for the response.

fsoedjede avatar May 02 '22 11:05 fsoedjede

I think best is to have a look at the Symfony docs about these features:

  • https://symfony.com/doc/current/reference/forms/types/choice.html#choice-value
  • https://symfony.com/doc/current/reference/forms/types/choice.html#choice-name

stefandoorn avatar Sep 26 '22 12:09 stefandoorn

Looks like fully explained.

damonsson avatar Jan 27 '23 10:01 damonsson