This repository has been archived by the owner on Apr 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
972e6a1
commit 1b8f85a
Showing
2 changed files
with
18 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,23 @@ | ||
// Delete the ACF Beautiful Flexible popup if only one layout | ||
jQuery(document).ready(function ($) { | ||
try { | ||
// ACF Flexible Content: Ajouter une class à la modal de sélection de Layouts | ||
var flexible_content_position = acf.fields.flexible_content.position_popup; | ||
acf.fields.flexible_content.position_popup = function ($popup, $bouton) { | ||
// Continuer l'exécution normalement | ||
return flexible_content_position.apply(this, arguments); | ||
var flexible_content_open = acf.fields.flexible_content._open; | ||
acf.fields.flexible_content._open = function (e) { | ||
var $popup = $(this.$el.children('.tmpl-popup').html()); | ||
if ($popup.find('a').length == 1) { | ||
// Only one layout | ||
acf.fields.flexible_content.add($popup.find('a').attr('data-layout')); | ||
return false; | ||
} | ||
} catch (e) { | ||
return flexible_content_open.apply(this, arguments); | ||
} | ||
}); | ||
|
||
jQuery(document).ready(function ($) { | ||
try { | ||
// ACF Flexible Content: Supprimer la popup si il n'y a qu'un seul Layout | ||
var flexible_content_open = acf.fields.flexible_content._open; | ||
acf.fields.flexible_content._open = function (e) { | ||
var $popup = $(this.$el.children('.tmpl-popup').html()); | ||
// On compte le nombre de layouts | ||
if ($popup.find('a').length == 1) { | ||
acf.fields.flexible_content.add($popup.find('a').attr('data-layout')); | ||
return false; | ||
} | ||
// Si plus d'un layout, continuer l'exécution normalement | ||
return flexible_content_open.apply(this, arguments); | ||
} | ||
} catch (e) { | ||
} | ||
}); | ||
|
||
jQuery(document).ready(function ($) { | ||
$('a[data-name="add-layout"]').on('click', function () { | ||
setTimeout(function () { | ||
$(".acf-fc-popup a").each(function () { | ||
var html = "<div>" + $(this).text() + "</div>"; | ||
$(this).html(html); | ||
}); | ||
}, 0); | ||
}); | ||
// Transform a link into a div for styling purpose | ||
jQuery('body').on('click', 'a[data-name="add-layout"]', function () { | ||
setTimeout(function () { | ||
$(".acf-fc-popup a").each(function () { | ||
var html = "<div>" + $(this).text() + "</div>"; | ||
$(this).html(html); | ||
}); | ||
}, 0); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.