Home › Forums › Add-ons › Repeater Field › Convert raw repeater data back into an array › Reply To: Convert raw repeater data back into an array
That’s interesting and it will not be easy to convert that.
An explanation
this holds the field value [heading_level]
this holds the ACF field key reference [_heading_level]
In this case blocks-recipes-heading_level
I am assuming this is constructed like "block-{$block_name}-{$field_name}"
block-
simply tells ACF that this field belongs to a block.
On to the repeater
This [filter_categories_0_category]
the ‘category’ field from the 1st row of the the ‘filter_categories’ repeater. This index is constructed like this "{$repeater_field_name}_{$row_index}_{$sub_field_name}"
In order to build an array you would need to loop over the data and parse the array index and create what ACF usually stores in an array. You would also need to format the values.
Going to be honest, I have no idea how you’d do this, especially considering that you have multiple possible secondary sub fields dependent of the value of the first sub field.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.