Ähem ...
I want an
option defined in options.xml
This option should save an array.
Anyway, I have solved it.
My option looks like that:
Code:
<option option_id="r9_bff_fields" edit_format="callback" data_type="array" advanced="0">
<default_value>[]</default_value>
<edit_format_params>Robert9\BetterFieldFilter\Option\ThreadField::renderSelectMultiple</edit_format_params>
<sub_options>*</sub_options>
<relation group_id="r9_bff" display_order="20"/>
</option>
In Robert\BetterFieldFilter\Option\ThreadField::renderSelectMultiple
i fetch values from
one thread custom field, throw it in a template and let it show in the addon's option page.
Now i can save an array. Now I can change the values for my field and have them here. Now I have an array for a template.
But, if someone has an idea how to make this fast and dirty, you are welcome.
Finally i just want to save something like:
24,red
25,blue
26,green
I can save this in a text-field, but I want to use it as an array directly in a template!
Yes, I can call this in a class and explode it. But, i repeat it:
Is there a way to have an add-on option and use it as an array in a template, without any step between?
It should be something like:
Code:
<option option_id="r9_abc_fields" edit_format="lined_commalist_to_array" data_type="array" advanced="0">
<default_value>[]</default_value>
<edit_format_params>24,red
25,blue
26,green</edit_format_params>
<sub_options>*</sub_options>
<relation group_id="r9_abc" display_order="20"/>
</option>
And this
should be saved as an array.
No class, no larifari, just save some values and use them
in a template as an array.
Or it should be something like this:
option_field:24/blue,25/red,26/green
template_special_syntax: set $didel = explode two times by , and then by "/" to have an array!