may I ask what do you use these data attributes for?
if you use the CF7 dropdown menu tag field, then you ought to put your question on the CF7 plugin support page, as the <select/> html is being created by the CF7 plugin and not this plugin. This plugin just allows you to convert a dropdown menu to a select2 field.
If you need the data attributes for your select2 instantiation then I suggest you use the js custom options settings.
If you use use for your own custom scrits, then I suggest you put your data attributes on the parent element of your dropdown menu tag over which you have control.
If you are using a dynamic_dropdown tag, then you can use the filter hooks provided to add additional attributes to your HTML markup.
Normally I use the data- * attributes to indicate in each instance of the select their configuration parameters, it’s very useful when in the same form I have several SELECT2 with different configuration options
with your helper cf7sgCustomHybridddTemplates I don’t need it
Thanks
Normally I use the data- * attributes to indicate in each instance of the select their configuration parameters, it’s very useful when in the same form I have several SELECT2 with different configuration options
agreed that’s a nice way to parametrise an instance. This is what I introduced on the HybridDropdown, the settings are in order of priority:
1. HTML data-* attributes
2. options passed in the constructor
so the cf7sgCustomHybridddTemplates are passed in the constructor (by the plugin) but should you use the php hooks to setup HTML data attributes on the field constructor, then these will override the values set in the js script.
This has the advantage of programmatically overriding default values you set in your script.
Yes, I am from Barcelona 🙂