Hi,
I’m trying to add a function that makes it possible to drag and drop different row layouts between different flexible fields. I use ACF as a page builder. The idea is that user can drag an element (for ex. an image) from the left column to the right column.
I managed to make this possible with the script below. The only problem is when I hit preview or save the page the changes are stored in the database.
Any help is much appreciated.
This goes into the functions.php
// Add ACF script to admin footer
function my_acf_input_admin_footer() {
?>
<script type="text/javascript">
(function($) {
$( ".values" ).sortable({
connectWith: ".values"
})
})(jQuery);
</script>
<?php
}
add_action('acf/input/admin_footer', 'my_acf_input_admin_footer');
This is a great idea. I’d love to see this actually working. I tried your code and it works inside the editor. The post doesn’t save correctly though.
I’ve logged a feature request that does something similar. Despite the title referencing repeaters, the base idea is dragging ‘flexible content layouts’ between multiple instances of the same ‘flexible content field’
It’s here: https://support.advancedcustomfields.com/forums/topic/drag-flexible-content-layouts-between-parent-repeaters/