Issues with sub-field display and database saving
-
Hi there,
I’m having an oddity with SCF cloned fields within flexible-content.
I have a field group ‘Blocks‘, containing a flexible-content field, which contains several layouts.
Each layout (e.g. Accordions /
accordions, Content Boxes /content_boxes), has one seamless field ‘Settings‘, which is a clone of a field-group containing fields for that block, e.g. ‘Block – Accordions‘ (section_id, width, title, accordions, block_visibility, ...).However, in the backend when I add a block to the flexible-content, only some render correctly (seamlessly displaying the ‘Settings‘ field). Others show the ‘Settings‘ field-group name.
The first item always renders correctly, but the others ONLY render correctly if their fields do not have any of the following field-types: Clone, Repeater, or Tab.
When I save, the data is saved in the same way, i.e. the first one saves correctly:
Data: Array
(
[acf_fc_layout] => accordions
[section_id] => accordion-1
[width] => full-width
[title] => Accordions Title
[testttt] =>
[accordions] => Array
(
[0] => Array
(
[title] => Accordion one
[content] => <p>Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here.</p>
<p>Accordion one content goes in here. Accordion one content goes in here.</p>
<p>Accordion one content goes in here.</p>
<p>Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here. Accordion one content goes in here.</p>
)
[1] => Array
(
[title] => Accordion two
[content] => <p>Accordion two content goes in here. Accordion two content goes in here. Accordion two content goes in here. Accordion two content goes in here. Accordion two content goes in here. Accordion two content goes in here. Accordion two content goes in here. Accordion two content goes in here. Accordion two content goes in here.</p>
)
)
[visibility] => Array
(
[hide-mobile] =>
[hide-tablet] =>
[hide-desktop] =>
)
)However, the others save WITHIN the ‘Settings‘ clone key:
Data: Array
(
[acf_fc_layout] => content_boxes
[settings] => Array
(
[] =>
[section_id] => content-boxes-1
[title] => Content Boxes One Title
[columns] => 4
[text_align] => text-right
[boxes] => Array
(
[0] => Array
(
[title] => Box One
[icon_class] => fa-tty fas
[text] => This is the content of box one. This is the content of box one. This is the content of box one. This is the content of box one. This is the content of box one.
[link] => Array
(
[title] => Box one link title
[url] => #
[target] =>
)
)
[1] => Array
(
[title] => Box Two
[icon_class] => fa-balance-scale-right fas
[text] => This is the content of box two. This is the content of box two. This is the content of box two.
This is the content of box two. This is the content of box two.
[link] => Array
(
[title] => Box two link
[url] => #
[target] => _blank
)
)
)
[visibility] => Array
(
[hide-mobile] =>
[hide-tablet] =>
[hide-desktop] =>
)
)
)I have tested everything with ACF and an older ACF Pro, and this works correctly, with the consistent seamless saving. ACF JSON also shows there are no discrepancies between the working and non-working layouts e.g.
"display": "seamless", "position": "normal", "style": "default", ...).TLDR; Seamless clone fields within flexible-content are saving inconsistently. While the first layout correctly flattens data, subsequent layouts containing Repeaters, Clones, or Tabs fail to remain seamless, incorrectly nesting all data under the
[settings]key.
You must be logged in to reply to this topic.