Extends the ACF Flexible Content Field by transforming the layout list into a modal with image previews. Editing the fields layouts also happens in a modal for a better editing user experience.
Other
21
stars
9
forks
source link
Preview missing for duplicated flexible layouts #11
When you create a flexible layout, duplicate it (using the built-in ACF quick action) and then keep the fields intact in the copy by just renaming them, they keep their internal key. Thats means they are being mistakenly skipped as duplicates by this retrieve_flexible_keys_from_fields() check in /classes/main.php:
if ( ! empty( $keys[ $layout_field['key'] ] ) ) {
and ignored, which means the preview for any but the most recent layouts is missing.
I have fixed it by combining the parent layout key (which does change upon duplication) with the field key so the key is really unique, like this:
When you create a flexible layout, duplicate it (using the built-in ACF quick action) and then keep the fields intact in the copy by just renaming them, they keep their internal key. Thats means they are being mistakenly skipped as duplicates by this
retrieve_flexible_keys_from_fields()
check in/classes/main.php
:if ( ! empty( $keys[ $layout_field['key'] ] ) ) {
and ignored, which means the preview for any but the most recent layouts is missing.
I have fixed it by combining the parent layout key (which does change upon duplication) with the field key so the key is really unique, like this:
Happy to provide you with an example or with a PR if you'd like.