Hi,
is it possibile to dinamically populate a select field inside a flexible-field, using a repeater field placed inside the option page?
I’ve followed your tutorial and look up to the support forum but cannot manage to find a solution to both my problems: the select field remains empty and I get a “Warning: trim() expects parameter 1 to be string, array given in” just above the empty select (and that’s very strange)
Here is my code:
function makerBot( $field )
{
$field['choices'] = array();
if(get_field('cta_makerbot', 'option'))
{
while(has_sub_field('cta_makerbot', 'option'))
{
$value = get_sub_field('class');
$label = get_sub_field('nicename');
$field['choices'][$value] = $label;
}
}
return $field;
}
add_filter('acf/load_value/key=field_52f8f9253c9ca', 'makerBot');
thanks for your help!
[quick update post-debug]
this is my array before $field
Array
(
[choices] => Array
(
[home] => Homepage
[servizi] => Servizi
)
)
(Results are correct)
Fixed! How? I don’t know. I simply erased/redo everything and it worked 🙂
Bottom line: thanks again for your incredible work with ACF, you’ve completely change the way I design websites and I owe you big time
cheers!