From e0d0e4e02dfe73de54be2f70fa94ccfd0e682515 Mon Sep 17 00:00:00 2001 From: Edir Pedro Date: Mon, 22 Oct 2018 13:17:36 -0300 Subject: [PATCH] fix bug with cloned fc --- acf-flexible-content-modal.php | 2 +- readme.txt | 5 ++++- script.js | 5 ++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/acf-flexible-content-modal.php b/acf-flexible-content-modal.php index 9338f3c..3583803 100644 --- a/acf-flexible-content-modal.php +++ b/acf-flexible-content-modal.php @@ -4,7 +4,7 @@ * Plugin Name: ACF Flexible Content Modal * Description: Make ACF Flexible Content editing the content of each layout using a Modal window. * Plugin URI: http://wordpress.org/plugins/acf-flexible-content-modal/ - * Version: 1.2.1 + * Version: 1.2.2 * Author: Edir Pedro * Author URI: http://edirpedro.com.br * License: GPL2 diff --git a/readme.txt b/readme.txt index f672ba8..5c2f97d 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: edir Tags: acf, advanced-custom-field, flexible-content Requires at least: 4.5.2 Tested up to: 4.9.7 -Stable tag: 1.2.1 +Stable tag: 1.2.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -33,6 +33,9 @@ If you want to name each of the flexible content layout, you can use the ACF hoo == Changelog == += 1.2.2 = +* Fixed bug with cloned FC's. + = 1.2.1 = * All Flexible Content fields can open in a modal, even nested fields. * Fixed action to refresh layout_title hook. diff --git a/script.js b/script.js index 49871bb..236f756 100644 --- a/script.js +++ b/script.js @@ -98,10 +98,9 @@ var $layout = ACFFCM.modals.pop(); // Refresh layout title - + var fc = $layout.parents('.acf-field-flexible-content:first'); - fc = acf.getInstance(fc); - var field = fc.getField(fc.data.key); + var field = acf.getInstance(fc); field.closeLayout(field.$layout($layout.index())); // Close