Support

Account

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.