Dynamic Preview – repeater is returning additional row with empty fields
-
Hi
I’ve observed that when I have Repeater field in the Flexible Field and I’m showing it in the Dynamic Preview, the amount of returned rows is bigger than on the frontend by one.
Could you check this problem?
Best regards
-
Hello,
Thanks for the report!
I think the additional row you get in your data is the “clone” (the actual row model).
This behavior is identic to the Gutenberg ACF Block preview. I’ll see what I can do about that. Meanwhile you can probably exclude it using the field key/name, should be something like
acfcloneindex.I’ll dig in and let you know what I find!
Regards.
Hi
I observed that in the backend ACF is returning additional Array item in the repeater with
acfcloneindexname. Do you know how can I ignore this row when I’m using standard ACF repeater walker?<?php if( have_rows('teaser') ): ?><?php while ( have_rows('teaser') ) : the_row(); ?>I’ve tried:
get_row_index()function – it’s returning only numbers-
get_row()– it’s not returning array item name
Hello!
To check your problem I’ve setup a test and I wasn’t able to reproduce the problem. Here is my test example:
Field Group: Flexible
Fields:
– Flexible Content (Settings: Layouts Render & Layouts Dynamic Preview)
— Field: Repeater
— Sub field: TextI’ve set a custom
template.phpfile in my theme to take care of preview/front display. Here is the code:<pre><?php print_r(get_sub_field('repeater')); ?></pre> <br /> <?php if(have_rows('repeater')): ?> <?php while(have_rows('repeater')): the_row(); ?> <?php echo get_row_index(); ?> - <?php echo get_sub_field('text'); ?> <?php endwhile; ?> <?php endif; ?>Screenshots of the result: https://imgur.com/a/oeHyZPc
Everything just works fine. Can you please share some more informations about your
template.phpfile or code example please?Thanks!
Regards.
Hello,
Any news about your problem?
Regards.
I’m sorry. I have too much work this week. It’s on my to-do list to answer here đ
Hello!
Still no news? I still haven’t managed to reproduce your problem.
Regards.
I’m facing the similar issue. You may check here: https://imgur.com/gallery/OBrw6pn
Issue is in backend preview not in front end view.
After adding repeater item it looks fine. Then save and reload the page. You must reload or reopen the page editor to find the issue. Issue disappears as soon as i open the block editor and close it.
acfcloneindex is being added
-
This reply was modified 6 years, 5 months ago by
Sabbir Hasan.
Hello!
Thanks for the report! I still haven’t managed to reproduce this problem. Please can you confirm that you’re using the latest WP + ACF Pro + ACF Extended version?
Your second screenshot display the form fields HTML, which always include an
acfcloneindexrow. It is used as template for the javascript “Add row” action.This HTML code is perfectly normal, what is abnormal is that it is sent to the preview mode via ajax, as it should be filtered out.
Regards.
Check this link. https://imgur.com/a/6Z3lga5 It’s actually being sent to admin-ajax.php as param.
I’m on latest WP + ACF Pro + ACF Extended
Hello,
Hmmm that’s weird, I’ll re-run a test. In the meantime, can you send me the PHP export of your field group that includes the flexible content + repeater fields?
Regards.
Hello,
I ran new tests, and everything works fine. Please send me your field configuration, so I can reproduce the problem.
Regards.
Hello everyone,
After going thru extensive tests, I figured out where it come from.
This bug appear only when you enable the “Modal Edition” setting coupled with “Dynamic Preview” in your flexible content field.
Here is the fix: In the file
acf-extended\assets\acf-extended-fc.jsline:228. Replace:// Flexible has Modal Edition if(flexible.has('acfeFlexibleModalEdition')){ $layout.addClass('-collapsed'); flexible.acfeLayoutInit($layout); return; }With:
// Flexible has Modal Edition if(flexible.has('acfeFlexibleModalEdition')){ flexible.acfeCloseLayoutInit($layout); return; }I’ll add the fix in the next update đ
Regards.
Hello,
Just to let you know that the latest 0.8.4 update include this fix đ
Regards.
The topic ‘Dynamic Preview – repeater is returning additional row with empty fields’ is closed to new replies.