Home › Forums › General Issues › Integrate ACF in a custom admin layout with dynamic content boxes › Reply To: Integrate ACF in a custom admin layout with dynamic content boxes
After our exchange yesterday, I thought everything through again today.
I have created a new field based on the boilerplate.
I now use a single field group that I want to display in my boxes for editing. In the render_field() function, I can read the field group with acf_get_field_group() and output the fields accordingly in my boxes with acf_render_field_wrap().
For saving, I retrieve the data from $_POST and place my box identifier, e.g. {$box_field_name}_{$field_name}, in front of the post_meta keys. This works with simple text fields, but reading in and out repeaters is more difficult.
The correct number of lines are displayed and saved, but the values remain empty. What could be the reason for this?
if(isset($field_object['sub_fields'])){
foreach ($field_object['sub_fields'] as $sub_field) {
$field_value = get_field($sub_field['key'], $id);
$acf_render_subfield_attributes[] =
array(
'type' => $sub_field['type'],
'name' => $sub_field['name'],
'value' => $field_value,
'key' => $sub_field['key'],
'label' => $sub_field['label'],
'instructions' => $sub_field['instructions'],
'required' => $sub_field['required']
);
}
}
$acf_render_attributes['sub_fields'] = $acf_render_subfield_attributes
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.