AdvancedCustomFields / acf

Advanced Custom Fields
http://advancedcustomfields.com/
823 stars 168 forks source link

Nested cloned repeater only works for 1 level #908

Open gRoberts84 opened 1 month ago

gRoberts84 commented 1 month ago

Describe the bug Questions (Repeater) -- Question (Text) ---- Answers (Repeater) ------ Answer (Text) -------- Questions (Clone Questions)

I have a Flexible layout with a Clone field to the Component: Questions field.

The Component: Questions field then clones itself within the Answer repeater.

When adding a question and answer, it shows the Questions repeater however if I then add a question and answer, the Questions repeater no longer shows:

image

To Reproduce Steps to reproduce the behavior:

  1. Go to ACF > Tools, import attached json.
  2. Go to ACF > Field Groups.
  3. Create new field.
  4. Add Clone field, called Questions and select "All fields from Component: Questions"
  5. Click Save.
  6. Go to Posts > Add New.
  7. Click on Add Question.
  8. Click on Add Answer
  9. Click on Add Question.

Expected behavior Questions repeater will be cloned along with the other fields.

Code

[
    {
        "key": "group_66422429e4b06",
        "title": "Component: Questions",
        "fields": [
            {
                "key": "field_6642242adcbbf",
                "label": "Questions",
                "name": "questions",
                "aria-label": "",
                "type": "repeater",
                "instructions": "",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "layout": "block",
                "pagination": 0,
                "min": 0,
                "max": 0,
                "collapsed": "field_66422443dcbc0",
                "button_label": "Add Question",
                "rows_per_page": 20,
                "sub_fields": [
                    {
                        "key": "field_66422443dcbc0",
                        "label": "Question",
                        "name": "question",
                        "aria-label": "",
                        "type": "text",
                        "instructions": "",
                        "required": 1,
                        "conditional_logic": 0,
                        "wrapper": {
                            "width": "",
                            "class": "",
                            "id": ""
                        },
                        "default_value": "",
                        "maxlength": "",
                        "placeholder": "",
                        "prepend": "",
                        "append": "",
                        "parent_repeater": "field_6642242adcbbf"
                    },
                    {
                        "key": "field_6642244bdcbc1",
                        "label": "Answers",
                        "name": "answers",
                        "aria-label": "",
                        "type": "repeater",
                        "instructions": "",
                        "required": 1,
                        "conditional_logic": 0,
                        "wrapper": {
                            "width": "",
                            "class": "",
                            "id": ""
                        },
                        "layout": "block",
                        "pagination": 0,
                        "min": 0,
                        "max": 0,
                        "collapsed": "field_66422471dcbc3",
                        "button_label": "Add Answer",
                        "rows_per_page": 20,
                        "sub_fields": [
                            {
                                "key": "field_66422459dcbc2",
                                "label": "Icon",
                                "name": "icon",
                                "aria-label": "",
                                "type": "select",
                                "instructions": "",
                                "required": 1,
                                "conditional_logic": 0,
                                "wrapper": {
                                    "width": "25",
                                    "class": "",
                                    "id": ""
                                },
                                "choices": {
                                    "icon-privacy": "Privacy",
                                    "icon-glare": "Heat\/Glare Reduction",
                                    "icon-safety": "Safety\/Security",
                                    "icon-sun": "UV Protection",
                                    "icon-energy-efficiency": "Energy\/Efficiency",
                                    "icon-half": "Daytime",
                                    "icon-full": "24 hour",
                                    "icon-neutral": "Neutral",
                                    "icon-reflective": "Reflective",
                                    "icon-clear": "Clear"
                                },
                                "default_value": false,
                                "return_format": "value",
                                "multiple": 0,
                                "allow_null": 0,
                                "ui": 0,
                                "ajax": 0,
                                "placeholder": "",
                                "parent_repeater": "field_6642244bdcbc1"
                            },
                            {
                                "key": "field_66422471dcbc3",
                                "label": "Answer",
                                "name": "answer",
                                "aria-label": "",
                                "type": "text",
                                "instructions": "",
                                "required": 1,
                                "conditional_logic": 0,
                                "wrapper": {
                                    "width": "75",
                                    "class": "",
                                    "id": ""
                                },
                                "default_value": "",
                                "maxlength": "",
                                "placeholder": "",
                                "prepend": "",
                                "append": "",
                                "parent_repeater": "field_6642244bdcbc1"
                            },
                            {
                                "key": "field_664224ee76777",
                                "label": "Products",
                                "name": "products",
                                "aria-label": "",
                                "type": "post_object",
                                "instructions": "",
                                "required": 0,
                                "conditional_logic": 0,
                                "wrapper": {
                                    "width": "",
                                    "class": "",
                                    "id": ""
                                },
                                "post_type": "",
                                "post_status": "",
                                "taxonomy": "",
                                "return_format": "object",
                                "multiple": 1,
                                "allow_null": 0,
                                "bidirectional": 0,
                                "ui": 1,
                                "bidirectional_target": [],
                                "parent_repeater": "field_6642244bdcbc1"
                            },
                            {
                                "key": "field_6642250f76778",
                                "label": "Inner Questions",
                                "name": "inner_questions",
                                "aria-label": "",
                                "type": "clone",
                                "instructions": "",
                                "required": 0,
                                "conditional_logic": 0,
                                "wrapper": {
                                    "width": "",
                                    "class": "",
                                    "id": ""
                                },
                                "clone": [
                                    "group_66422429e4b06"
                                ],
                                "display": "seamless",
                                "layout": "block",
                                "prefix_label": 0,
                                "prefix_name": 0,
                                "parent_repeater": "field_6642244bdcbc1"
                            }
                        ],
                        "parent_repeater": "field_6642242adcbbf"
                    }
                ]
            }
        ],
        "location": [
            [
                {
                    "param": "post_type",
                    "operator": "==",
                    "value": "post"
                }
            ]
        ],
        "menu_order": 0,
        "position": "normal",
        "style": "default",
        "label_placement": "top",
        "instruction_placement": "label",
        "hide_on_screen": "",
        "active": false,
        "description": "",
        "show_in_rest": 0
    }
]

Version Information: