Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Commit

Permalink
ACF57 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
funkjedi committed Oct 26, 2018
1 parent d6121ab commit 1814483
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions assets/acf_5/qtranslatex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

(function(){

var windowLoadCompleted = false;
jQuery(window).load(function() {

Expand Down Expand Up @@ -88,16 +89,22 @@
// Watch and remove content hooks when fields are removed
// however ACF removes the elements from the DOM early so
// we must hook into handler and perform updates there
var _hooked_repeater_remove = acf.fields.repeater.remove;
acf.fields.repeater.remove = function($el) {
var repeaterFieldRemove;

if (acf.models) {
repeaterFieldRemove = acf.models.RepeaterField.prototype.remove;
} else {
repeaterFieldRemove = acf.fields.repeater.remove;
}

function repeaterRemove($el) {
var row = ($el.$el || $el).closest('.acf-row'); // support old versions of ACF5PRO as well
row.find(_.toArray(field_types).join(',')).filter('.qtranxs-translatable').each(function() {
qTranslateConfig.qtx.removeContentHook(this);
});
// call the original handler
_hooked_repeater_remove.call(this, $el);
repeaterFieldRemove.call(this, $el);
};

});

})();

0 comments on commit 1814483

Please sign in to comment.