AdvancedCustomFields / AdvancedCustomFields/acf
ACF 5.8.0-RC2 - Repeater Field in Gutenberg Block Disappears
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
I have created a field group in my theme which container a few fields, one of which is a repeater. When this is added to the page, I can add and save as normal. If I then move the block from the bottom of the page to anywhere else, it then breaks the repeater. The other fields still contain their values, however the repeater has no rows and I see no content in post_content in the database.
My field group:
acf_add_local_field_group([
'key' => 'features_grid_block_group',
'title' => 'Features Grid',
'fields' => [
[
'key' => 'features_grid_image',
'label' => 'Background Image',
'name' => 'background_image',
'type' => 'image',
'return_format' => 'array',
'preview_size' => 'thumbnail',
'mime_types' => 'jpg, jpeg'
],
[
'key' => 'features_grid_title',
'label' => 'Title',
'name' => 'grid_title',
'type' => 'text'
],
[
'key' => 'features_grid_text',
'label' => 'Summary',
'name' => 'grid_text',
'type' => 'textarea'
],
[
'key' => 'features_grid_features',
'label' => 'Features',
'name' => 'features_grid_repeater',
'type' => 'repeater',
'layout' => 'table',
'button_label' => '',
'sub_fields' => [
[
'key' => 'features_grid_feature_image',
'label' => 'Feature Image',
'name' => 'feature_image',
'type' => 'image',
'return_format' => 'array',
'preview_size' => 'thumbnail',
'mime_types' => 'jpg, jpeg, png',
],
[
'key' => 'features_grid_feature_text',
'label' => 'Feature Text',
'name' => 'feature_text',
'type' => 'text'
]
]
]
],
'location' => [
[
[
'param' => 'block',
'operator' => '==',
'value' => 'acf/cwc-features-grid',
]
]
]
]);
Adding this to the page and saving gives me the following post_content markup (appears after all other wp: elements
<!-- wp:acf/cwc-features-grid {"id":"block_5cdab9017e19c","data":{"features_grid_image":"","features_grid_title":"Features Grid End","features_grid_text":"Summary text here","features_grid_features":{"row-0":{"features_grid_feature_image":"17","features_grid_feature_text":"first feature"},"row-1":{"features_grid_feature_image":"17","features_grid_feature_text":"second feature"},"row-2":{"features_grid_feature_image":"17","features_grid_feature_text":"third feature"}}},"name":"acf/cwc-features-grid","align":"","mode":"auto"} /-->
If I move the block up the page, the markup changes to:
<!-- wp:acf/cwc-features-grid {
"id": "block_5cdab9017e19c",
"data": {
"background_image": "",
"_background_image": "background_image",
"grid_title": "Features Grid End a",
"_grid_title": "features_grid_title",
"grid_text": "Summary text here a",
"_grid_text": "features_grid_text",
"features_grid_repeater": "",
"_features_grid_repeater": "features_grid_features"
},
"name": "acf\/cwc-features-grid",
"align": "",
"mode": "auto"
} /-->
Is there a way for me to debug the issue, or have I got some of the acf_add_local_field_group syntax wrong?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the shown acf_add_local_field_group configuration: save the Gutenberg block at the bottom, then move it and compare the post_content markup. Trace how the block data and repeater rows are serialized during that move; done means the repeater rows remain present after repositioning and saving.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, content
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100