Version Description
- Field Group: Hide on Screen - Added "Block Editor" (Gutenberg) setting, allowing administrator to disable the block editor on field group location
- Field Group: Third Party - Fixed Export/Sync Clones fields being processed during the action
- Field Group: Postbox Seamless CSS class are now added in PHP, which remove the blink during admin page load caused by the class being added in JS
- Field Group: Raw Data button now also display the WP_Post object
- Field: Button - Before/After HTML settings are now using code editor
- Field: Button - Ajax call - Added nominative hooks allowing to target specific field. Hook is now easier. Instructions have been updated
- Field: Flexible Content - Added "Advanced Flexible Content" setting (ON/OFF). All advanced settings are now hidden by default and depend on that setting to be shown. (Retro compatibility: if any advanced setting has been saved before, this setting will be set to ON)
- Field: Flexible Content - Added "Clone" button as a setting (Not enabled by default in all flexible content anymore)
- Field: Flexible Content - Added "Hide: Add Layout Button" setting
- Field: Flexible Content - Added "Hide: Remove Layout Button" setting
- Field: Flexible Content - Added "Lock Flexible Content" (sortable) setting
- Field: Flexible Content - Flexible Content can now be completely locked and all actions removed from the field settings
- Field: Flexible Content - Layout Settings modal now allow multiple clones
- Field: Flexible Content - Layout Settings modal size can now be selected for each layout (small/medium/large/extra large/full)
- Field: Flexible Content - Fixed "Force State: Open" not working correctly in some specific cases
- Field: Flexible Content - Fixed Modal Selection z-index problem on attachment screen
- Field: Flexible Content - Fixed Modal Edition z-index problem with button group (when already inside a modal)
- Field: Flexible Content - Fixed a bug causing duplicated "Layout Setting" & "Layout Title Edition" fields when export/re-importing a field group with flexible content that had this settings
- Field: Taxonomy Terms - Fixed a PHP notice when "Load Terms" was enabled with "select" as field type
- Field: Group/Clone - Seamless style CSS fixed in term view
- Field: Color Picker - Added position relative property when the field is used inside a modal
- Field: Hidden - Added global CSS style
- Module: Single Meta Save - Improved save process performance (it's now even faster!)
- Module: Dynamic Forms - Added
{query_var:var}
template tag in E-mail action, Post Load source, Post Target, Term Load source, Term Target & User Load source, Redirection & Updated Message fields. This will allow user to retrieve a specificquery_var
and use it dynamically - Module: Dynamic Forms -
{query_var:var}
template tag also allow to specific key if the value is an array, using the following tag:{query_var:var:key}
- Module: Dynamic Forms - New "Query var" settings on Post, Terms, Users & E-mail actions that generate a custom query var based on the "Action name" after completing the action. For example: Post Action with Action name "my-action" will generate a
query_var
namedmy-action
and as value the post data (array) that has been created/updated. Thisquery_var
can be accessed usingget_query_var('my-action');
or the template tag{query_var:my-action:ID}
(Post ID),{query_var:my-action:post_title}
(Post Title),{query_var:my-action:permalink}
(Post Permalink),{query_var:my-action:admin_url}
(Post Admin URL) - Module: Dynamic Forms - Fixed shortcode not working correctly when using Form ID instead of Form name
- Module: Dynamic Forms - Actions UI Layouts can now be collapsed
- Module: Dev Mode - Added Meta Overview for Options Page
- Module: Options Page - Child Options page are now correctly displayed as child in the Options Page UI
- General: Modal - Added localization for the "Close" button
- General: Modal - Added Small/Medium/Large/Extra Large/Full sizes
Download this release
Release Info
Developer | hwk-fr |
Plugin | Advanced Custom Fields: Extended |
Version | 0.8.4.5 |
Comparing to | |
See all releases |
Code changes from version 0.8.4.1 to 0.8.4.5
- acf-extended.php +2 -2
- assets/acf-extended-admin.css +11 -0
- assets/acf-extended-fc-control.js +1 -1
- assets/acf-extended-fc-modal-edit.js +1 -1
- assets/acf-extended-fc.css +1 -1
- assets/acf-extended-fc.js +33 -1
- assets/acf-extended-fg.css +18 -1
- assets/acf-extended-fg.js +44 -21
- assets/acf-extended-fields.js +187 -5
- assets/acf-extended-modal.css +70 -4
- assets/acf-extended.css +20 -6
- assets/acf-extended.js +31 -3
- includes/admin/tools/fg-local.php +3 -0
- includes/core/compatibility.php +40 -9
- includes/core/enqueue.php +2 -2
- includes/core/helpers.php +76 -46
- includes/field-groups/field-group.php +102 -21
- includes/field-groups/field-groups.php +21 -0
- includes/fields-settings/fields.php +70 -3
- includes/fields/field-button.php +31 -10
- includes/fields/field-clone.php +190 -133
- includes/fields/field-flexible-content.php +1621 -1245
- includes/fields/field-group.php +172 -106
- includes/fields/field-hidden.php +1 -8
- includes/fields/field-taxonomy-terms.php +1 -1
- includes/locations/post-type-archive.php +2 -8
- includes/modules/dev.php +188 -130
- includes/modules/dynamic-options-page.php +14 -0
- includes/modules/form/actions/email.php +47 -6
- includes/modules/form/actions/post.php +36 -8
- includes/modules/form/actions/term.php +49 -15
- includes/modules/form/actions/user.php +30 -1
- includes/modules/form/admin.php +318 -171
- includes/modules/form/field-group.php +131 -40
- includes/modules/form/form-front.php +25 -24
- includes/modules/single-meta.php +45 -25
- readme.txt +46 -7
acf-extended.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: Enhancement Suite which improves Advanced Custom Fields administration
|
5 |
-
* Version: 0.8.4.
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
@@ -16,7 +16,7 @@ if(!class_exists('ACFE')):
|
|
16 |
class ACFE{
|
17 |
|
18 |
// Version
|
19 |
-
var $version = '0.8.4.
|
20 |
|
21 |
// Settings
|
22 |
var $settings = array();
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: Enhancement Suite which improves Advanced Custom Fields administration
|
5 |
+
* Version: 0.8.4.5
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
16 |
class ACFE{
|
17 |
|
18 |
// Version
|
19 |
+
var $version = '0.8.4.5';
|
20 |
|
21 |
// Settings
|
22 |
var $settings = array();
|
assets/acf-extended-admin.css
CHANGED
@@ -22,6 +22,17 @@ code, kbd, pre, samp{
|
|
22 |
font-size: 1em;
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
/*
|
26 |
* ACFE: Postbox
|
27 |
*/
|
22 |
font-size: 1em;
|
23 |
}
|
24 |
|
25 |
+
/*
|
26 |
+
* Postbox seamless
|
27 |
+
*/
|
28 |
+
.acf-postbox.seamless > .inside > .acf-field{
|
29 |
+
padding:15px 12px;
|
30 |
+
}
|
31 |
+
|
32 |
+
.acf-flexible-content .layout.ui-sortable-helper:first-child + .layout.ui-sortable-placeholder{
|
33 |
+
margin-top:0;
|
34 |
+
}
|
35 |
+
|
36 |
/*
|
37 |
* ACFE: Postbox
|
38 |
*/
|
assets/acf-extended-fc-control.js
CHANGED
@@ -146,7 +146,7 @@
|
|
146 |
// Open modal
|
147 |
acfe.modal.open($modal, {
|
148 |
title: $layout_order + ' ' + $layout_title,
|
149 |
-
footer:
|
150 |
onOpen: function(){
|
151 |
|
152 |
flexible.acfeEditorsInit($layout);
|
146 |
// Open modal
|
147 |
acfe.modal.open($modal, {
|
148 |
title: $layout_order + ' ' + $layout_title,
|
149 |
+
footer: acf.__('Close'),
|
150 |
onOpen: function(){
|
151 |
|
152 |
flexible.acfeEditorsInit($layout);
|
assets/acf-extended-fc-modal-edit.js
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
var close = false;
|
31 |
if(flexible.has('acfeFlexibleCloseButton')){
|
32 |
|
33 |
-
close = 'Close';
|
34 |
|
35 |
}
|
36 |
|
30 |
var close = false;
|
31 |
if(flexible.has('acfeFlexibleCloseButton')){
|
32 |
|
33 |
+
close = acf.__('Close');
|
34 |
|
35 |
}
|
36 |
|
assets/acf-extended-fc.css
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* Flexible: Sortable
|
3 |
*/
|
4 |
.acf-flexible-content > .values > .ui-sortable-placeholder{
|
5 |
-
height:147px
|
6 |
border-width:2px;
|
7 |
border-color:#ccc;
|
8 |
}
|
2 |
* Flexible: Sortable
|
3 |
*/
|
4 |
.acf-flexible-content > .values > .ui-sortable-placeholder{
|
5 |
+
/*height:147px;*/
|
6 |
border-width:2px;
|
7 |
border-color:#ccc;
|
8 |
}
|
assets/acf-extended-fc.js
CHANGED
@@ -9,6 +9,34 @@
|
|
9 |
var flexible = acf.getFieldType('flexible_content');
|
10 |
var model = flexible.prototype;
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
/*
|
13 |
* Actions
|
14 |
*/
|
@@ -219,7 +247,7 @@
|
|
219 |
$.ajax({
|
220 |
url: acf.get('ajaxurl'),
|
221 |
data: acf.prepareForAjax({
|
222 |
-
action: 'acfe/
|
223 |
field_key: this.get('key'),
|
224 |
layout: args.layout,
|
225 |
}),
|
@@ -286,6 +314,10 @@
|
|
286 |
// TinyMCE Init
|
287 |
flexible.acfeEditorsInit($layout);
|
288 |
|
|
|
|
|
|
|
|
|
289 |
// Closed
|
290 |
if(flexible.isLayoutClosed($layout)){
|
291 |
|
9 |
var flexible = acf.getFieldType('flexible_content');
|
10 |
var model = flexible.prototype;
|
11 |
|
12 |
+
/*
|
13 |
+
* Drag & Drop
|
14 |
+
*/
|
15 |
+
model.addSortable = function( self ){
|
16 |
+
|
17 |
+
// bail early if max 1 row
|
18 |
+
if( this.get('max') == 1 ) {
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
|
22 |
+
// add sortable
|
23 |
+
this.$layoutsWrap().sortable({
|
24 |
+
items: ' > .layout',
|
25 |
+
handle: '> .acf-fc-layout-handle',
|
26 |
+
forceHelperSize: false, // Changed to false
|
27 |
+
forcePlaceholderSize: true,
|
28 |
+
tolerance: "pointer", // Changed to pointer
|
29 |
+
scroll: true,
|
30 |
+
stop: function(event, ui) {
|
31 |
+
self.render();
|
32 |
+
},
|
33 |
+
update: function(event, ui) {
|
34 |
+
self.$input().trigger('change');
|
35 |
+
}
|
36 |
+
});
|
37 |
+
|
38 |
+
};
|
39 |
+
|
40 |
/*
|
41 |
* Actions
|
42 |
*/
|
247 |
$.ajax({
|
248 |
url: acf.get('ajaxurl'),
|
249 |
data: acf.prepareForAjax({
|
250 |
+
action: 'acfe/flexible/models',
|
251 |
field_key: this.get('key'),
|
252 |
layout: args.layout,
|
253 |
}),
|
314 |
// TinyMCE Init
|
315 |
flexible.acfeEditorsInit($layout);
|
316 |
|
317 |
+
// Force open
|
318 |
+
if(flexible.has('acfeFlexibleOpen'))
|
319 |
+
flexible.openLayout($layout);
|
320 |
+
|
321 |
// Closed
|
322 |
if(flexible.isLayoutClosed($layout)){
|
323 |
|
assets/acf-extended-fg.css
CHANGED
@@ -177,9 +177,14 @@ body.acf-admin-5-3 .acf-field-setting-fc_layout .acf-input-wrap.select select{
|
|
177 |
display:none;
|
178 |
}
|
179 |
|
|
|
|
|
|
|
|
|
180 |
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-title,
|
181 |
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-col,
|
182 |
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-categories{
|
|
|
183 |
padding-bottom:0;
|
184 |
padding-left:0;
|
185 |
border-top:0;
|
@@ -189,10 +194,18 @@ body.acf-admin-5-3 .acf-field-setting-fc_layout .acf-input-wrap.select select{
|
|
189 |
|
190 |
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings_label],
|
191 |
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_thumbnail],
|
192 |
-
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_category]
|
|
|
|
|
|
|
193 |
margin:0;
|
194 |
}
|
195 |
|
|
|
|
|
|
|
|
|
|
|
196 |
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings_label] > .acf-input{
|
197 |
margin:0;
|
198 |
}
|
@@ -201,6 +214,10 @@ body.acf-admin-5-3 .acf-field-setting-fc_layout .acf-input-wrap.select select{
|
|
201 |
margin:0;
|
202 |
}
|
203 |
|
|
|
|
|
|
|
|
|
204 |
/*
|
205 |
* ACFE Column
|
206 |
*/
|
177 |
display:none;
|
178 |
}
|
179 |
|
180 |
+
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-enabled{
|
181 |
+
margin-right:10px;
|
182 |
+
}
|
183 |
+
|
184 |
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-title,
|
185 |
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-col,
|
186 |
.acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-categories{
|
187 |
+
padding-top:0;
|
188 |
padding-bottom:0;
|
189 |
padding-left:0;
|
190 |
border-top:0;
|
194 |
|
195 |
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings_label],
|
196 |
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_thumbnail],
|
197 |
+
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_category],
|
198 |
+
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings_label],
|
199 |
+
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings],
|
200 |
+
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings_size]{
|
201 |
margin:0;
|
202 |
}
|
203 |
|
204 |
+
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings],
|
205 |
+
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings_size]{
|
206 |
+
margin-right: 10px;
|
207 |
+
}
|
208 |
+
|
209 |
.acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings_label] > .acf-input{
|
210 |
margin:0;
|
211 |
}
|
214 |
margin:0;
|
215 |
}
|
216 |
|
217 |
+
.acf-field-setting-fc_layout .select2-container--default .select2-selection--multiple li{
|
218 |
+
margin-bottom:0;
|
219 |
+
}
|
220 |
+
|
221 |
/*
|
222 |
* ACFE Column
|
223 |
*/
|
assets/acf-extended-fg.js
CHANGED
@@ -1,31 +1,54 @@
|
|
1 |
-
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
$(tbody).find('.acfe_modal_open:first').insertAfter($(this));
|
6 |
-
$(tbody).find('.acfe-modal:first').appendTo($('body'));
|
7 |
-
$(tbody).find('tr.acf-field-setting-acfe_field_data:first').remove();
|
8 |
-
});
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
|
|
|
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
});
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
|
28 |
-
$('.acf-field-setting-acfe_validate > .acf-input > .acf-repeater .acf-actions .acf-button').removeClass('button-primary');
|
29 |
-
$('.acf-field-acfe-meta > .acf-input > .acf-repeater .acf-actions .acf-button').removeClass('button-primary');
|
30 |
|
31 |
-
});
|
1 |
+
(function($){
|
2 |
|
3 |
+
if(typeof acf === 'undefined')
|
4 |
+
return;
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
/**
|
7 |
+
* ACF Extended: 0.8.4.5
|
8 |
+
* Field Flexible Content: Fix duplicated "layout_settings" & "layout_title"
|
9 |
+
*/
|
10 |
+
acf.addAction('ready_field_object', function(field){
|
11 |
|
12 |
+
// field_acfe_layout_abc123456_settings + field_acfe_layout_abc123456_title
|
13 |
+
if(!field.get('key').startsWith('field_acfe_layout_'))
|
14 |
+
return;
|
15 |
|
16 |
+
field.delete();
|
17 |
|
18 |
+
});
|
19 |
+
|
20 |
+
$(function(){
|
21 |
|
22 |
+
$('.button.edit-field').each(function(k, v){
|
23 |
+
|
24 |
+
var tbody = $(this).closest('tbody');
|
25 |
+
$(tbody).find('.acfe_modal_open:first').insertAfter($(this));
|
26 |
+
$(tbody).find('.acfe-modal:first').appendTo($('body'));
|
27 |
+
$(tbody).find('tr.acf-field-setting-acfe_field_data:first').remove();
|
28 |
+
|
29 |
});
|
30 |
|
31 |
+
$('.acfe_modal_open').click(function(e){
|
32 |
+
|
33 |
+
e.preventDefault();
|
34 |
+
|
35 |
+
var key = $(this).attr('data-modal-key');
|
36 |
+
|
37 |
+
var $modal = $('.acfe-modal[data-modal-key=' + key + ']');
|
38 |
+
|
39 |
+
acfe.modal.open($modal, {
|
40 |
+
title: 'Data',
|
41 |
+
size: 'medium'
|
42 |
+
});
|
43 |
+
|
44 |
+
});
|
45 |
+
|
46 |
+
$('.acf-field[data-name="active"]').after($('.acf-field[data-name="acfe_form"]'));
|
47 |
+
|
48 |
+
$('.acf-field-setting-acfe_settings > .acf-input > .acf-repeater .acf-actions .acf-button').removeClass('button-primary');
|
49 |
+
$('.acf-field-setting-acfe_validate > .acf-input > .acf-repeater .acf-actions .acf-button').removeClass('button-primary');
|
50 |
+
$('.acf-field-acfe-meta > .acf-input > .acf-repeater .acf-actions .acf-button').removeClass('button-primary');
|
51 |
|
52 |
+
});
|
|
|
|
|
53 |
|
54 |
+
})(jQuery);
|
assets/acf-extended-fields.js
CHANGED
@@ -483,7 +483,8 @@ function acfe_recaptcha(){
|
|
483 |
|
484 |
acfe.modal.open($modal, {
|
485 |
title: title,
|
486 |
-
size: '
|
|
|
487 |
onClose: function(){
|
488 |
model.onChange();
|
489 |
}
|
@@ -549,12 +550,36 @@ function acfe_recaptcha(){
|
|
549 |
var title = this.$el.find('> .acf-label').text().trim();
|
550 |
var $modal = this.$el.find('> .acf-input > .acfe-modal');
|
551 |
|
552 |
-
|
|
|
|
|
553 |
title = this.get('acfeGroupModalButton');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
|
555 |
// Open modal
|
556 |
acfe.modal.open($modal, {
|
557 |
-
title:
|
|
|
|
|
558 |
});
|
559 |
|
560 |
},
|
@@ -592,12 +617,37 @@ function acfe_recaptcha(){
|
|
592 |
var title = this.$el.find('> .acf-label').text().trim();
|
593 |
var $modal = this.$el.find('> .acf-input > .acfe-modal');
|
594 |
|
595 |
-
|
|
|
|
|
|
|
596 |
title = this.get('acfeCloneModalButton');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
|
598 |
// Open modal
|
599 |
acfe.modal.open($modal, {
|
600 |
-
title:
|
|
|
|
|
601 |
});
|
602 |
|
603 |
},
|
@@ -872,6 +922,138 @@ function acfe_recaptcha(){
|
|
872 |
acf.addAction('new_field/name=acfe_form_term_map_parent', acfe_form_map_fields);
|
873 |
acf.addAction('new_field/name=acfe_form_term_map_description', acfe_form_map_fields);
|
874 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
875 |
/**
|
876 |
* Module: Dynamic Forms (actions)
|
877 |
*/
|
483 |
|
484 |
acfe.modal.open($modal, {
|
485 |
title: title,
|
486 |
+
size: 'medium',
|
487 |
+
footer: acf.__('Close'),
|
488 |
onClose: function(){
|
489 |
model.onChange();
|
490 |
}
|
550 |
var title = this.$el.find('> .acf-label').text().trim();
|
551 |
var $modal = this.$el.find('> .acf-input > .acfe-modal');
|
552 |
|
553 |
+
// Title
|
554 |
+
if(!title.length){
|
555 |
+
|
556 |
title = this.get('acfeGroupModalButton');
|
557 |
+
|
558 |
+
}
|
559 |
+
|
560 |
+
// Close
|
561 |
+
var close = false;
|
562 |
+
|
563 |
+
if(this.has('acfeGroupModalClose')){
|
564 |
+
|
565 |
+
close = acf.__('Close');
|
566 |
+
|
567 |
+
}
|
568 |
+
|
569 |
+
// Size
|
570 |
+
var size = 'large';
|
571 |
+
|
572 |
+
if(this.has('acfeGroupModalSize')){
|
573 |
+
|
574 |
+
size = this.get('acfeGroupModalSize');
|
575 |
+
|
576 |
+
}
|
577 |
|
578 |
// Open modal
|
579 |
acfe.modal.open($modal, {
|
580 |
+
title: title,
|
581 |
+
size: size,
|
582 |
+
footer: close
|
583 |
});
|
584 |
|
585 |
},
|
617 |
var title = this.$el.find('> .acf-label').text().trim();
|
618 |
var $modal = this.$el.find('> .acf-input > .acfe-modal');
|
619 |
|
620 |
+
|
621 |
+
// Title
|
622 |
+
if(!title.length){
|
623 |
+
|
624 |
title = this.get('acfeCloneModalButton');
|
625 |
+
|
626 |
+
}
|
627 |
+
|
628 |
+
// Close
|
629 |
+
var close = false;
|
630 |
+
|
631 |
+
if(this.has('acfeCloneModalClose')){
|
632 |
+
|
633 |
+
close = acf.__('Close');
|
634 |
+
|
635 |
+
}
|
636 |
+
|
637 |
+
// Size
|
638 |
+
var size = 'large';
|
639 |
+
|
640 |
+
if(this.has('acfeCloneModalSize')){
|
641 |
+
|
642 |
+
size = this.get('acfeCloneModalSize');
|
643 |
+
|
644 |
+
}
|
645 |
|
646 |
// Open modal
|
647 |
acfe.modal.open($modal, {
|
648 |
+
title: title,
|
649 |
+
size: size,
|
650 |
+
footer: close
|
651 |
});
|
652 |
|
653 |
},
|
922 |
acf.addAction('new_field/name=acfe_form_term_map_parent', acfe_form_map_fields);
|
923 |
acf.addAction('new_field/name=acfe_form_term_map_description', acfe_form_map_fields);
|
924 |
|
925 |
+
var parseString = function( val ){
|
926 |
+
return val ? '' + val : '';
|
927 |
+
};
|
928 |
+
|
929 |
+
var inArray = function( v1, array ){
|
930 |
+
|
931 |
+
// cast all values as string
|
932 |
+
array = array.map(function(v2){
|
933 |
+
return parseString(v2);
|
934 |
+
});
|
935 |
+
|
936 |
+
return (array.indexOf( v1 ) > -1);
|
937 |
+
}
|
938 |
+
|
939 |
+
/**
|
940 |
+
* Select2: Args Variations
|
941 |
+
*/
|
942 |
+
acf.addFilter('select2_args', function(options, $select, data, field, instance){
|
943 |
+
|
944 |
+
options = acf.applyFilters('select2_args/type=' + field.get('type'), options, $select, data, field, instance);
|
945 |
+
options = acf.applyFilters('select2_args/name=' + field.get('name'), options, $select, data, field, instance);
|
946 |
+
options = acf.applyFilters('select2_args/key=' + field.get('key'), options, $select, data, field, instance);
|
947 |
+
|
948 |
+
return options;
|
949 |
+
|
950 |
+
});
|
951 |
+
|
952 |
+
/**
|
953 |
+
* Select2: Init Variations
|
954 |
+
*/
|
955 |
+
acf.addAction('select2_init', function($select, options, data, field, instance){
|
956 |
+
|
957 |
+
acf.doAction('select2_init/type=' + field.get('type'), $select, options, data, field, instance);
|
958 |
+
acf.doAction('select2_init/name=' + field.get('name'), $select, options, data, field, instance);
|
959 |
+
acf.doAction('select2_init/key=' + field.get('key'), $select, options, data, field, instance);
|
960 |
+
|
961 |
+
});
|
962 |
+
|
963 |
+
/**
|
964 |
+
* Select2: Ajax Data Variations
|
965 |
+
*/
|
966 |
+
acf.addFilter('select2_ajax_data', function(ajaxData, data, $el, field, instance){
|
967 |
+
|
968 |
+
ajaxData = acf.applyFilters('select2_ajax_data/type=' + field.get('type'), ajaxData, data, $el, field, instance);
|
969 |
+
ajaxData = acf.applyFilters('select2_ajax_data/name=' + field.get('name'), ajaxData, data, $el, field, instance);
|
970 |
+
ajaxData = acf.applyFilters('select2_ajax_data/key=' + field.get('key'), ajaxData, data, $el, field, instance);
|
971 |
+
|
972 |
+
return ajaxData;
|
973 |
+
|
974 |
+
});
|
975 |
+
|
976 |
+
/**
|
977 |
+
* Module: Dynamic Forms - Select2 Allow tags
|
978 |
+
*/
|
979 |
+
function acfe_form_select_allow_tags(options, $select, data, field, instance){
|
980 |
+
|
981 |
+
options.tags = true;
|
982 |
+
|
983 |
+
options.createTag = function (params){
|
984 |
+
|
985 |
+
var term = $.trim(params.term);
|
986 |
+
|
987 |
+
if(term === '')
|
988 |
+
return null;
|
989 |
+
|
990 |
+
return {
|
991 |
+
id: term,
|
992 |
+
text: term,
|
993 |
+
newTag: true
|
994 |
+
}
|
995 |
+
|
996 |
+
};
|
997 |
+
|
998 |
+
options.insertTag = function(data, tag){
|
999 |
+
|
1000 |
+
var found = false;
|
1001 |
+
|
1002 |
+
$.each(data, function(index, value){
|
1003 |
+
|
1004 |
+
if($.trim(tag.text).toUpperCase() === $.trim(value.text).toUpperCase()){
|
1005 |
+
|
1006 |
+
found = true;
|
1007 |
+
return false;
|
1008 |
+
|
1009 |
+
}
|
1010 |
+
|
1011 |
+
});
|
1012 |
+
|
1013 |
+
if(!found)
|
1014 |
+
data.unshift(tag);
|
1015 |
+
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
return options;
|
1019 |
+
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
// Post
|
1023 |
+
acf.addFilter('select2_args/name=acfe_form_post_save_target', acfe_form_select_allow_tags);
|
1024 |
+
acf.addFilter('select2_args/name=acfe_form_post_load_source', acfe_form_select_allow_tags);
|
1025 |
+
|
1026 |
+
// Term
|
1027 |
+
acf.addFilter('select2_args/name=acfe_form_term_save_target', acfe_form_select_allow_tags);
|
1028 |
+
acf.addFilter('select2_args/name=acfe_form_term_load_source', acfe_form_select_allow_tags);
|
1029 |
+
|
1030 |
+
// User
|
1031 |
+
acf.addFilter('select2_args/name=acfe_form_user_save_target', acfe_form_select_allow_tags);
|
1032 |
+
acf.addFilter('select2_args/name=acfe_form_user_load_source', acfe_form_select_allow_tags);
|
1033 |
+
|
1034 |
+
/**
|
1035 |
+
* Module: Dynamic Forms - Select2 Ajax Data
|
1036 |
+
*/
|
1037 |
+
function acfe_form_select_add_value(ajaxData, data, $el, field, instance){
|
1038 |
+
|
1039 |
+
ajaxData.value = field.val();
|
1040 |
+
|
1041 |
+
return ajaxData;
|
1042 |
+
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
// Post
|
1046 |
+
acf.addFilter('select2_ajax_data/name=acfe_form_post_save_target', acfe_form_select_add_value);
|
1047 |
+
acf.addFilter('select2_ajax_data/name=acfe_form_post_load_source', acfe_form_select_add_value);
|
1048 |
+
|
1049 |
+
// Term
|
1050 |
+
acf.addFilter('select2_ajax_data/name=acfe_form_term_save_target', acfe_form_select_add_value);
|
1051 |
+
acf.addFilter('select2_ajax_data/name=acfe_form_term_load_source', acfe_form_select_add_value);
|
1052 |
+
|
1053 |
+
// User
|
1054 |
+
acf.addFilter('select2_ajax_data/name=acfe_form_user_save_target', acfe_form_select_add_value);
|
1055 |
+
acf.addFilter('select2_ajax_data/name=acfe_form_user_load_source', acfe_form_select_add_value);
|
1056 |
+
|
1057 |
/**
|
1058 |
* Module: Dynamic Forms (actions)
|
1059 |
*/
|
assets/acf-extended-modal.css
CHANGED
@@ -17,7 +17,7 @@ body.acfe-modal-opened{
|
|
17 |
bottom:0;
|
18 |
height:100%;
|
19 |
width:100%;
|
20 |
-
z-index:
|
21 |
}
|
22 |
|
23 |
/*
|
@@ -32,7 +32,7 @@ body.acfe-modal-opened{
|
|
32 |
|
33 |
.acfe-modal.-open{
|
34 |
position:fixed;
|
35 |
-
z-index:
|
36 |
height:100%;
|
37 |
width:100%;
|
38 |
top:0;
|
@@ -79,7 +79,7 @@ body.acfe-modal-opened{
|
|
79 |
|
80 |
.acfe-modal.-open.acfe-modal-sub > .acfe-modal-wrapper > .acfe-modal-wrapper-overlay{
|
81 |
position:absolute;
|
82 |
-
z-index:
|
83 |
background:rgba(0,0,0,0.7);
|
84 |
height:100%;
|
85 |
width:100%;
|
@@ -90,9 +90,21 @@ body.acfe-modal-opened{
|
|
90 |
* ACFE Modal: Sizes
|
91 |
*/
|
92 |
.acfe-modal.-open.-small > .acfe-modal-wrapper{
|
|
|
|
|
|
|
|
|
93 |
max-width:700px;
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
.acfe-modal.-open.-full > .acfe-modal-wrapper{
|
97 |
max-width:100%;
|
98 |
-webkit-box-flex: 1;
|
@@ -100,10 +112,64 @@ body.acfe-modal-opened{
|
|
100 |
flex: 1;
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
/*
|
104 |
* ACFE Modal Title
|
105 |
*/
|
106 |
-
|
107 |
.acfe-modal.-open >.acfe-modal-title,
|
108 |
.acfe-modal.-open .acfe-modal-title *{
|
109 |
-webkit-box-sizing:border-box;
|
17 |
bottom:0;
|
18 |
height:100%;
|
19 |
width:100%;
|
20 |
+
z-index:1000000;
|
21 |
}
|
22 |
|
23 |
/*
|
32 |
|
33 |
.acfe-modal.-open{
|
34 |
position:fixed;
|
35 |
+
z-index:1000001;
|
36 |
height:100%;
|
37 |
width:100%;
|
38 |
top:0;
|
79 |
|
80 |
.acfe-modal.-open.acfe-modal-sub > .acfe-modal-wrapper > .acfe-modal-wrapper-overlay{
|
81 |
position:absolute;
|
82 |
+
z-index:10;
|
83 |
background:rgba(0,0,0,0.7);
|
84 |
height:100%;
|
85 |
width:100%;
|
90 |
* ACFE Modal: Sizes
|
91 |
*/
|
92 |
.acfe-modal.-open.-small > .acfe-modal-wrapper{
|
93 |
+
max-width:450px;
|
94 |
+
}
|
95 |
+
|
96 |
+
.acfe-modal.-open.-medium > .acfe-modal-wrapper{
|
97 |
max-width:700px;
|
98 |
}
|
99 |
|
100 |
+
.acfe-modal.-open.-large > .acfe-modal-wrapper{
|
101 |
+
max-width:1100px;
|
102 |
+
}
|
103 |
+
|
104 |
+
.acfe-modal.-open.-xlarge > .acfe-modal-wrapper{
|
105 |
+
max-width:1400px;
|
106 |
+
}
|
107 |
+
|
108 |
.acfe-modal.-open.-full > .acfe-modal-wrapper{
|
109 |
max-width:100%;
|
110 |
-webkit-box-flex: 1;
|
112 |
flex: 1;
|
113 |
}
|
114 |
|
115 |
+
/*
|
116 |
+
* ACFE Modal Full: Fix left fields background
|
117 |
+
*/
|
118 |
+
.acfe-modal.-open.-full > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields.-left {
|
119 |
+
height:100%;
|
120 |
+
}
|
121 |
+
|
122 |
+
.acfe-modal.-open.-full > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields.-left:before {
|
123 |
+
content: "";
|
124 |
+
display: block;
|
125 |
+
position: absolute;
|
126 |
+
z-index: 0;
|
127 |
+
background: #F9F9F9;
|
128 |
+
border-color: #E1E1E1;
|
129 |
+
border-style: solid;
|
130 |
+
border-width: 0 1px 0 0;
|
131 |
+
top: 0;
|
132 |
+
bottom: 0;
|
133 |
+
left: 0;
|
134 |
+
width: 20%;
|
135 |
+
}
|
136 |
+
|
137 |
+
/*
|
138 |
+
* ACFE Modal Full: Fix Layout Settings background
|
139 |
+
*/
|
140 |
+
.acfe-modal.-settings.-open.-full > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields,
|
141 |
+
.acfe-modal.-settings.-open.-full > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields > .acf-field-clone,
|
142 |
+
.acfe-modal.-settings.-open.-full > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields > .acf-field-clone > .acf-input,
|
143 |
+
.acfe-modal.-settings.-open.-full > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields > .acf-field-clone > .acf-input > .acf-clone-fields.acf-fields.-left{
|
144 |
+
height:100%;
|
145 |
+
}
|
146 |
+
|
147 |
+
.acfe-modal.-settings.-open.-full > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields > .acf-field-clone{
|
148 |
+
padding:0;
|
149 |
+
}
|
150 |
+
|
151 |
+
.acfe-modal.-settings.-open.-full > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields > .acf-field-clone > .acf-input{
|
152 |
+
margin:0;
|
153 |
+
}
|
154 |
+
|
155 |
+
.acfe-modal.-settings.-open.-full > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields > .acf-field-clone > .acf-input > .acf-clone-fields.acf-fields.-left:before {
|
156 |
+
content: "";
|
157 |
+
display: block;
|
158 |
+
position: absolute;
|
159 |
+
z-index: 0;
|
160 |
+
background: #F9F9F9;
|
161 |
+
border-color: #E1E1E1;
|
162 |
+
border-style: solid;
|
163 |
+
border-width: 0 1px 0 0;
|
164 |
+
top: 0;
|
165 |
+
bottom: 0;
|
166 |
+
left: 0;
|
167 |
+
width: 20%;
|
168 |
+
}
|
169 |
+
|
170 |
/*
|
171 |
* ACFE Modal Title
|
172 |
*/
|
|
|
173 |
.acfe-modal.-open >.acfe-modal-title,
|
174 |
.acfe-modal.-open .acfe-modal-title *{
|
175 |
-webkit-box-sizing:border-box;
|
assets/acf-extended.css
CHANGED
@@ -35,6 +35,13 @@ body.-loading *{
|
|
35 |
margin-bottom:10px;
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
/*
|
39 |
* ACF Field: Textarea
|
40 |
*/
|
@@ -152,7 +159,7 @@ body:not(.acf-admin-5-3) .acf-field-acfe-code-editor > .acf-input > .acf-input-w
|
|
152 |
/*
|
153 |
* ACF Field: Group - Terms
|
154 |
*/
|
155 |
-
tr.acf-field.acf-field-group.acfe-
|
156 |
border: 0;
|
157 |
margin-left: -10px;
|
158 |
margin-right: -10px;
|
@@ -160,7 +167,7 @@ tr.acf-field.acf-field-group.acfe-seemless-style > td.acf-input > .acf-fields{
|
|
160 |
margin-bottom: -15px;
|
161 |
}
|
162 |
|
163 |
-
tr.acf-field.acf-field-group.acfe-
|
164 |
padding:0;
|
165 |
margin-top: -15px;
|
166 |
margin-bottom: -15px;
|
@@ -168,7 +175,7 @@ tr.acf-field.acf-field-group.acfe-seemless-style.acfe-field-group-layout-table >
|
|
168 |
margin-right: 0;
|
169 |
}
|
170 |
|
171 |
-
tr.acf-field.acf-field-group.acfe-
|
172 |
border-width:0;
|
173 |
}
|
174 |
|
@@ -252,7 +259,7 @@ tr.acf-field.acf-field-group[data-acfe-group-modal="1"] > .acf-input > .acfe-mod
|
|
252 |
/*
|
253 |
* ACF Field: Clone - Terms
|
254 |
*/
|
255 |
-
tr.acf-field.acf-field-clone.acfe-
|
256 |
border: 0;
|
257 |
margin-left: -10px;
|
258 |
margin-right: -10px;
|
@@ -260,7 +267,7 @@ tr.acf-field.acf-field-clone.acfe-seemless-style > td.acf-input > .acf-fields{
|
|
260 |
margin-bottom: -15px;
|
261 |
}
|
262 |
|
263 |
-
tr.acf-field.acf-field-clone.acfe-
|
264 |
padding:0;
|
265 |
margin-top: -15px;
|
266 |
margin-bottom: -15px;
|
@@ -268,7 +275,7 @@ tr.acf-field.acf-field-clone.acfe-seemless-style.acfe-field-clone-layout-table >
|
|
268 |
margin-right: 0;
|
269 |
}
|
270 |
|
271 |
-
tr.acf-field.acf-field-clone.acfe-
|
272 |
border-width:0;
|
273 |
}
|
274 |
|
@@ -277,6 +284,13 @@ tr.acf-field.acf-field-clone[data-acfe-clone-modal="1"] > .acf-input > .acfe-mod
|
|
277 |
border-width:0;
|
278 |
}
|
279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
/*
|
281 |
* ACFE Form
|
282 |
*/
|
35 |
margin-bottom:10px;
|
36 |
}
|
37 |
|
38 |
+
/*
|
39 |
+
* ACF Field: Hidden
|
40 |
+
*/
|
41 |
+
.acf-field-acfe-hidden{
|
42 |
+
display:none;
|
43 |
+
}
|
44 |
+
|
45 |
/*
|
46 |
* ACF Field: Textarea
|
47 |
*/
|
159 |
/*
|
160 |
* ACF Field: Group - Terms
|
161 |
*/
|
162 |
+
tr.acf-field.acf-field-group.acfe-seamless-style > td.acf-input > .acf-fields{
|
163 |
border: 0;
|
164 |
margin-left: -10px;
|
165 |
margin-right: -10px;
|
167 |
margin-bottom: -15px;
|
168 |
}
|
169 |
|
170 |
+
tr.acf-field.acf-field-group.acfe-seamless-style.acfe-field-group-layout-table > td.acf-input{
|
171 |
padding:0;
|
172 |
margin-top: -15px;
|
173 |
margin-bottom: -15px;
|
175 |
margin-right: 0;
|
176 |
}
|
177 |
|
178 |
+
tr.acf-field.acf-field-group.acfe-seamless-style.acfe-field-group-layout-table > td.acf-input > .acf-table{
|
179 |
border-width:0;
|
180 |
}
|
181 |
|
259 |
/*
|
260 |
* ACF Field: Clone - Terms
|
261 |
*/
|
262 |
+
tr.acf-field.acf-field-clone.acfe-seamless-style > td.acf-input > .acf-fields{
|
263 |
border: 0;
|
264 |
margin-left: -10px;
|
265 |
margin-right: -10px;
|
267 |
margin-bottom: -15px;
|
268 |
}
|
269 |
|
270 |
+
tr.acf-field.acf-field-clone.acfe-seamless-style.acfe-field-clone-layout-table > td.acf-input{
|
271 |
padding:0;
|
272 |
margin-top: -15px;
|
273 |
margin-bottom: -15px;
|
275 |
margin-right: 0;
|
276 |
}
|
277 |
|
278 |
+
tr.acf-field.acf-field-clone.acfe-seamless-style.acfe-field-clone-layout-table > td.acf-input > .acf-table{
|
279 |
border-width:0;
|
280 |
}
|
281 |
|
284 |
border-width:0;
|
285 |
}
|
286 |
|
287 |
+
/*
|
288 |
+
* ACF Field: Colorpicker
|
289 |
+
*/
|
290 |
+
.acfe-modal-content .acf-color-picker .wp-picker-holder{
|
291 |
+
position:relative;
|
292 |
+
}
|
293 |
+
|
294 |
/*
|
295 |
* ACFE Form
|
296 |
*/
|
assets/acf-extended.js
CHANGED
@@ -120,7 +120,8 @@
|
|
120 |
|
121 |
$target.removeAttr('style');
|
122 |
|
123 |
-
|
|
|
124 |
|
125 |
if(args.destroy){
|
126 |
|
@@ -196,13 +197,40 @@
|
|
196 |
|
197 |
});
|
198 |
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
var $instructions = field.$el.find('> .acf-label > .description');
|
202 |
|
203 |
field.$el.find('> .acf-input').append($instructions);
|
204 |
|
205 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
acf.addAction('new_field/name=acfe_form_email_files', function(field){
|
208 |
|
120 |
|
121 |
$target.removeAttr('style');
|
122 |
|
123 |
+
//$target.removeClass('-open -small -medium -full');
|
124 |
+
$target.removeClass('-open');
|
125 |
|
126 |
if(args.destroy){
|
127 |
|
197 |
|
198 |
});
|
199 |
|
200 |
+
acfe_form_move_instructions_above = function(field){
|
201 |
+
|
202 |
+
var $instructions = field.$el.find('> .acf-label > .description');
|
203 |
+
|
204 |
+
field.$el.find('> .acf-input').prepend($instructions);
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
acfe_form_move_instructions_below = function(field){
|
209 |
|
210 |
var $instructions = field.$el.find('> .acf-label > .description');
|
211 |
|
212 |
field.$el.find('> .acf-input').append($instructions);
|
213 |
|
214 |
+
}
|
215 |
+
|
216 |
+
acf.addAction('new_field/name=acfe_form_updated_message', acfe_form_move_instructions_below);
|
217 |
+
acf.addAction('new_field/name=acfe_form_return', acfe_form_move_instructions_below);
|
218 |
+
|
219 |
+
acf.addAction('new_field/name=acfe_form_custom_alias', acfe_form_move_instructions_below);
|
220 |
+
acf.addAction('new_field/name=acfe_form_custom_query_var', acfe_form_move_instructions_below);
|
221 |
+
|
222 |
+
acf.addAction('new_field/name=acfe_form_email_content', acfe_form_move_instructions_below);
|
223 |
+
|
224 |
+
acf.addAction('new_field/name=acfe_form_custom_action', acfe_form_move_instructions_below);
|
225 |
+
|
226 |
+
acf.addAction('new_field/name=acfe_form_post_save_target', acfe_form_move_instructions_below);
|
227 |
+
acf.addAction('new_field/name=acfe_form_post_load_source', acfe_form_move_instructions_below);
|
228 |
+
|
229 |
+
acf.addAction('new_field/name=acfe_form_term_save_target', acfe_form_move_instructions_below);
|
230 |
+
acf.addAction('new_field/name=acfe_form_term_load_source', acfe_form_move_instructions_below);
|
231 |
+
|
232 |
+
acf.addAction('new_field/name=acfe_form_user_save_target', acfe_form_move_instructions_below);
|
233 |
+
acf.addAction('new_field/name=acfe_form_user_load_source', acfe_form_move_instructions_below);
|
234 |
|
235 |
acf.addAction('new_field/name=acfe_form_email_files', function(field){
|
236 |
|
includes/admin/tools/fg-local.php
CHANGED
@@ -257,6 +257,9 @@ class ACFE_Admin_Tool_FG_Local extends ACF_Admin_Tool{
|
|
257 |
// Enable filters
|
258 |
acf_enable_filters();
|
259 |
|
|
|
|
|
|
|
260 |
foreach($selected as $field_group_key){
|
261 |
|
262 |
$field_group = acf_get_field_group($field_group_key);
|
257 |
// Enable filters
|
258 |
acf_enable_filters();
|
259 |
|
260 |
+
// Disable fitler: clone
|
261 |
+
acf_disable_filter('clone');
|
262 |
+
|
263 |
foreach($selected as $field_group_key){
|
264 |
|
265 |
$field_group = acf_get_field_group($field_group_key);
|
includes/core/compatibility.php
CHANGED
@@ -37,14 +37,17 @@ class acfe_compatibility{
|
|
37 |
acf_update_setting('acfe/php_found', acf_get_setting('php_found'));
|
38 |
}
|
39 |
|
40 |
-
add_filter('acf/validate_field_group',
|
41 |
-
add_filter('acf/validate_field',
|
42 |
-
|
43 |
-
add_filter('acf/validate_field/type=
|
44 |
-
add_filter('
|
45 |
-
|
46 |
-
|
47 |
-
add_filter('
|
|
|
|
|
|
|
48 |
|
49 |
}
|
50 |
|
@@ -107,7 +110,7 @@ class acfe_compatibility{
|
|
107 |
* ACF Extended: 0.8.5
|
108 |
* Field Group/Clone: Fixed typo "Seamless"
|
109 |
*/
|
110 |
-
function
|
111 |
|
112 |
if($seamless = acf_maybe_get($field, 'acfe_seamless_style', false)){
|
113 |
|
@@ -119,6 +122,34 @@ class acfe_compatibility{
|
|
119 |
|
120 |
}
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
/**
|
123 |
* Plugin: Post Types Order
|
124 |
* https://wordpress.org/plugins/post-types-order/
|
37 |
acf_update_setting('acfe/php_found', acf_get_setting('php_found'));
|
38 |
}
|
39 |
|
40 |
+
add_filter('acf/validate_field_group', array($this, 'field_group_location_list'), 20);
|
41 |
+
add_filter('acf/validate_field', array($this, 'field_acfe_update'), 20);
|
42 |
+
|
43 |
+
add_filter('acf/validate_field/type=group', array($this, 'field_seamless_style'), 20);
|
44 |
+
add_filter('acf/validate_field/type=clone', array($this, 'field_seamless_style'), 20);
|
45 |
+
add_filter('acfe/load_fields/type=flexible_content', array($this, 'field_flexible_settings_title'), 20, 2);
|
46 |
+
|
47 |
+
add_filter('pto/posts_orderby/ignore', array($this, 'pto_acf_field_group'), 10, 3);
|
48 |
+
add_action('admin_menu', array($this, 'cotto_submenu'), 999);
|
49 |
+
add_filter('rank_math/metabox/priority', array($this, 'rankmath_metaboxes_priority'));
|
50 |
+
add_filter('wpseo_metabox_prio', array($this, 'yoast_metaboxes_priority'));
|
51 |
|
52 |
}
|
53 |
|
110 |
* ACF Extended: 0.8.5
|
111 |
* Field Group/Clone: Fixed typo "Seamless"
|
112 |
*/
|
113 |
+
function field_seamless_style($field){
|
114 |
|
115 |
if($seamless = acf_maybe_get($field, 'acfe_seamless_style', false)){
|
116 |
|
122 |
|
123 |
}
|
124 |
|
125 |
+
/**
|
126 |
+
* ACF Extended: 0.8.4.5
|
127 |
+
* Field Flexible Content: Fix duplicated "layout_settings" & "layout_title"
|
128 |
+
*/
|
129 |
+
function field_flexible_settings_title($fields, $parent){
|
130 |
+
|
131 |
+
// Check if is tool screen
|
132 |
+
if(!acf_is_screen(acfe_get_acf_screen_id('acf-tools')))
|
133 |
+
return $fields;
|
134 |
+
|
135 |
+
foreach($fields as $_k => $_field){
|
136 |
+
|
137 |
+
// field name
|
138 |
+
$_field_name = acf_maybe_get($_field, 'name');
|
139 |
+
|
140 |
+
// check 'acfe_flexible_layout_title' & 'layout_settings'
|
141 |
+
if($_field_name !== 'acfe_flexible_layout_title' && $_field_name !== 'layout_settings')
|
142 |
+
continue;
|
143 |
+
|
144 |
+
// unset
|
145 |
+
unset($fields[$_k]);
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
return $fields;
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
/**
|
154 |
* Plugin: Post Types Order
|
155 |
* https://wordpress.org/plugins/post-types-order/
|
includes/core/enqueue.php
CHANGED
@@ -90,8 +90,8 @@ function acfe_enqueue_admin_input_scripts(){
|
|
90 |
wp_enqueue_style('acf-extended-fc-modal-edit', acfe_get_url('assets/acf-extended-fc-modal-edit.css'), false, ACFE_VERSION);
|
91 |
wp_enqueue_script('acf-extended-fc-modal-edit', acfe_get_url('assets/acf-extended-fc-modal-edit.js'), array('jquery'), ACFE_VERSION);
|
92 |
|
93 |
-
|
94 |
-
'
|
95 |
));
|
96 |
|
97 |
}
|
90 |
wp_enqueue_style('acf-extended-fc-modal-edit', acfe_get_url('assets/acf-extended-fc-modal-edit.css'), false, ACFE_VERSION);
|
91 |
wp_enqueue_script('acf-extended-fc-modal-edit', acfe_get_url('assets/acf-extended-fc-modal-edit.js'), array('jquery'), ACFE_VERSION);
|
92 |
|
93 |
+
acf_localize_text(array(
|
94 |
+
'Close' => __('Close', 'acf'),
|
95 |
));
|
96 |
|
97 |
}
|
includes/core/helpers.php
CHANGED
@@ -444,24 +444,38 @@ function acfe_locate_file_url($filenames){
|
|
444 |
/**
|
445 |
* Get Roles
|
446 |
*/
|
447 |
-
function acfe_get_roles($
|
448 |
|
449 |
-
|
450 |
-
|
451 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
|
453 |
-
|
454 |
|
455 |
-
|
456 |
-
|
|
|
|
|
|
|
|
|
|
|
457 |
|
458 |
-
foreach($
|
|
|
|
|
|
|
459 |
|
460 |
-
$user_roles[$role] = $
|
461 |
|
462 |
}
|
463 |
-
|
464 |
-
|
465 |
|
466 |
return $user_roles;
|
467 |
|
@@ -630,41 +644,6 @@ function acfe_ends_with($haystack, $needle){
|
|
630 |
|
631 |
}
|
632 |
|
633 |
-
add_filter('acf/load_field', 'acfe_load_field');
|
634 |
-
function acfe_load_field($field){
|
635 |
-
|
636 |
-
if(acf_is_screen(array('edit-acf-field-group', 'acf-field-group', 'acf_page_acf-tools')))
|
637 |
-
return $field;
|
638 |
-
|
639 |
-
// Everywhere
|
640 |
-
$field = apply_filters('acfe/load_field', $field);
|
641 |
-
|
642 |
-
// Admin
|
643 |
-
if(acfe_form_is_admin()){
|
644 |
-
|
645 |
-
$field = apply_filters('acfe/load_field_admin', $field);
|
646 |
-
|
647 |
-
}
|
648 |
-
|
649 |
-
// Front
|
650 |
-
elseif(acfe_form_is_front()){
|
651 |
-
|
652 |
-
$field = apply_filters('acfe/load_field_front', $field);
|
653 |
-
|
654 |
-
}
|
655 |
-
|
656 |
-
return $field;
|
657 |
-
|
658 |
-
}
|
659 |
-
|
660 |
-
if(function_exists('acf_add_filter_variations')){
|
661 |
-
|
662 |
-
acf_add_filter_variations('acfe/load_field', array('type', 'name', 'key'), 0);
|
663 |
-
acf_add_filter_variations('acfe/load_field_front', array('type', 'name', 'key'), 0);
|
664 |
-
acf_add_filter_variations('acfe/load_field_admin', array('type', 'name', 'key'), 0);
|
665 |
-
|
666 |
-
}
|
667 |
-
|
668 |
function acfe_form_is_admin(){
|
669 |
|
670 |
if((is_admin() && !wp_doing_ajax()) || (is_admin() && wp_doing_ajax() && acf_maybe_get_POST('_acf_screen') !== 'acfe_form' && acf_maybe_get_POST('_acf_screen') !== 'acf_form'))
|
@@ -852,4 +831,55 @@ function acfe_number_suffix($num){
|
|
852 |
|
853 |
return $num . 'th';
|
854 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
855 |
}
|
444 |
/**
|
445 |
* Get Roles
|
446 |
*/
|
447 |
+
function acfe_get_roles($filtered_user_roles = array()){
|
448 |
|
449 |
+
|
450 |
+
$list = array();
|
451 |
+
|
452 |
+
global $wp_roles;
|
453 |
+
|
454 |
+
if(is_multisite())
|
455 |
+
$list['super_admin'] = __('Super Admin');
|
456 |
+
|
457 |
+
foreach($wp_roles->roles as $role => $settings){
|
458 |
|
459 |
+
$list[$role] = $settings['name'];
|
460 |
|
461 |
+
}
|
462 |
+
|
463 |
+
$user_roles = $list;
|
464 |
+
|
465 |
+
if(!empty($filtered_user_roles)){
|
466 |
+
|
467 |
+
$user_roles = array();
|
468 |
|
469 |
+
foreach($list as $role => $role_label){
|
470 |
+
|
471 |
+
if(!in_array($role, $filtered_user_roles))
|
472 |
+
continue;
|
473 |
|
474 |
+
$user_roles[$role] = $role_label;
|
475 |
|
476 |
}
|
477 |
+
|
478 |
+
}
|
479 |
|
480 |
return $user_roles;
|
481 |
|
644 |
|
645 |
}
|
646 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
647 |
function acfe_form_is_admin(){
|
648 |
|
649 |
if((is_admin() && !wp_doing_ajax()) || (is_admin() && wp_doing_ajax() && acf_maybe_get_POST('_acf_screen') !== 'acfe_form' && acf_maybe_get_POST('_acf_screen') !== 'acf_form'))
|
831 |
|
832 |
return $num . 'th';
|
833 |
|
834 |
+
}
|
835 |
+
|
836 |
+
function acfe_get_acf_screen_id($page = ''){
|
837 |
+
|
838 |
+
$prefix = sanitize_title( __("Custom Fields", 'acf') );
|
839 |
+
|
840 |
+
if(empty($page))
|
841 |
+
return $prefix;
|
842 |
+
|
843 |
+
return $prefix . '_page_' . $page;
|
844 |
+
|
845 |
+
}
|
846 |
+
|
847 |
+
function acfe_is_admin_screen($modules = false){
|
848 |
+
|
849 |
+
// bail early if not defined
|
850 |
+
if(!function_exists('get_current_screen'))
|
851 |
+
return false;
|
852 |
+
|
853 |
+
// vars
|
854 |
+
$screen = get_current_screen();
|
855 |
+
|
856 |
+
// no screen
|
857 |
+
if(!$screen)
|
858 |
+
return false;
|
859 |
+
|
860 |
+
$post_types = array(
|
861 |
+
'acf-field-group', // ACF
|
862 |
+
);
|
863 |
+
|
864 |
+
$field_group_category = false;
|
865 |
+
|
866 |
+
// include ACF Extended Modules?
|
867 |
+
if($modules){
|
868 |
+
|
869 |
+
$post_types[] = 'acfe-dbt'; // Dynamic Block Type
|
870 |
+
$post_types[] = 'acfe-dop'; // Dynamic Option Page
|
871 |
+
$post_types[] = 'acfe-dpt'; // Dynamic Post Type
|
872 |
+
$post_types[] = 'acfe-dt'; // Dynamic Taxonomy
|
873 |
+
$post_types[] = 'acfe-form'; // Dynamic Form
|
874 |
+
|
875 |
+
// Field Group Category
|
876 |
+
$field_group_category = $screen->post_type === 'post' && $screen->taxonomy === 'acf-field-group-category';
|
877 |
+
|
878 |
+
}
|
879 |
+
|
880 |
+
if(in_array($screen->post_type, $post_types) || $field_group_category)
|
881 |
+
return true;
|
882 |
+
|
883 |
+
return false;
|
884 |
+
|
885 |
}
|
includes/field-groups/field-group.php
CHANGED
@@ -483,39 +483,39 @@ add_action('acf/render_field/name=acfe_data', 'acfe_render_field_group_data');
|
|
483 |
function acfe_render_field_group_data($field){
|
484 |
|
485 |
$field_group = acf_get_field_group($field['value']);
|
|
|
|
|
486 |
if(!$field_group){
|
|
|
487 |
echo '<a href="#" class="button disabled" disabled>' . __('Data') . '</a>';
|
488 |
return;
|
|
|
489 |
}
|
490 |
|
491 |
echo '<a href="#" class="button acfe_modal_open" data-modal-key="' . $field_group['key'] . '">' . __('Data') . '</a>';
|
492 |
-
echo '<div class="acfe-modal" data-modal-key="' . $field_group['key'] . '"><div style="padding:15px;"><pre>' . print_r($field_group, true) . '</pre></div></div>';
|
493 |
|
494 |
}
|
495 |
|
496 |
/**
|
497 |
* Hooks: Display title (post edit)
|
498 |
*/
|
499 |
-
add_filter('acf/
|
500 |
function acfe_render_field_groups($field_groups){
|
501 |
|
502 |
if(!is_admin())
|
503 |
return $field_groups;
|
504 |
|
505 |
-
|
506 |
-
'edit-acf-field-group',
|
507 |
-
'acf-field-group',
|
508 |
-
'acf_page_acf-tools'
|
509 |
-
));
|
510 |
-
|
511 |
-
if($check_current_screen)
|
512 |
return $field_groups;
|
513 |
|
514 |
foreach($field_groups as &$field_group){
|
515 |
-
|
|
|
516 |
continue;
|
517 |
|
518 |
$field_group['title'] = $field_group['acfe_display_title'];
|
|
|
519 |
}
|
520 |
|
521 |
return $field_groups;
|
@@ -525,44 +525,44 @@ function acfe_render_field_groups($field_groups){
|
|
525 |
/**
|
526 |
* Hooks: Permissions (post edit)
|
527 |
*/
|
528 |
-
add_filter('acf/
|
529 |
function acfe_permissions_field_groups($field_groups){
|
530 |
|
531 |
if(!is_admin())
|
532 |
return $field_groups;
|
533 |
|
534 |
-
|
535 |
-
'edit-acf-field-group',
|
536 |
-
'acf-field-group',
|
537 |
-
'acf_page_acf-tools'
|
538 |
-
));
|
539 |
-
|
540 |
-
if($check_current_screen)
|
541 |
return $field_groups;
|
542 |
|
543 |
$current_user_roles = acfe_get_current_user_roles();
|
544 |
|
545 |
foreach($field_groups as $key => $field_group){
|
546 |
-
|
|
|
547 |
continue;
|
548 |
|
549 |
$render_field_group = false;
|
550 |
|
551 |
foreach($current_user_roles as $current_user_role){
|
|
|
552 |
foreach($field_group['acfe_permissions'] as $field_group_role){
|
|
|
553 |
if($current_user_role !== $field_group_role)
|
554 |
continue;
|
555 |
|
556 |
$render_field_group = true;
|
557 |
break;
|
|
|
558 |
}
|
559 |
|
560 |
if($render_field_group)
|
561 |
break;
|
|
|
562 |
}
|
563 |
|
564 |
if(!$render_field_group)
|
565 |
unset($field_groups[$key]);
|
|
|
566 |
}
|
567 |
|
568 |
return $field_groups;
|
@@ -579,22 +579,54 @@ function acfe_field_group_instruction_placement($field){
|
|
579 |
}
|
580 |
|
581 |
/**
|
582 |
-
*
|
583 |
*/
|
584 |
add_filter('acf/validate_field_group', 'acfc_field_group_default_options');
|
585 |
function acfc_field_group_default_options($field_group){
|
586 |
|
587 |
-
|
|
|
|
|
588 |
$field_group['label_placement'] = 'left';
|
|
|
|
|
589 |
|
590 |
return $field_group;
|
591 |
|
592 |
}
|
593 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
594 |
add_filter('acf/prepare_field_group_for_export', 'acfc_field_group_export_categories');
|
595 |
function acfc_field_group_export_categories($field_group){
|
596 |
|
597 |
$_field_group = acf_get_field_group($field_group['key']);
|
|
|
598 |
if(empty($_field_group))
|
599 |
return $field_group;
|
600 |
|
@@ -659,4 +691,53 @@ function acfc_field_group_import_categories($field_group){
|
|
659 |
|
660 |
}
|
661 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
662 |
}
|
483 |
function acfe_render_field_group_data($field){
|
484 |
|
485 |
$field_group = acf_get_field_group($field['value']);
|
486 |
+
$field_group_raw = get_post($field_group['ID']);
|
487 |
+
|
488 |
if(!$field_group){
|
489 |
+
|
490 |
echo '<a href="#" class="button disabled" disabled>' . __('Data') . '</a>';
|
491 |
return;
|
492 |
+
|
493 |
}
|
494 |
|
495 |
echo '<a href="#" class="button acfe_modal_open" data-modal-key="' . $field_group['key'] . '">' . __('Data') . '</a>';
|
496 |
+
echo '<div class="acfe-modal" data-modal-key="' . $field_group['key'] . '"><div style="padding:15px;"><pre style="margin-bottom:15px;">' . print_r($field_group, true) . '</pre><pre>' . print_r($field_group_raw, true) . '</pre></div></div>';
|
497 |
|
498 |
}
|
499 |
|
500 |
/**
|
501 |
* Hooks: Display title (post edit)
|
502 |
*/
|
503 |
+
add_filter('acf/load_field_groups', 'acfe_render_field_groups', 999);
|
504 |
function acfe_render_field_groups($field_groups){
|
505 |
|
506 |
if(!is_admin())
|
507 |
return $field_groups;
|
508 |
|
509 |
+
if(acfe_is_admin_screen())
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
return $field_groups;
|
511 |
|
512 |
foreach($field_groups as &$field_group){
|
513 |
+
|
514 |
+
if(!acf_maybe_get($field_group, 'acfe_display_title'))
|
515 |
continue;
|
516 |
|
517 |
$field_group['title'] = $field_group['acfe_display_title'];
|
518 |
+
|
519 |
}
|
520 |
|
521 |
return $field_groups;
|
525 |
/**
|
526 |
* Hooks: Permissions (post edit)
|
527 |
*/
|
528 |
+
add_filter('acf/load_field_groups', 'acfe_permissions_field_groups', 999);
|
529 |
function acfe_permissions_field_groups($field_groups){
|
530 |
|
531 |
if(!is_admin())
|
532 |
return $field_groups;
|
533 |
|
534 |
+
if(acfe_is_admin_screen())
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
return $field_groups;
|
536 |
|
537 |
$current_user_roles = acfe_get_current_user_roles();
|
538 |
|
539 |
foreach($field_groups as $key => $field_group){
|
540 |
+
|
541 |
+
if(!acf_maybe_get($field_group, 'acfe_permissions'))
|
542 |
continue;
|
543 |
|
544 |
$render_field_group = false;
|
545 |
|
546 |
foreach($current_user_roles as $current_user_role){
|
547 |
+
|
548 |
foreach($field_group['acfe_permissions'] as $field_group_role){
|
549 |
+
|
550 |
if($current_user_role !== $field_group_role)
|
551 |
continue;
|
552 |
|
553 |
$render_field_group = true;
|
554 |
break;
|
555 |
+
|
556 |
}
|
557 |
|
558 |
if($render_field_group)
|
559 |
break;
|
560 |
+
|
561 |
}
|
562 |
|
563 |
if(!$render_field_group)
|
564 |
unset($field_groups[$key]);
|
565 |
+
|
566 |
}
|
567 |
|
568 |
return $field_groups;
|
579 |
}
|
580 |
|
581 |
/**
|
582 |
+
* Validate field group
|
583 |
*/
|
584 |
add_filter('acf/validate_field_group', 'acfc_field_group_default_options');
|
585 |
function acfc_field_group_default_options($field_group){
|
586 |
|
587 |
+
// Default label placement: Left
|
588 |
+
if(!acf_maybe_get($field_group, 'location')){
|
589 |
+
|
590 |
$field_group['label_placement'] = 'left';
|
591 |
+
|
592 |
+
}
|
593 |
|
594 |
return $field_group;
|
595 |
|
596 |
}
|
597 |
|
598 |
+
/**
|
599 |
+
* Field Group: Hide on screen
|
600 |
+
*/
|
601 |
+
add_filter('acf/prepare_field/name=hide_on_screen', 'acfc_field_group_hide_on_screen');
|
602 |
+
function acfc_field_group_hide_on_screen($field){
|
603 |
+
|
604 |
+
$choices = array();
|
605 |
+
|
606 |
+
foreach($field['choices'] as $key => $value){
|
607 |
+
|
608 |
+
if($key == 'the_content'){
|
609 |
+
|
610 |
+
$choices['block_editor'] = __('Block Editor');
|
611 |
+
|
612 |
+
}
|
613 |
+
|
614 |
+
|
615 |
+
$choices[$key] = $value;
|
616 |
+
|
617 |
+
}
|
618 |
+
|
619 |
+
$field['choices'] = $choices;
|
620 |
+
|
621 |
+
return $field;
|
622 |
+
|
623 |
+
}
|
624 |
+
|
625 |
add_filter('acf/prepare_field_group_for_export', 'acfc_field_group_export_categories');
|
626 |
function acfc_field_group_export_categories($field_group){
|
627 |
|
628 |
$_field_group = acf_get_field_group($field_group['key']);
|
629 |
+
|
630 |
if(empty($_field_group))
|
631 |
return $field_group;
|
632 |
|
691 |
|
692 |
}
|
693 |
|
694 |
+
}
|
695 |
+
|
696 |
+
add_action('load-post.php', 'acfe_field_group_disable_editor');
|
697 |
+
add_action('load-post-new.php', 'acfe_field_group_disable_editor');
|
698 |
+
function acfe_field_group_disable_editor(){
|
699 |
+
|
700 |
+
// globals
|
701 |
+
global $typenow;
|
702 |
+
|
703 |
+
// restrict specific post types
|
704 |
+
$restricted = array('acf-field-group', 'attachment');
|
705 |
+
if( in_array($typenow, $restricted) ) {
|
706 |
+
return;
|
707 |
+
}
|
708 |
+
|
709 |
+
$post_type = $typenow;
|
710 |
+
$post_id = 0;
|
711 |
+
|
712 |
+
if ( isset( $_GET['post'] ) ) {
|
713 |
+
$post_id = (int) $_GET['post'];
|
714 |
+
} elseif ( isset( $_POST['post_ID'] ) ) {
|
715 |
+
$post_id = (int) $_POST['post_ID'];
|
716 |
+
}
|
717 |
+
|
718 |
+
$field_groups = acf_get_field_groups(array(
|
719 |
+
'post_id' => $post_id,
|
720 |
+
'post_type' => $post_type
|
721 |
+
));
|
722 |
+
|
723 |
+
$hide_block_editor = false;
|
724 |
+
|
725 |
+
foreach($field_groups as $field_group){
|
726 |
+
|
727 |
+
$hide_on_screen = acf_get_array($field_group['hide_on_screen']);
|
728 |
+
|
729 |
+
if(!in_array('block_editor', $hide_on_screen))
|
730 |
+
continue;
|
731 |
+
|
732 |
+
$hide_block_editor = true;
|
733 |
+
break;
|
734 |
+
|
735 |
+
}
|
736 |
+
|
737 |
+
if($hide_block_editor){
|
738 |
+
|
739 |
+
add_filter('use_block_editor_for_post_type', '__return_false');
|
740 |
+
|
741 |
+
}
|
742 |
+
|
743 |
}
|
includes/field-groups/field-groups.php
CHANGED
@@ -475,4 +475,25 @@ function acfe_field_groups_posts_per_page(){
|
|
475 |
|
476 |
return 999;
|
477 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
}
|
475 |
|
476 |
return 999;
|
477 |
|
478 |
+
}
|
479 |
+
|
480 |
+
add_action('acf/add_meta_boxes', 'acfe_field_groups_seamless', 10, 3);
|
481 |
+
function acfe_field_groups_seamless($post_type, $post, $field_groups){
|
482 |
+
|
483 |
+
foreach($field_groups as $field_group){
|
484 |
+
|
485 |
+
if($field_group['style'] !== 'seamless')
|
486 |
+
continue;
|
487 |
+
|
488 |
+
add_filter("postbox_classes_{$post_type}_acf-{$field_group['key']}", function($classes){
|
489 |
+
|
490 |
+
$classes[] = 'seamless';
|
491 |
+
$classes[] = 'acf-postbox';
|
492 |
+
|
493 |
+
return $classes;
|
494 |
+
|
495 |
+
});
|
496 |
+
|
497 |
+
}
|
498 |
+
|
499 |
}
|
includes/fields-settings/fields.php
CHANGED
@@ -3,17 +3,84 @@
|
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
|
|
|
|
|
|
6 |
add_filter('acf/field_wrapper_attributes', 'acfe_field_wrapper_attributes', 10, 2);
|
7 |
function acfe_field_wrapper_attributes($wrapper, $field){
|
8 |
|
9 |
-
$wrapper = apply_filters('acfe/field_wrapper_attributes
|
10 |
-
$wrapper = apply_filters('acfe/field_wrapper_attributes/name=' . $field['name'], $wrapper, $field);
|
11 |
-
$wrapper = apply_filters('acfe/field_wrapper_attributes/key=' . $field['key'], $wrapper, $field);
|
12 |
|
13 |
return $wrapper;
|
14 |
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
add_filter('acf/pre_render_fields', 'acfe_fields_wrapper_instructions', 10, 2);
|
18 |
function acfe_fields_wrapper_instructions($fields, $post_id){
|
19 |
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
+
/**
|
7 |
+
* Field Wrapper Attributes
|
8 |
+
*/
|
9 |
add_filter('acf/field_wrapper_attributes', 'acfe_field_wrapper_attributes', 10, 2);
|
10 |
function acfe_field_wrapper_attributes($wrapper, $field){
|
11 |
|
12 |
+
$wrapper = apply_filters('acfe/field_wrapper_attributes', $wrapper, $field);
|
|
|
|
|
13 |
|
14 |
return $wrapper;
|
15 |
|
16 |
}
|
17 |
|
18 |
+
if(function_exists('acf_add_filter_variations')){
|
19 |
+
|
20 |
+
acf_add_filter_variations('acfe/field_wrapper_attributes', array('type', 'name', 'key'), 1);
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Load Fields
|
26 |
+
*/
|
27 |
+
add_filter('acf/load_fields', 'acfe_field_load_fields', 10, 2);
|
28 |
+
function acfe_field_load_fields($fields, $parent){
|
29 |
+
|
30 |
+
// check if field (fitler is also called on field groups)
|
31 |
+
if(!acf_maybe_get($parent, 'type'))
|
32 |
+
return $fields;
|
33 |
+
|
34 |
+
$fields = apply_filters('acfe/load_fields', $fields, $parent);
|
35 |
+
|
36 |
+
return $fields;
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
if(function_exists('acf_add_filter_variations')){
|
41 |
+
|
42 |
+
acf_add_filter_variations('acfe/load_fields', array('type', 'name', 'key'), 1);
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Load Field
|
48 |
+
*/
|
49 |
+
add_filter('acf/load_field', 'acfe_load_field');
|
50 |
+
function acfe_load_field($field){
|
51 |
+
|
52 |
+
if(acfe_is_admin_screen())
|
53 |
+
return $field;
|
54 |
+
|
55 |
+
// Everywhere
|
56 |
+
$field = apply_filters('acfe/load_field', $field);
|
57 |
+
|
58 |
+
// Admin
|
59 |
+
if(acfe_form_is_admin()){
|
60 |
+
|
61 |
+
$field = apply_filters('acfe/load_field_admin', $field);
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
// Front
|
66 |
+
elseif(acfe_form_is_front()){
|
67 |
+
|
68 |
+
$field = apply_filters('acfe/load_field_front', $field);
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
return $field;
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
if(function_exists('acf_add_filter_variations')){
|
77 |
+
|
78 |
+
acf_add_filter_variations('acfe/load_field', array('type', 'name', 'key'), 0);
|
79 |
+
acf_add_filter_variations('acfe/load_field_front', array('type', 'name', 'key'), 0);
|
80 |
+
acf_add_filter_variations('acfe/load_field_admin', array('type', 'name', 'key'), 0);
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
add_filter('acf/pre_render_fields', 'acfe_fields_wrapper_instructions', 10, 2);
|
85 |
function acfe_fields_wrapper_instructions($fields, $post_id){
|
86 |
|
includes/fields/field-button.php
CHANGED
@@ -20,10 +20,34 @@ class acfe_field_button extends acf_field{
|
|
20 |
'button_class' => '',
|
21 |
'button_id' => '',
|
22 |
);
|
|
|
|
|
|
|
23 |
|
24 |
parent::__construct();
|
25 |
|
26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
function render_field_settings($field){
|
29 |
|
@@ -73,7 +97,7 @@ class acfe_field_button extends acf_field{
|
|
73 |
acf_render_field_setting($field, array(
|
74 |
'label' => __('Before HTML', 'acfe'),
|
75 |
'instructions' => __('Custom HTML before the button', 'acfe'),
|
76 |
-
'type' => '
|
77 |
'name' => 'button_before',
|
78 |
'rows' => 4,
|
79 |
));
|
@@ -82,7 +106,7 @@ class acfe_field_button extends acf_field{
|
|
82 |
acf_render_field_setting($field, array(
|
83 |
'label' => __('After HTML', 'acfe'),
|
84 |
'instructions' => __('Custom HTML after the button', 'acfe'),
|
85 |
-
'type' => '
|
86 |
'name' => 'button_after',
|
87 |
'rows' => 4,
|
88 |
));
|
@@ -98,20 +122,17 @@ class acfe_field_button extends acf_field{
|
|
98 |
|
99 |
ob_start();
|
100 |
?>
|
101 |
-
Write your own Ajax
|
102 |
<pre>
|
103 |
-
add_action('
|
104 |
-
|
105 |
-
function my_acf_button_ajax(){
|
106 |
|
107 |
/**
|
108 |
-
* @
|
109 |
-
* @string
|
110 |
-
* @string $_POST['field_name'] Button's field name
|
111 |
*/
|
112 |
|
113 |
echo 'Hello World';
|
114 |
-
die;
|
115 |
|
116 |
}
|
117 |
</pre>
|
20 |
'button_class' => '',
|
21 |
'button_id' => '',
|
22 |
);
|
23 |
+
|
24 |
+
add_action('wp_ajax_acfe/fields/button', array($this, 'ajax_request'), 99);
|
25 |
+
add_action('wp_ajax_nopriv_acfe/fields/button', array($this, 'ajax_request'), 99);
|
26 |
|
27 |
parent::__construct();
|
28 |
|
29 |
}
|
30 |
+
|
31 |
+
function ajax_request(){
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @bool/string $_POST['post_id'] Current post ID
|
35 |
+
* @string $_POST['field_key'] Button's field key
|
36 |
+
* @string $_POST['field_name'] Button's field name
|
37 |
+
*/
|
38 |
+
|
39 |
+
$field_name = acf_maybe_get_POST('field_name');
|
40 |
+
$field_key = acf_maybe_get_POST('field_key');
|
41 |
+
$post_id = acf_maybe_get_POST('post_id');
|
42 |
+
$field = acf_get_field($field_key);
|
43 |
+
|
44 |
+
do_action('acfe/fields/button', $field, $post_id);
|
45 |
+
do_action('acfe/fields/button/name=' . $field_name, $field, $post_id);
|
46 |
+
do_action('acfe/fields/button/key=' . $field_key, $field, $post_id);
|
47 |
+
|
48 |
+
die;
|
49 |
+
|
50 |
+
}
|
51 |
|
52 |
function render_field_settings($field){
|
53 |
|
97 |
acf_render_field_setting($field, array(
|
98 |
'label' => __('Before HTML', 'acfe'),
|
99 |
'instructions' => __('Custom HTML before the button', 'acfe'),
|
100 |
+
'type' => 'acfe_code_editor',
|
101 |
'name' => 'button_before',
|
102 |
'rows' => 4,
|
103 |
));
|
106 |
acf_render_field_setting($field, array(
|
107 |
'label' => __('After HTML', 'acfe'),
|
108 |
'instructions' => __('Custom HTML after the button', 'acfe'),
|
109 |
+
'type' => 'acfe_code_editor',
|
110 |
'name' => 'button_after',
|
111 |
'rows' => 4,
|
112 |
));
|
122 |
|
123 |
ob_start();
|
124 |
?>
|
125 |
+
Write your own Ajax return data using the following hook:<br /><br />
|
126 |
<pre>
|
127 |
+
add_action('acfe/fields/button/name=my_button', 'my_acf_button_ajax', 10, 2);
|
128 |
+
function my_acf_button_ajax($field, $post_id){
|
|
|
129 |
|
130 |
/**
|
131 |
+
* @array $field Field array
|
132 |
+
* @bool/string $post_id Current post ID
|
|
|
133 |
*/
|
134 |
|
135 |
echo 'Hello World';
|
|
|
136 |
|
137 |
}
|
138 |
</pre>
|
includes/fields/field-clone.php
CHANGED
@@ -1,134 +1,191 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if(!defined('ABSPATH'))
|
4 |
-
exit;
|
5 |
-
|
6 |
-
add_action('acf/render_field_settings/type=clone', 'acfe_field_clone_settings');
|
7 |
-
function acfe_field_clone_settings($field){
|
8 |
-
|
9 |
-
acf_render_field_setting($field, array(
|
10 |
-
'label' => __('Seamless Style', 'acfe'),
|
11 |
-
'name' => 'acfe_seamless_style',
|
12 |
-
'key' => 'acfe_seamless_style',
|
13 |
-
'instructions' => __('Enable better CSS integration: remove borders and padding'),
|
14 |
-
'type' => 'true_false',
|
15 |
-
'message' => '',
|
16 |
-
'default_value' => false,
|
17 |
-
'ui' => true,
|
18 |
-
'conditional_logic' => array(
|
19 |
-
array(
|
20 |
-
array(
|
21 |
-
'field' => 'display',
|
22 |
-
'operator' => '==',
|
23 |
-
'value' => 'group',
|
24 |
-
),
|
25 |
-
array(
|
26 |
-
'field' => 'acfe_clone_modal',
|
27 |
-
'operator' => '!=',
|
28 |
-
'value' => '1',
|
29 |
-
)
|
30 |
-
)
|
31 |
-
)
|
32 |
-
));
|
33 |
-
|
34 |
-
acf_render_field_setting($field, array(
|
35 |
-
'label' => __('Edition modal'),
|
36 |
-
'name' => 'acfe_clone_modal',
|
37 |
-
'key' => 'acfe_clone_modal',
|
38 |
-
'instructions' => __('Edit fields in a modal'),
|
39 |
-
'type' => 'true_false',
|
40 |
-
'message' => '',
|
41 |
-
'default_value' => false,
|
42 |
-
'ui' => true,
|
43 |
-
));
|
44 |
-
|
45 |
-
acf_render_field_setting($field, array(
|
46 |
-
'label' => __('Edition modal button'),
|
47 |
-
'name' => '
|
48 |
-
'key' => '
|
49 |
-
'instructions' => __('
|
50 |
-
'type' => '
|
51 |
-
'
|
52 |
-
'
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
'
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
add_action('acf/render_field_settings/type=clone', 'acfe_field_clone_settings');
|
7 |
+
function acfe_field_clone_settings($field){
|
8 |
+
|
9 |
+
acf_render_field_setting($field, array(
|
10 |
+
'label' => __('Seamless Style', 'acfe'),
|
11 |
+
'name' => 'acfe_seamless_style',
|
12 |
+
'key' => 'acfe_seamless_style',
|
13 |
+
'instructions' => __('Enable better CSS integration: remove borders and padding'),
|
14 |
+
'type' => 'true_false',
|
15 |
+
'message' => '',
|
16 |
+
'default_value' => false,
|
17 |
+
'ui' => true,
|
18 |
+
'conditional_logic' => array(
|
19 |
+
array(
|
20 |
+
array(
|
21 |
+
'field' => 'display',
|
22 |
+
'operator' => '==',
|
23 |
+
'value' => 'group',
|
24 |
+
),
|
25 |
+
array(
|
26 |
+
'field' => 'acfe_clone_modal',
|
27 |
+
'operator' => '!=',
|
28 |
+
'value' => '1',
|
29 |
+
)
|
30 |
+
)
|
31 |
+
)
|
32 |
+
));
|
33 |
+
|
34 |
+
acf_render_field_setting($field, array(
|
35 |
+
'label' => __('Edition modal'),
|
36 |
+
'name' => 'acfe_clone_modal',
|
37 |
+
'key' => 'acfe_clone_modal',
|
38 |
+
'instructions' => __('Edit fields in a modal'),
|
39 |
+
'type' => 'true_false',
|
40 |
+
'message' => '',
|
41 |
+
'default_value' => false,
|
42 |
+
'ui' => true,
|
43 |
+
));
|
44 |
+
|
45 |
+
acf_render_field_setting($field, array(
|
46 |
+
'label' => __('Edition modal: Close button'),
|
47 |
+
'name' => 'acfe_clone_modal_close',
|
48 |
+
'key' => 'acfe_clone_modal_close',
|
49 |
+
'instructions' => __('Display close button'),
|
50 |
+
'type' => 'true_false',
|
51 |
+
'message' => '',
|
52 |
+
'default_value' => false,
|
53 |
+
'ui' => true,
|
54 |
+
'conditional_logic' => array(
|
55 |
+
array(
|
56 |
+
array(
|
57 |
+
'field' => 'acfe_clone_modal',
|
58 |
+
'operator' => '==',
|
59 |
+
'value' => '1',
|
60 |
+
),
|
61 |
+
)
|
62 |
+
)
|
63 |
+
));
|
64 |
+
|
65 |
+
acf_render_field_setting($field, array(
|
66 |
+
'label' => __('Edition modal: Text button'),
|
67 |
+
'name' => 'acfe_clone_modal_button',
|
68 |
+
'key' => 'acfe_clone_modal_button',
|
69 |
+
'instructions' => __('Text displayed in the edition modal button'),
|
70 |
+
'type' => 'text',
|
71 |
+
'placeholder' => __('Edit', 'acf'),
|
72 |
+
'conditional_logic' => array(
|
73 |
+
array(
|
74 |
+
array(
|
75 |
+
'field' => 'acfe_clone_modal',
|
76 |
+
'operator' => '==',
|
77 |
+
'value' => '1',
|
78 |
+
),
|
79 |
+
)
|
80 |
+
)
|
81 |
+
));
|
82 |
+
|
83 |
+
acf_render_field_setting($field, array(
|
84 |
+
'label' => __('Edition modal: Size'),
|
85 |
+
'name' => 'acfe_clone_modal_size',
|
86 |
+
'key' => 'acfe_clone_modal_size',
|
87 |
+
'instructions' => __('Choose the modal size'),
|
88 |
+
'type' => 'select',
|
89 |
+
'choices' => array(
|
90 |
+
'small' => 'Small',
|
91 |
+
'medium' => 'Medium',
|
92 |
+
'large' => 'Large',
|
93 |
+
'xlarge' => 'Extra Large',
|
94 |
+
'full' => 'Full',
|
95 |
+
),
|
96 |
+
'default_value' => 'large',
|
97 |
+
'conditional_logic' => array(
|
98 |
+
array(
|
99 |
+
array(
|
100 |
+
'field' => 'acfe_clone_modal',
|
101 |
+
'operator' => '==',
|
102 |
+
'value' => '1',
|
103 |
+
),
|
104 |
+
)
|
105 |
+
)
|
106 |
+
));
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
add_filter('acfe/field_wrapper_attributes/type=clone', 'acfe_field_clone_wrapper', 10, 2);
|
111 |
+
function acfe_field_clone_wrapper($wrapper, $field){
|
112 |
+
|
113 |
+
if(acf_maybe_get($field, 'acfe_clone_modal')){
|
114 |
+
|
115 |
+
$wrapper['data-acfe-clone-modal'] = 1;
|
116 |
+
$wrapper['data-acfe-clone-modal-button'] = __('Edit', 'acf');
|
117 |
+
|
118 |
+
if(acf_maybe_get($field, 'acfe_clone_modal_button')){
|
119 |
+
|
120 |
+
$wrapper['data-acfe-clone-modal-button'] = $field['acfe_clone_modal_button'];
|
121 |
+
|
122 |
+
}
|
123 |
+
|
124 |
+
if(acf_maybe_get($field, 'acfe_clone_modal_close')){
|
125 |
+
|
126 |
+
$wrapper['data-acfe-clone-modal-close'] = $field['acfe_clone_modal_close'];
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
if(acf_maybe_get($field, 'acfe_clone_modal_size')){
|
131 |
+
|
132 |
+
$wrapper['data-acfe-clone-modal-size'] = $field['acfe_clone_modal_size'];
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
return $wrapper;
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
add_filter('acf/load_field_groups', 'acfe_field_clone_ajax_query');
|
143 |
+
function acfe_field_clone_ajax_query($field_groups){
|
144 |
+
|
145 |
+
if(!acf_verify_ajax())
|
146 |
+
return $field_groups;
|
147 |
+
|
148 |
+
if(acf_maybe_get_POST('field_key') !== 'clone')
|
149 |
+
return $field_groups;
|
150 |
+
|
151 |
+
if(empty($field_groups))
|
152 |
+
return $field_groups;
|
153 |
+
|
154 |
+
foreach($field_groups as $i => $field_group){
|
155 |
+
|
156 |
+
if(!in_array($field_group['key'], array(
|
157 |
+
'group_acfe_author',
|
158 |
+
'group_acfe_dynamic_block_type',
|
159 |
+
'group_acfe_dynamic_form',
|
160 |
+
'group_acfe_dynamic_options_page',
|
161 |
+
'group_acfe_dynamic_post_type',
|
162 |
+
'group_acfe_dynamic_taxonomy')
|
163 |
+
))
|
164 |
+
continue;
|
165 |
+
|
166 |
+
unset($field_groups[$i]);
|
167 |
+
|
168 |
+
}
|
169 |
+
|
170 |
+
return $field_groups;
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
add_filter('acf/prepare_field/type=clone', 'acfe_field_clone_type_class', 99);
|
175 |
+
function acfe_field_clone_type_class($field){
|
176 |
+
|
177 |
+
if(acf_maybe_get($field, 'acfe_seamless_style')){
|
178 |
+
|
179 |
+
$field['wrapper']['class'] .= ' acfe-seamless-style';
|
180 |
+
|
181 |
+
}
|
182 |
+
|
183 |
+
if(acf_maybe_get($field, 'layout')){
|
184 |
+
|
185 |
+
$field['wrapper']['class'] .= ' acfe-field-clone-layout-' . $field['layout'];
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
return $field;
|
190 |
+
|
191 |
}
|
includes/fields/field-flexible-content.php
CHANGED
@@ -3,1160 +3,1283 @@
|
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
*/
|
9 |
-
add_action('acf/render_field_settings/type=flexible_content', 'acfe_flexible_settings', 0);
|
10 |
-
function acfe_flexible_settings($field){
|
11 |
|
12 |
-
|
13 |
-
acf_render_field_setting($field, array(
|
14 |
-
'label' => __('Stylised Button'),
|
15 |
-
'name' => 'acfe_flexible_stylised_button',
|
16 |
-
'key' => 'acfe_flexible_stylised_button',
|
17 |
-
'instructions' => __('Better actions buttons integration'),
|
18 |
-
'type' => 'true_false',
|
19 |
-
'message' => '',
|
20 |
-
'default_value' => false,
|
21 |
-
'ui' => true,
|
22 |
-
'ui_on_text' => '',
|
23 |
-
'ui_off_text' => '',
|
24 |
-
));
|
25 |
|
26 |
-
|
27 |
-
acf_render_field_setting($field, array(
|
28 |
-
'label' => __('Hide Empty Message'),
|
29 |
-
'name' => 'acfe_flexible_hide_empty_message',
|
30 |
-
'key' => 'acfe_flexible_hide_empty_message',
|
31 |
-
'instructions' => __('Hide the empty message box'),
|
32 |
-
'type' => 'true_false',
|
33 |
-
'message' => '',
|
34 |
-
'default_value' => false,
|
35 |
-
'ui' => true,
|
36 |
-
'ui_on_text' => '',
|
37 |
-
'ui_off_text' => '',
|
38 |
-
'conditional_logic' => array(
|
39 |
-
array(
|
40 |
-
array(
|
41 |
-
'field' => 'acfe_flexible_stylised_button',
|
42 |
-
'operator' => '!=',
|
43 |
-
'value' => '1',
|
44 |
-
),
|
45 |
-
)
|
46 |
-
)
|
47 |
-
));
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
array(
|
59 |
-
array(
|
60 |
-
'field' => 'acfe_flexible_stylised_button',
|
61 |
-
'operator' => '!=',
|
62 |
-
'value' => '1',
|
63 |
-
),
|
64 |
-
array(
|
65 |
-
'field' => 'acfe_flexible_hide_empty_message',
|
66 |
-
'operator' => '!=',
|
67 |
-
'value' => '1',
|
68 |
-
)
|
69 |
-
)
|
70 |
-
)
|
71 |
-
));
|
72 |
|
73 |
-
|
74 |
-
acf_render_field_setting($field, array(
|
75 |
-
'label' => __('Layouts: Thumbnails'),
|
76 |
-
'name' => 'acfe_flexible_layouts_thumbnails',
|
77 |
-
'key' => 'acfe_flexible_layouts_thumbnails',
|
78 |
-
'instructions' => __('Set a thumbnail for each layouts. You must save the field group to apply this setting'),
|
79 |
-
'type' => 'true_false',
|
80 |
-
'message' => '',
|
81 |
-
'default_value' => false,
|
82 |
-
'ui' => true,
|
83 |
-
'ui_on_text' => '',
|
84 |
-
'ui_off_text' => '',
|
85 |
-
));
|
86 |
|
87 |
-
//
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
'key' => 'acfe_flexible_layouts_settings',
|
92 |
-
'instructions' => __('Choose a field group to clone and to be used as a configuration modal'),
|
93 |
-
'type' => 'true_false',
|
94 |
-
'message' => '',
|
95 |
-
'default_value' => false,
|
96 |
-
'ui' => true,
|
97 |
-
'ui_on_text' => '',
|
98 |
-
'ui_off_text' => '',
|
99 |
-
));
|
100 |
|
101 |
-
//
|
102 |
-
|
103 |
-
'label' => __('Layouts: Asynchronous'),
|
104 |
-
'name' => 'acfe_flexible_layouts_ajax',
|
105 |
-
'key' => 'acfe_flexible_layouts_ajax',
|
106 |
-
'instructions' => __('Add layouts using Ajax method. This setting increase performance on complex Flexible Content'),
|
107 |
-
'type' => 'true_false',
|
108 |
-
'message' => '',
|
109 |
-
'default_value' => false,
|
110 |
-
'ui' => true,
|
111 |
-
'ui_on_text' => '',
|
112 |
-
'ui_off_text' => '',
|
113 |
-
));
|
114 |
|
115 |
-
//
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
'key' => 'acfe_flexible_layouts_templates',
|
120 |
-
'instructions' => __('Set template, style & javascript files for each layouts. This setting is mandatory in order to use <code style="font-size:11px;">get_flexible()</code> function. You must save the field group to apply this setting'),
|
121 |
-
'type' => 'true_false',
|
122 |
-
'message' => '',
|
123 |
-
'default_value' => false,
|
124 |
-
'ui' => true,
|
125 |
-
'ui_on_text' => '',
|
126 |
-
'ui_off_text' => '',
|
127 |
-
));
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
'label' => __('Layouts: Dynamic Preview'),
|
132 |
-
'name' => 'acfe_flexible_layouts_previews',
|
133 |
-
'key' => 'acfe_flexible_layouts_previews',
|
134 |
-
'instructions' => __('Use layouts render settings to display a dynamic preview in the post administration'),
|
135 |
-
'type' => 'true_false',
|
136 |
-
'message' => '',
|
137 |
-
'default_value' => false,
|
138 |
-
'ui' => true,
|
139 |
-
'ui_on_text' => '',
|
140 |
-
'ui_off_text' => '',
|
141 |
-
'conditional_logic' => array(
|
142 |
-
array(
|
143 |
-
array(
|
144 |
-
'field' => 'acfe_flexible_layouts_templates',
|
145 |
-
'operator' => '==',
|
146 |
-
'value' => '1',
|
147 |
-
)
|
148 |
-
)
|
149 |
-
)
|
150 |
-
));
|
151 |
|
152 |
-
//
|
153 |
-
|
154 |
-
|
155 |
-
'name' => 'acfe_flexible_layouts_placeholder',
|
156 |
-
'key' => 'acfe_flexible_layouts_placeholder',
|
157 |
-
'instructions' => __('Display a placeholder with a pencil icon, making edition easier'),
|
158 |
-
'type' => 'true_false',
|
159 |
-
'message' => '',
|
160 |
-
'default_value' => false,
|
161 |
-
'ui' => true,
|
162 |
-
'ui_on_text' => '',
|
163 |
-
'ui_off_text' => '',
|
164 |
-
'conditional_logic' => array(
|
165 |
-
array(
|
166 |
-
array(
|
167 |
-
'field' => 'acfe_flexible_layouts_previews',
|
168 |
-
'operator' => '==',
|
169 |
-
'value' => '',
|
170 |
-
)
|
171 |
-
)
|
172 |
-
)
|
173 |
-
));
|
174 |
|
175 |
-
//
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
'key' => 'acfe_flexible_disable_ajax_title',
|
180 |
-
'instructions' => __('Disable the additional ACF Layout Title Ajax call. If you don\'t perform operations using <code>acf/fields/flexible_content/layout_title</code> you can turn this setting on. <br /><br />More informations can be found on the <a href="https://www.advancedcustomfields.com/resources/acf-fields-flexible_content-layout_title/" target="_blank">ACF documentation</a>.'),
|
181 |
-
'type' => 'true_false',
|
182 |
-
'message' => '',
|
183 |
-
'default_value' => false,
|
184 |
-
'ui' => true,
|
185 |
-
'ui_on_text' => '',
|
186 |
-
'ui_off_text' => '',
|
187 |
-
));
|
188 |
|
189 |
-
|
190 |
-
|
191 |
-
'label' => __('Layouts: Close Button'),
|
192 |
-
'name' => 'acfe_flexible_close_button',
|
193 |
-
'key' => 'acfe_flexible_close_button',
|
194 |
-
'instructions' => __('Display a close button to collapse the layout'),
|
195 |
-
'type' => 'true_false',
|
196 |
-
'message' => '',
|
197 |
-
'default_value' => false,
|
198 |
-
'ui' => true,
|
199 |
-
'ui_on_text' => '',
|
200 |
-
'ui_off_text' => '',
|
201 |
));
|
202 |
|
203 |
-
|
204 |
-
acf_render_field_setting($field, array(
|
205 |
-
'label' => __('Layouts: Title Edition'),
|
206 |
-
'name' => 'acfe_flexible_title_edition',
|
207 |
-
'key' => 'acfe_flexible_title_edition',
|
208 |
-
'instructions' => __('Allow layout title edition'),
|
209 |
-
'type' => 'true_false',
|
210 |
-
'message' => '',
|
211 |
-
'default_value' => false,
|
212 |
-
'ui' => true,
|
213 |
-
'ui_on_text' => '',
|
214 |
-
'ui_off_text' => '',
|
215 |
-
));
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
|
231 |
-
|
232 |
-
acf_render_field_setting($field, array(
|
233 |
-
'label' => __('Layouts Modal: Edition'),
|
234 |
-
'name' => 'acfe_flexible_modal_edition',
|
235 |
-
'key' => 'acfe_flexible_modal_edition',
|
236 |
-
'instructions' => __('Edit layout content in a modal'),
|
237 |
-
'type' => 'true_false',
|
238 |
-
'message' => '',
|
239 |
-
'default_value' => false,
|
240 |
-
'ui' => true,
|
241 |
-
'ui_on_text' => '',
|
242 |
-
'ui_off_text' => '',
|
243 |
-
));
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
'name' => 'acfe_flexible_modal',
|
249 |
-
'key' => 'acfe_flexible_modal',
|
250 |
-
'instructions' => __('Select layouts in a modal'),
|
251 |
-
'type' => 'group',
|
252 |
-
'layout' => 'block',
|
253 |
-
'sub_fields' => array(
|
254 |
-
array(
|
255 |
-
'label' => '',
|
256 |
-
'name' => 'acfe_flexible_modal_enabled',
|
257 |
-
'key' => 'acfe_flexible_modal_enabled',
|
258 |
-
'type' => 'true_false',
|
259 |
-
'instructions' => '',
|
260 |
-
'required' => false,
|
261 |
-
'wrapper' => array(
|
262 |
-
'width' => '',
|
263 |
-
'class' => '',
|
264 |
-
'id' => '',
|
265 |
-
),
|
266 |
-
'message' => '',
|
267 |
-
'default_value' => false,
|
268 |
-
'ui' => true,
|
269 |
-
'ui_on_text' => '',
|
270 |
-
'ui_off_text' => '',
|
271 |
-
'conditional_logic' => false,
|
272 |
-
),
|
273 |
-
array(
|
274 |
-
'label' => '',
|
275 |
-
'name' => 'acfe_flexible_modal_title',
|
276 |
-
'key' => 'acfe_flexible_modal_title',
|
277 |
-
'type' => 'text',
|
278 |
-
'prepend' => __('Modal Title'),
|
279 |
-
'placeholder' => 'Add Row',
|
280 |
-
'instructions' => false,
|
281 |
-
'required' => false,
|
282 |
-
'wrapper' => array(
|
283 |
-
'width' => '35',
|
284 |
-
'class' => '',
|
285 |
-
'id' => '',
|
286 |
-
),
|
287 |
-
'conditional_logic' => array(
|
288 |
-
array(
|
289 |
-
array(
|
290 |
-
'field' => 'acfe_flexible_modal_enabled',
|
291 |
-
'operator' => '==',
|
292 |
-
'value' => '1',
|
293 |
-
)
|
294 |
-
)
|
295 |
-
)
|
296 |
-
),
|
297 |
-
array(
|
298 |
-
'label' => '',
|
299 |
-
'name' => 'acfe_flexible_modal_col',
|
300 |
-
'key' => 'acfe_flexible_modal_col',
|
301 |
-
'type' => 'select',
|
302 |
-
'prepend' => '',
|
303 |
-
'instructions' => false,
|
304 |
-
'required' => false,
|
305 |
-
'choices' => array(
|
306 |
-
'1' => '1 column',
|
307 |
-
'2' => '2 columns',
|
308 |
-
'3' => '3 columns',
|
309 |
-
'4' => '4 columns',
|
310 |
-
'5' => '5 columns',
|
311 |
-
'6' => '6 columns',
|
312 |
-
),
|
313 |
-
'default_value' => '4',
|
314 |
-
'wrapper' => array(
|
315 |
-
'width' => '15',
|
316 |
-
'class' => '',
|
317 |
-
'id' => '',
|
318 |
-
),
|
319 |
-
'conditional_logic' => array(
|
320 |
-
array(
|
321 |
-
array(
|
322 |
-
'field' => 'acfe_flexible_modal_enabled',
|
323 |
-
'operator' => '==',
|
324 |
-
'value' => '1',
|
325 |
-
)
|
326 |
-
)
|
327 |
-
)
|
328 |
-
),
|
329 |
-
array(
|
330 |
-
'label' => '',
|
331 |
-
'name' => 'acfe_flexible_modal_categories',
|
332 |
-
'key' => 'acfe_flexible_modal_categories',
|
333 |
-
'type' => 'true_false',
|
334 |
-
'message' => __('Categories'),
|
335 |
-
'instructions' => false,
|
336 |
-
'required' => false,
|
337 |
-
'wrapper' => array(
|
338 |
-
'width' => '25',
|
339 |
-
'class' => '',
|
340 |
-
'id' => '',
|
341 |
-
),
|
342 |
-
'conditional_logic' => array(
|
343 |
-
array(
|
344 |
-
array(
|
345 |
-
'field' => 'acfe_flexible_modal_enabled',
|
346 |
-
'operator' => '==',
|
347 |
-
'value' => '1',
|
348 |
-
)
|
349 |
-
)
|
350 |
-
)
|
351 |
-
),
|
352 |
-
)
|
353 |
-
));
|
354 |
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
'key' => 'acfe_flexible_layouts_state',
|
360 |
-
'instructions' => __('Force layouts to be collapsed or opened'),
|
361 |
-
'type' => 'select',
|
362 |
-
'placeholder' => __('Default', 'acfe'),
|
363 |
-
'allow_null' => true,
|
364 |
-
'choices' => array(
|
365 |
-
'collapse' => 'Collapsed',
|
366 |
-
'open' => 'Opened',
|
367 |
-
),
|
368 |
-
'conditional_logic' => array(
|
369 |
-
array(
|
370 |
-
array(
|
371 |
-
'field' => 'acfe_flexible_modal_edition',
|
372 |
-
'operator' => '!=',
|
373 |
-
'value' => '1',
|
374 |
-
)
|
375 |
-
)
|
376 |
-
)
|
377 |
-
));
|
378 |
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
'instructions' => __('Remove collapse action'),
|
385 |
-
'type' => 'true_false',
|
386 |
-
'message' => '',
|
387 |
-
'default_value' => false,
|
388 |
-
'ui' => true,
|
389 |
-
'ui_on_text' => '',
|
390 |
-
'ui_off_text' => '',
|
391 |
-
'conditional_logic' => array(
|
392 |
-
array(
|
393 |
-
array(
|
394 |
-
'field' => 'acfe_flexible_modal_edition',
|
395 |
-
'operator' => '!=',
|
396 |
-
'value' => '1',
|
397 |
-
),
|
398 |
-
array(
|
399 |
-
'field' => 'acfe_flexible_layouts_state',
|
400 |
-
'operator' => '==',
|
401 |
-
'value' => 'open',
|
402 |
-
)
|
403 |
-
)
|
404 |
-
)
|
405 |
-
));
|
406 |
|
407 |
}
|
408 |
|
409 |
-
|
410 |
-
function
|
411 |
|
412 |
-
if(
|
413 |
-
return;
|
|
|
|
|
414 |
|
415 |
-
|
|
|
|
|
|
|
416 |
|
417 |
-
|
418 |
-
|
419 |
-
'type' => 'hidden',
|
420 |
-
'name' => 'acfe_flexible_settings_label'
|
421 |
-
), 'ul');
|
422 |
|
423 |
-
|
424 |
|
425 |
}
|
426 |
|
427 |
-
|
428 |
-
function
|
429 |
|
430 |
-
if(
|
431 |
-
return;
|
432 |
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
$keys = acfe_array_keys_r($output);
|
437 |
|
438 |
-
|
439 |
-
$_layout_key = $keys[3];
|
440 |
|
441 |
-
|
442 |
-
$layout = $field_flexible['layouts'][$_layout_key];
|
443 |
|
444 |
-
$
|
445 |
-
$is_flexible_layouts_settings = isset($field_flexible['acfe_flexible_layouts_settings']) && !empty($field_flexible['acfe_flexible_layouts_settings']);
|
446 |
-
$is_flexible_layouts_templates = isset($field_flexible['acfe_flexible_layouts_templates']) && !empty($field_flexible['acfe_flexible_layouts_templates']);
|
447 |
-
$is_flexible_modal_enabled = isset($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_enabled']) && !empty($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_enabled']);
|
448 |
-
$is_flexible_modal_categories = isset($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_categories']) && !empty($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_categories']);
|
449 |
|
450 |
-
|
451 |
-
if($is_flexible_modal_enabled && $is_flexible_modal_categories){
|
452 |
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
'conditional_logic' => array(
|
466 |
array(
|
467 |
array(
|
468 |
-
'field' => '
|
469 |
'operator' => '==',
|
470 |
'value' => '1',
|
471 |
),
|
472 |
array(
|
473 |
-
'field' => '
|
474 |
-
'operator' => '
|
475 |
'value' => '1',
|
476 |
-
)
|
477 |
)
|
478 |
)
|
479 |
-
|
480 |
-
|
481 |
-
), 'ul');
|
482 |
-
|
483 |
-
}
|
484 |
-
|
485 |
-
// Template
|
486 |
-
if($is_flexible_layouts_templates){
|
487 |
-
|
488 |
-
$acfe_flexible_render_template = isset($layout['acfe_flexible_render_template']) ? $layout['acfe_flexible_render_template'] : '';
|
489 |
|
490 |
-
|
491 |
-
|
492 |
-
'
|
493 |
-
'name' => '
|
494 |
-
'
|
495 |
-
'
|
496 |
-
'
|
497 |
-
'
|
498 |
-
'
|
499 |
-
|
500 |
-
|
|
|
501 |
'conditional_logic' => array(
|
502 |
array(
|
503 |
array(
|
504 |
-
'field' => '
|
505 |
'operator' => '==',
|
506 |
'value' => '1',
|
507 |
-
)
|
|
|
|
|
|
|
|
|
|
|
508 |
)
|
509 |
)
|
510 |
-
|
511 |
-
|
512 |
-
), 'ul');
|
513 |
-
|
514 |
-
$acfe_flexible_render_style = isset($layout['acfe_flexible_render_style']) ? $layout['acfe_flexible_render_style'] : '';
|
515 |
|
516 |
-
|
517 |
-
|
518 |
-
'
|
|
|
|
|
|
|
519 |
'type' => 'text',
|
520 |
-
'
|
521 |
-
'prefix' => $layout_prefix,
|
522 |
-
'value' => $acfe_flexible_render_style,
|
523 |
-
'placeholder' => 'style.css',
|
524 |
-
|
525 |
-
/*
|
526 |
'conditional_logic' => array(
|
527 |
array(
|
528 |
array(
|
529 |
-
'field' => '
|
530 |
'operator' => '==',
|
531 |
'value' => '1',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
)
|
533 |
)
|
534 |
)
|
535 |
-
|
536 |
-
|
537 |
-
), 'ul');
|
538 |
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
'
|
543 |
-
'
|
544 |
-
'
|
545 |
-
'
|
546 |
-
'
|
547 |
-
'
|
548 |
-
'
|
549 |
-
|
550 |
-
|
551 |
'conditional_logic' => array(
|
552 |
array(
|
553 |
array(
|
554 |
-
'field' => '
|
555 |
'operator' => '==',
|
556 |
'value' => '1',
|
557 |
-
)
|
558 |
)
|
559 |
)
|
560 |
-
|
561 |
-
|
562 |
-
), 'ul');
|
563 |
-
|
564 |
-
}
|
565 |
-
|
566 |
-
// Thumbnail
|
567 |
-
if($is_flexible_layouts_thumbnails){
|
568 |
-
|
569 |
-
$acfe_flexible_thumbnail = isset($layout['acfe_flexible_thumbnail']) ? $layout['acfe_flexible_thumbnail'] : '';
|
570 |
|
571 |
-
|
572 |
-
|
573 |
-
'
|
574 |
-
'
|
575 |
-
'
|
576 |
-
'
|
577 |
-
'
|
578 |
-
'
|
579 |
-
'
|
580 |
-
'
|
581 |
-
|
582 |
-
|
583 |
'conditional_logic' => array(
|
584 |
array(
|
585 |
array(
|
586 |
-
'field' => '
|
587 |
'operator' => '==',
|
588 |
'value' => '1',
|
589 |
-
)
|
590 |
)
|
591 |
)
|
592 |
-
|
593 |
-
|
594 |
-
), 'ul');
|
595 |
-
|
596 |
-
}
|
597 |
-
|
598 |
-
// Settings
|
599 |
-
if($is_flexible_layouts_settings){
|
600 |
|
601 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
602 |
|
603 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
604 |
|
605 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
606 |
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
617 |
|
618 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
|
620 |
-
|
621 |
-
|
622 |
-
'
|
623 |
-
'
|
624 |
-
'
|
625 |
-
'
|
626 |
-
'
|
627 |
-
'
|
628 |
-
'
|
629 |
-
'
|
630 |
-
'
|
631 |
-
'
|
632 |
-
'
|
633 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
634 |
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
644 |
|
645 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
651 |
|
652 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
653 |
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
|
659 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
660 |
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
672 |
|
673 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
674 |
|
675 |
-
//
|
676 |
-
|
677 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
|
679 |
-
// Title
|
680 |
-
if(isset($field['acfe_flexible_modal']['acfe_flexible_modal_title']) && !empty($field['acfe_flexible_modal']['acfe_flexible_modal_title']))
|
681 |
-
$wrapper['data-acfe-flexible-modal-title'] = $field['acfe_flexible_modal']['acfe_flexible_modal_title'];
|
682 |
-
|
683 |
}
|
684 |
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
|
690 |
-
|
691 |
-
|
692 |
-
// Layouts: Close Button
|
693 |
-
if(acf_maybe_get($field, 'acfe_flexible_close_button')){
|
694 |
|
695 |
-
|
696 |
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
|
|
701 |
|
702 |
-
|
703 |
|
704 |
}
|
705 |
|
706 |
-
|
707 |
-
|
|
|
|
|
708 |
|
709 |
-
if(
|
710 |
-
|
711 |
-
// Collapse
|
712 |
-
if($field['acfe_flexible_layouts_state'] === 'collapse'){
|
713 |
-
|
714 |
-
$wrapper['data-acfe-flexible-close'] = 1;
|
715 |
-
|
716 |
-
}
|
717 |
-
|
718 |
-
// Open
|
719 |
-
elseif($field['acfe_flexible_layouts_state'] === 'open'){
|
720 |
-
|
721 |
-
$wrapper['data-acfe-flexible-open'] = 1;
|
722 |
-
|
723 |
-
}
|
724 |
-
|
725 |
-
}
|
726 |
-
|
727 |
-
}
|
728 |
-
|
729 |
-
// Layouts Placeholder
|
730 |
-
if(acf_maybe_get($field, 'acfe_flexible_layouts_placeholder')){
|
731 |
-
|
732 |
-
$wrapper['data-acfe-flexible-placeholder'] = 1;
|
733 |
|
734 |
-
|
735 |
-
|
736 |
-
// Layouts Previews
|
737 |
-
if(acf_maybe_get($field, 'acfe_flexible_layouts_templates') && acf_maybe_get($field, 'acfe_flexible_layouts_previews')){
|
738 |
|
739 |
-
|
|
|
|
|
740 |
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
$layout_placeholder_icon = false;
|
745 |
-
$layout_placeholder_icon = apply_filters('acfe/flexible/placeholder/icon', $layout_placeholder_icon, $field);
|
746 |
-
$layout_placeholder_icon = apply_filters('acfe/flexible/placeholder/icon/name=' . $field['_name'], $layout_placeholder_icon, $field);
|
747 |
-
$layout_placeholder_icon = apply_filters('acfe/flexible/placeholder/icon/key=' . $field['key'], $layout_placeholder_icon, $field);
|
748 |
-
|
749 |
-
if(!empty($layout_placeholder_icon)){
|
750 |
|
751 |
-
|
|
|
|
|
752 |
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
|
|
|
|
|
|
762 |
|
763 |
-
|
764 |
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
774 |
|
775 |
-
|
776 |
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
}
|
792 |
-
|
793 |
-
add_filter('acf/prepare_field/type=flexible_content', 'acfe_flexible_layout_title_prepare');
|
794 |
-
function acfe_flexible_layout_title_prepare($field){
|
795 |
-
|
796 |
-
if(empty($field['layouts']))
|
797 |
-
return $field;
|
798 |
-
|
799 |
-
foreach($field['layouts'] as $k => &$layout){
|
800 |
|
801 |
-
|
802 |
-
$thumbnail = false;
|
803 |
-
$span_class = false;
|
804 |
|
805 |
-
//
|
806 |
-
if(
|
807 |
-
|
808 |
-
$class = $style = array();
|
809 |
-
$class[] = 'acfe-flexible-layout-thumbnail';
|
810 |
-
|
811 |
-
// Modal disabled
|
812 |
-
if(!isset($field['acfe_flexible_modal']['acfe_flexible_modal_enabled']) || empty($field['acfe_flexible_modal']['acfe_flexible_modal_enabled']))
|
813 |
-
$class[] = 'acfe-flexible-layout-thumbnail-no-modal';
|
814 |
-
|
815 |
-
// Thumbnail is set
|
816 |
-
$thumbnail_found = false;
|
817 |
-
|
818 |
-
$acfe_flexible_thumbnail = false;
|
819 |
-
if(acf_maybe_get($layout, 'acfe_flexible_thumbnail'))
|
820 |
-
$acfe_flexible_thumbnail = $layout['acfe_flexible_thumbnail'];
|
821 |
|
822 |
-
|
823 |
-
// Flexible Thumbnails
|
824 |
-
$acfe_flexible_thumbnail = apply_filters('acfe/flexible/thumbnail/name=' . $field['_name'], $acfe_flexible_thumbnail, $field, $layout);
|
825 |
-
$acfe_flexible_thumbnail = apply_filters('acfe/flexible/thumbnail/key=' . $field['key'], $acfe_flexible_thumbnail, $field, $layout);
|
826 |
-
|
827 |
-
$acfe_flexible_thumbnail = apply_filters('acfe/flexible/layout/thumbnail/layout=' . $layout['name'], $acfe_flexible_thumbnail, $field, $layout);
|
828 |
-
$acfe_flexible_thumbnail = apply_filters('acfe/flexible/layout/thumbnail/name=' . $field['_name'] . '&layout=' . $layout['name'], $acfe_flexible_thumbnail, $field, $layout);
|
829 |
-
$acfe_flexible_thumbnail = apply_filters('acfe/flexible/layout/thumbnail/key=' . $field['key'] . '&layout=' . $layout['name'], $acfe_flexible_thumbnail, $field, $layout);
|
830 |
|
831 |
-
|
832 |
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
if($thumbnail_src = wp_get_attachment_url($acfe_flexible_thumbnail)){
|
837 |
-
|
838 |
-
$thumbnail_found = true;
|
839 |
-
$style[] = 'background-image:url(' . $thumbnail_src . ');';
|
840 |
-
|
841 |
-
}
|
842 |
-
|
843 |
-
}
|
844 |
|
845 |
-
|
846 |
-
else{
|
847 |
|
848 |
-
$
|
849 |
-
$style[] = 'background-image:url(' . $acfe_flexible_thumbnail . ');';
|
850 |
|
851 |
}
|
852 |
-
|
853 |
-
}
|
854 |
-
|
855 |
-
// Thumbnail not found
|
856 |
-
if(!$thumbnail_found){
|
857 |
-
|
858 |
-
$class[] = 'acfe-flexible-layout-thumbnail-not-found';
|
859 |
|
860 |
}
|
861 |
|
862 |
-
|
863 |
|
864 |
-
|
865 |
-
|
866 |
-
// No Thumbnails
|
867 |
-
else{
|
868 |
|
869 |
-
|
|
|
|
|
|
|
|
|
870 |
|
871 |
-
|
872 |
-
|
873 |
-
// Category
|
874 |
-
$category = '';
|
875 |
-
if(isset($field['acfe_flexible_modal']['acfe_flexible_modal_categories']) && !empty($field['acfe_flexible_modal']['acfe_flexible_modal_categories']) && acf_maybe_get($layout, 'acfe_flexible_category')){
|
876 |
|
877 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
878 |
|
879 |
}
|
880 |
|
881 |
-
$layout['label'] = $thumbnail . '<span '.$category.' ' . $span_class . '>' . $layout['label'] . '</span>';
|
882 |
-
|
883 |
-
}
|
884 |
-
|
885 |
-
return $field;
|
886 |
-
|
887 |
-
}
|
888 |
-
|
889 |
-
add_filter('acf/fields/flexible_content/layout_title', 'acfe_flexible_layout_title_ajax', 0, 4);
|
890 |
-
function acfe_flexible_layout_title_ajax($title, $field, $layout, $i){
|
891 |
-
|
892 |
-
// Remove thumbnail
|
893 |
-
$title = preg_replace('#<div class="acfe-flexible-layout-thumbnail(.*?)</div>#', '', $title);
|
894 |
-
|
895 |
-
// Title Edition
|
896 |
-
if(acf_maybe_get($field, 'acfe_flexible_title_edition')){
|
897 |
-
|
898 |
-
// Get Layout Title
|
899 |
-
$acfe_flexible_layout_title = get_sub_field('acfe_flexible_layout_title');
|
900 |
-
if(!empty($acfe_flexible_layout_title))
|
901 |
-
$title = wp_unslash($acfe_flexible_layout_title);
|
902 |
-
|
903 |
-
// Return
|
904 |
-
return '<span class="acfe-layout-title acf-js-tooltip" title="' . __('Layout', 'acfe') . ': ' . esc_attr(strip_tags($layout['label'])) . '"><span class="acfe-layout-title-text">' . $title . '</span></span>';
|
905 |
-
|
906 |
}
|
907 |
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
add_action('acf/render_field/type=flexible_content', 'acfe_flexible_render_field');
|
914 |
-
function acfe_flexible_render_field($field){
|
915 |
-
|
916 |
-
if(!acf_maybe_get($field, 'acfe_flexible_layouts_templates') || !acf_maybe_get($field, 'acfe_flexible_layouts_previews') || empty($field['layouts']))
|
917 |
-
return;
|
918 |
-
|
919 |
-
// Vars
|
920 |
-
global $is_preview;
|
921 |
-
$is_preview = true;
|
922 |
-
|
923 |
-
// Actions
|
924 |
-
do_action('acfe/flexible/enqueue', $field, $is_preview);
|
925 |
-
do_action('acfe/flexible/enqueue/name=' . $field['_name'], $field, $is_preview);
|
926 |
-
do_action('acfe/flexible/enqueue/key=' . $field['key'], $field, $is_preview);
|
927 |
-
|
928 |
-
// Layouts Previews
|
929 |
-
foreach($field['layouts'] as $layout_key => $layout){
|
930 |
-
|
931 |
-
// Render: Enqueue
|
932 |
-
acfe_flexible_render_layout_enqueue($layout, $field);
|
933 |
|
934 |
-
|
935 |
-
|
936 |
-
}
|
937 |
-
|
938 |
-
add_action('wp_ajax_acfe/flexible/layout_preview', 'acfe_flexible_layout_preview');
|
939 |
-
function acfe_flexible_layout_preview($args = array()){
|
940 |
-
|
941 |
-
$options = $args;
|
942 |
-
|
943 |
-
if(empty($options)){
|
944 |
-
|
945 |
-
// Options
|
946 |
$options = acf_parse_args($_POST, array(
|
947 |
-
'
|
948 |
-
'
|
949 |
-
'field_key' => '',
|
950 |
-
'nonce' => '',
|
951 |
-
'layout' => '',
|
952 |
-
'value' => array()
|
953 |
));
|
954 |
-
|
955 |
-
}
|
956 |
-
|
957 |
-
// Load field
|
958 |
-
$field = acf_get_field($options['field_key']);
|
959 |
-
if(!$field)
|
960 |
-
die;
|
961 |
-
|
962 |
-
// Get Flexible
|
963 |
-
$flexible = acf_get_field_type('flexible_content');
|
964 |
-
|
965 |
-
// Vars
|
966 |
-
$layout = $flexible->get_layout($options['layout'], $field);
|
967 |
-
if(!$layout)
|
968 |
-
die;
|
969 |
-
|
970 |
-
if(!acf_maybe_get($layout, 'acfe_flexible_thumbnail'))
|
971 |
-
$layout['acfe_flexible_thumbnail'] = false;
|
972 |
-
|
973 |
-
// Flexible Thumbnails
|
974 |
-
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/thumbnail/name=' . $field['_name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
975 |
-
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/thumbnail/key=' . $field['key'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
976 |
-
|
977 |
-
// Layout Thumbnails
|
978 |
-
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/layout/thumbnail/layout=' . $layout['name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
979 |
-
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/layout/thumbnail/name=' . $field['_name'] . '&layout=' . $layout['name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
980 |
-
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/layout/thumbnail/key=' . $field['key'] . '&layout=' . $layout['name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
981 |
-
|
982 |
-
$meta = array($options['field_key'] => array(
|
983 |
-
wp_unslash($options['value'])
|
984 |
-
));
|
985 |
-
|
986 |
-
acf_setup_meta($meta, $options['field_key'] . '_' . $options['i'], true);
|
987 |
-
|
988 |
-
if(have_rows($options['field_key'])):
|
989 |
-
while(have_rows($options['field_key'])): the_row();
|
990 |
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
acf_reset_meta($options['field_key'] . '_' . $options['i']);
|
1012 |
-
|
1013 |
-
if(wp_doing_ajax()){
|
1014 |
-
die;
|
1015 |
-
}
|
1016 |
-
|
1017 |
-
}
|
1018 |
-
|
1019 |
-
add_action('acfe/flexible/preview', 'acfe_flexible_layout_preview_render', 99, 2);
|
1020 |
-
function acfe_flexible_layout_preview_render($field, $layout){
|
1021 |
-
|
1022 |
-
global $is_preview;
|
1023 |
-
|
1024 |
-
$is_preview = true;
|
1025 |
-
|
1026 |
-
acfe_flexible_render_layout_template($layout, $field);
|
1027 |
-
|
1028 |
-
}
|
1029 |
-
|
1030 |
-
add_filter('acfe/flexible/render/template', 'acfe_flexible_layout_render_template_setting', 0, 4);
|
1031 |
-
function acfe_flexible_layout_render_template_setting($return, $field, $layout, $is_preview){
|
1032 |
-
|
1033 |
-
if(acf_maybe_get($layout, 'acfe_flexible_render_template'))
|
1034 |
-
$return = $layout['acfe_flexible_render_template'];
|
1035 |
-
|
1036 |
-
return $return;
|
1037 |
-
|
1038 |
-
}
|
1039 |
-
|
1040 |
-
add_filter('acfe/flexible/render/style', 'acfe_flexible_layout_render_style_setting', 0, 4);
|
1041 |
-
function acfe_flexible_layout_render_style_setting($return, $field, $layout, $is_preview){
|
1042 |
-
|
1043 |
-
if(acf_maybe_get($layout, 'acfe_flexible_render_style'))
|
1044 |
-
$return = $layout['acfe_flexible_render_style'];
|
1045 |
-
|
1046 |
-
return $return;
|
1047 |
-
|
1048 |
-
}
|
1049 |
-
|
1050 |
-
add_filter('acfe/flexible/render/script', 'acfe_flexible_layout_render_script_setting', 0, 4);
|
1051 |
-
function acfe_flexible_layout_render_script_setting($return, $field, $layout, $is_preview){
|
1052 |
-
|
1053 |
-
if(acf_maybe_get($layout, 'acfe_flexible_render_script'))
|
1054 |
-
$return = $layout['acfe_flexible_render_script'];
|
1055 |
-
|
1056 |
-
return $return;
|
1057 |
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1061 |
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
public $state = false;
|
1066 |
-
public $placeholder = false;
|
1067 |
-
public $preview = false;
|
1068 |
-
public $modal_edition = false;
|
1069 |
-
public $title_edition = false;
|
1070 |
-
public $copy_paste = false;
|
1071 |
-
public $remove_collapse = false;
|
1072 |
-
public $close_button = false;
|
1073 |
-
public $stylised_button = false;
|
1074 |
-
public $remove_actions = false;
|
1075 |
-
|
1076 |
-
function __construct(){
|
1077 |
|
1078 |
-
|
|
|
|
|
|
|
|
|
|
|
1079 |
|
1080 |
-
|
1081 |
-
$this->flexible = acf_get_field_type('flexible_content');
|
1082 |
|
1083 |
-
|
1084 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1085 |
|
1086 |
-
|
1087 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1088 |
|
1089 |
-
|
1090 |
-
$this->add_filter('acfe/flexible/layouts/icons', array($this, 'add_layout_icons'), 10, 3);
|
1091 |
-
$this->add_filter('acfe/flexible/layouts/div', array($this, 'add_layout_div'), 10, 3);
|
1092 |
-
$this->add_filter('acfe/flexible/layouts/handle', array($this, 'add_layout_handle'), 10, 3);
|
1093 |
|
1094 |
-
|
|
|
|
|
|
|
|
|
|
|
1095 |
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1099 |
|
1100 |
}
|
1101 |
|
|
|
|
|
|
|
1102 |
function load_fields($fields, $field){
|
1103 |
|
1104 |
-
if(
|
1105 |
-
return $fields;
|
1106 |
-
|
1107 |
-
if(acf_is_screen(array('edit-acf-field-group', 'acf-field-group', 'acf_page_acf-tools')))
|
1108 |
return $fields;
|
1109 |
|
1110 |
-
|
|
|
1111 |
return $fields;
|
1112 |
|
1113 |
-
|
1114 |
-
$
|
|
|
1115 |
|
1116 |
-
//
|
1117 |
-
if(!$
|
1118 |
return $fields;
|
1119 |
|
1120 |
foreach($field['layouts'] as $layout_key => $layout){
|
1121 |
|
1122 |
// Settings
|
1123 |
-
if($
|
1124 |
|
1125 |
-
$
|
1126 |
-
|
1127 |
-
|
|
|
1128 |
|
1129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1130 |
|
1131 |
acf_add_local_field(array(
|
1132 |
'label' => false,
|
1133 |
-
'key' => '
|
1134 |
'name' => 'layout_settings',
|
1135 |
'type' => 'clone',
|
1136 |
-
'clone' =>
|
1137 |
'display' => 'group',
|
1138 |
'acfe_seamless_style' => true,
|
1139 |
-
'layout' => $
|
1140 |
'prefix_label' => 0,
|
1141 |
'prefix_name' => 1,
|
1142 |
'parent_layout' => $layout['key'],
|
1143 |
'parent' => $field['key']
|
1144 |
));
|
1145 |
|
1146 |
-
$clone = acf_get_field('
|
1147 |
|
1148 |
array_unshift($fields, $clone);
|
1149 |
|
1150 |
}
|
1151 |
-
|
1152 |
}
|
1153 |
|
1154 |
// Title Edition
|
1155 |
-
if($
|
1156 |
|
1157 |
acf_add_local_field(array(
|
1158 |
'label' => false,
|
1159 |
-
'key' => '
|
1160 |
'name' => 'acfe_flexible_layout_title',
|
1161 |
'type' => 'text',
|
1162 |
'required' => false,
|
@@ -1167,7 +1290,7 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1167 |
'parent' => $field['key']
|
1168 |
));
|
1169 |
|
1170 |
-
$title = acf_get_field('
|
1171 |
|
1172 |
array_unshift($fields, $title);
|
1173 |
|
@@ -1179,41 +1302,169 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1179 |
|
1180 |
}
|
1181 |
|
1182 |
-
|
|
|
|
|
|
|
1183 |
|
1184 |
-
//
|
1185 |
-
|
1186 |
-
|
1187 |
-
'
|
1188 |
-
|
|
|
1189 |
|
1190 |
-
|
1191 |
-
if(
|
1192 |
-
|
|
|
|
|
|
|
1193 |
|
1194 |
-
|
|
|
|
|
|
|
|
|
|
|
1195 |
|
1196 |
-
|
|
|
1197 |
|
1198 |
-
|
1199 |
-
|
|
|
|
|
|
|
|
|
1200 |
|
1201 |
-
$
|
1202 |
|
1203 |
-
|
|
|
|
|
1204 |
|
|
|
|
|
|
|
|
|
1205 |
}
|
1206 |
|
1207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1208 |
|
1209 |
}
|
1210 |
|
|
|
|
|
|
|
1211 |
function render_field($field){
|
1212 |
|
1213 |
-
//
|
1214 |
-
$
|
1215 |
-
|
1216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1217 |
|
1218 |
// Remove actions
|
1219 |
$remove_actions = false;
|
@@ -1266,7 +1517,7 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1266 |
<?php foreach($layouts as $layout):
|
1267 |
|
1268 |
// Ajax
|
1269 |
-
if($
|
1270 |
|
1271 |
$div = array(
|
1272 |
'class' => 'layout acf-clone',
|
@@ -1274,7 +1525,6 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1274 |
'data-layout' => $layout['name']
|
1275 |
);
|
1276 |
|
1277 |
-
|
1278 |
echo '<div ' . acf_esc_attr($div) . '></div>';
|
1279 |
|
1280 |
// No ajax
|
@@ -1305,98 +1555,100 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1305 |
endif; ?>
|
1306 |
</div>
|
1307 |
|
1308 |
-
<?php
|
1309 |
-
|
1310 |
-
$button = array(
|
1311 |
-
'class' => 'acf-button button',
|
1312 |
-
'href' => '#',
|
1313 |
-
'data-name' => 'add-layout',
|
1314 |
-
);
|
1315 |
-
|
1316 |
-
if(!$stylised_button){
|
1317 |
-
|
1318 |
-
$button['class'] .= ' button-primary';
|
1319 |
-
|
1320 |
-
}
|
1321 |
-
|
1322 |
-
if($stylised_button){ ?>
|
1323 |
-
<div class="acfe-flexible-stylised-button">
|
1324 |
-
<?php } ?>
|
1325 |
|
1326 |
-
|
1327 |
-
<a <?php echo acf_esc_attr($button); ?>><?php echo $field['button_label']; ?></a>
|
1328 |
-
|
1329 |
-
<?php
|
1330 |
|
1331 |
-
$
|
|
|
|
|
|
|
|
|
1332 |
|
1333 |
-
if(
|
1334 |
|
1335 |
-
$
|
1336 |
-
$secondary_actions['paste'] = '<a href="#" data-acfe-flexible-control-action="paste">' . __('Paste layouts', 'acfe') . '</a>';
|
1337 |
|
1338 |
}
|
1339 |
|
1340 |
-
$
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
?>
|
1345 |
-
|
1346 |
-
<?php if(!empty($secondary_actions)){ ?>
|
1347 |
|
|
|
|
|
|
|
1348 |
<?php
|
1349 |
|
1350 |
-
$
|
1351 |
-
'class' => 'button',
|
1352 |
-
'style' => 'padding-left:5px;padding-right:5px; margin-left:3px;',
|
1353 |
-
'href' => '#',
|
1354 |
-
'data-name' => 'acfe-flexible-control-button',
|
1355 |
-
);
|
1356 |
|
1357 |
-
if(
|
1358 |
|
1359 |
-
$
|
|
|
1360 |
|
1361 |
}
|
|
|
|
|
|
|
|
|
|
|
1362 |
?>
|
1363 |
-
|
1364 |
-
<a <?php echo acf_esc_attr($button_secondary); ?>>
|
1365 |
-
<span class="dashicons dashicons-arrow-down-alt2" style="vertical-align:text-top;width:auto;height:auto;font-size:13px;line-height:20px;"></span>
|
1366 |
-
</a>
|
1367 |
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1375 |
|
|
|
|
|
1376 |
<?php } ?>
|
1377 |
-
|
1378 |
-
</div>
|
1379 |
-
|
1380 |
-
<?php if($stylised_button){ ?>
|
1381 |
-
</div>
|
1382 |
-
<?php } ?>
|
1383 |
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
|
|
|
|
1394 |
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
</ul>
|
1399 |
-
</script>
|
1400 |
|
1401 |
<?php } ?>
|
1402 |
|
@@ -1405,25 +1657,11 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1405 |
|
1406 |
}
|
1407 |
|
|
|
|
|
|
|
1408 |
function render_layout($field, $layout, $i, $value){
|
1409 |
|
1410 |
-
// settings
|
1411 |
-
$this->state = acf_maybe_get($field, 'acfe_flexible_layouts_state');
|
1412 |
-
$this->placeholder = acf_maybe_get($field, 'acfe_flexible_layouts_placeholder');
|
1413 |
-
$this->preview = acf_maybe_get($field, 'acfe_flexible_layouts_previews');
|
1414 |
-
$this->modal_edition = acf_maybe_get($field, 'acfe_flexible_modal_edition');
|
1415 |
-
$this->title_edition = acf_maybe_get($field, 'acfe_flexible_title_edition');
|
1416 |
-
$this->copy_paste = acf_maybe_get($field, 'acfe_flexible_copy_paste');
|
1417 |
-
$this->remove_collapse = acf_maybe_get($field, 'acfe_flexible_layouts_remove_collapse');
|
1418 |
-
$this->close_button = acf_maybe_get($field, 'acfe_flexible_close_button');
|
1419 |
-
$this->stylised_button = acf_maybe_get($field, 'acfe_flexible_stylised_button');
|
1420 |
-
$this->settings = acf_maybe_get($layout, 'acfe_flexible_settings');
|
1421 |
-
|
1422 |
-
// Remove actions
|
1423 |
-
$this->remove_actions = apply_filters('acfe/flexible/remove_actions', $this->remove_actions, $field);
|
1424 |
-
$this->remove_actions = apply_filters('acfe/flexible/remove_actions/name=' . $field['_name'], $this->remove_actions, $field);
|
1425 |
-
$this->remove_actions = apply_filters('acfe/flexible/remove_actions/key=' . $field['key'], $this->remove_actions, $field);
|
1426 |
-
|
1427 |
// vars
|
1428 |
$sub_fields = $layout['sub_fields'];
|
1429 |
$id = ($i === 'acfcloneindex') ? 'acfcloneindex' : "row-$i";
|
@@ -1436,18 +1674,37 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1436 |
'data-layout' => $layout['name']
|
1437 |
);
|
1438 |
|
1439 |
-
// clone
|
1440 |
if(!is_numeric($i)){
|
1441 |
|
1442 |
$div['class'] .= ' acf-clone';
|
1443 |
|
1444 |
}
|
1445 |
|
1446 |
-
|
1447 |
-
$div =
|
|
|
|
|
|
|
1448 |
|
1449 |
// handle
|
1450 |
-
$handle =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1451 |
|
1452 |
// title
|
1453 |
$title = $this->get_layout_title($field, $layout, $i, $value);
|
@@ -1465,7 +1722,7 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1465 |
<?php
|
1466 |
|
1467 |
// Title Edition
|
1468 |
-
$this->render_layout_title_edition($sub_fields, $value, $prefix);
|
1469 |
|
1470 |
// Icons
|
1471 |
$this->render_layout_icons($layout, $field);
|
@@ -1474,12 +1731,15 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1474 |
$this->render_layout_placeholder($value, $layout, $field, $i);
|
1475 |
|
1476 |
|
1477 |
-
add_filter('acf/prepare_field/type=wysiwyg', array($this, '
|
|
|
|
|
|
|
1478 |
|
1479 |
-
//
|
1480 |
-
$this->render_layout_fields($layout, $sub_fields, $value, $prefix);
|
1481 |
|
1482 |
-
remove_filter('acf/prepare_field/type=wysiwyg', array($this, '
|
1483 |
|
1484 |
?>
|
1485 |
|
@@ -1488,85 +1748,44 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1488 |
|
1489 |
}
|
1490 |
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
$div = apply_filters('acfe/flexible/layouts/div/key=' . $field['key'], $div, $layout, $field);
|
1496 |
-
$div = apply_filters('acfe/flexible/layouts/div/name=' . $field['_name'] . '&layout=' . $layout['name'], $div, $layout, $field);
|
1497 |
-
$div = apply_filters('acfe/flexible/layouts/div/key=' . $field['key'] . '&layout=' . $layout['name'], $div, $layout, $field);
|
1498 |
|
1499 |
-
|
|
|
1500 |
|
1501 |
-
|
1502 |
-
|
1503 |
-
function get_layout_handle($layout, $field){
|
1504 |
|
1505 |
-
$
|
1506 |
-
'class' => 'acf-fc-layout-handle',
|
1507 |
-
'title' => __('Drag to reorder','acf'),
|
1508 |
-
'data-name' => 'collapse-layout',
|
1509 |
-
);
|
1510 |
|
1511 |
-
|
1512 |
-
|
1513 |
-
unset($handle['data-name']);
|
1514 |
|
1515 |
-
|
1516 |
-
|
1517 |
-
$handle = apply_filters('acfe/flexible/layouts/handle', $handle, $layout, $field);
|
1518 |
-
$handle = apply_filters('acfe/flexible/layouts/handle/name=' . $field['_name'], $handle, $layout, $field);
|
1519 |
-
$handle = apply_filters('acfe/flexible/layouts/handle/key=' . $field['key'], $handle, $layout, $field);
|
1520 |
-
$handle = apply_filters('acfe/flexible/layouts/handle/name=' . $field['_name'] . '&layout=' . $layout['name'], $handle, $layout, $field);
|
1521 |
-
$handle = apply_filters('acfe/flexible/layouts/handle/key=' . $field['key'] . '&layout=' . $layout['name'], $handle, $layout, $field);
|
1522 |
-
|
1523 |
-
return $handle;
|
1524 |
-
|
1525 |
-
}
|
1526 |
-
|
1527 |
-
function render_layout_icons($layout, $field){
|
1528 |
-
|
1529 |
-
// icons
|
1530 |
-
$icons = array(
|
1531 |
-
'add' => '<a class="acf-icon -plus small light acf-js-tooltip" href="#" data-name="add-layout" title="' . __('Add layout','acf') . '"></a>',
|
1532 |
-
'remove' => '<a class="acf-icon -minus small light acf-js-tooltip" href="#" data-name="remove-layout" title="' . __('Remove layout','acf') . '"></a>',
|
1533 |
-
'collapse' => '<a class="acf-icon -collapse small acf-js-tooltip" href="#" data-name="collapse-layout" title="' . __('Click to toggle','acf') . '"></a>'
|
1534 |
-
);
|
1535 |
-
|
1536 |
-
$icons = apply_filters('acfe/flexible/layouts/icons', $icons, $layout, $field);
|
1537 |
-
$icons = apply_filters('acfe/flexible/layouts/icons/name=' . $field['_name'], $icons, $layout, $field);
|
1538 |
-
$icons = apply_filters('acfe/flexible/layouts/icons/key=' . $field['key'], $icons, $layout, $field);
|
1539 |
-
$icons = apply_filters('acfe/flexible/layouts/icons/name=' . $field['_name'] . '&layout=' . $layout['name'], $icons, $layout, $field);
|
1540 |
-
$icons = apply_filters('acfe/flexible/layouts/icons/key=' . $field['key'] . '&layout=' . $layout['name'], $icons, $layout, $field);
|
1541 |
-
|
1542 |
-
if(!empty($icons)){ ?>
|
1543 |
-
|
1544 |
-
<div class="acf-fc-layout-controls">
|
1545 |
|
1546 |
-
|
|
|
1547 |
|
1548 |
-
|
1549 |
-
|
1550 |
-
<?php } ?>
|
1551 |
|
1552 |
-
|
|
|
|
|
1553 |
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
function render_layout_title_edition(&$sub_fields, $value, $prefix){
|
1559 |
-
|
1560 |
-
if(!$this->title_edition || empty($sub_fields))
|
1561 |
-
return false;
|
1562 |
|
1563 |
-
if($
|
1564 |
return false;
|
1565 |
|
1566 |
// Extract
|
1567 |
-
$title = acf_extract_var($sub_fields,
|
1568 |
|
1569 |
-
// Reset
|
1570 |
$sub_fields = array_values($sub_fields);
|
1571 |
|
1572 |
// add value
|
@@ -1593,9 +1812,11 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1593 |
|
1594 |
$input_attrs = array();
|
1595 |
foreach( array( 'type', 'id', 'class', 'name', 'value', 'placeholder', 'maxlength', 'pattern', 'readonly', 'disabled', 'required', 'data-acfe-flexible-control-title-input' ) as $k ) {
|
|
|
1596 |
if( isset($title[ $k ]) ) {
|
1597 |
$input_attrs[ $k ] = $title[ $k ];
|
1598 |
}
|
|
|
1599 |
}
|
1600 |
|
1601 |
// render input
|
@@ -1603,9 +1824,46 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1603 |
|
1604 |
}
|
1605 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1606 |
function render_layout_placeholder($value, $layout, $field, $i){
|
1607 |
|
1608 |
-
if(!$
|
1609 |
return false;
|
1610 |
|
1611 |
$placeholder = array(
|
@@ -1613,7 +1871,7 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1613 |
'title' => __('Edit layout', 'acfe'),
|
1614 |
);
|
1615 |
|
1616 |
-
if(!$
|
1617 |
|
1618 |
$placeholder['class'] .= ' acf-hidden';
|
1619 |
|
@@ -1621,33 +1879,29 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1621 |
|
1622 |
$preview_html = false;
|
1623 |
|
1624 |
-
if($
|
1625 |
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
|
1640 |
-
|
1641 |
-
|
1642 |
-
$placeholder['class'] .= ' acfe-fc-preview';
|
1643 |
-
|
1644 |
-
}
|
1645 |
|
1646 |
}
|
1647 |
|
1648 |
}
|
1649 |
|
1650 |
-
if($
|
1651 |
|
1652 |
$placeholder['data-action'] = 'acfe-flexible-modal-edit';
|
1653 |
|
@@ -1673,59 +1927,102 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1673 |
|
1674 |
}
|
1675 |
|
1676 |
-
|
|
|
|
|
|
|
1677 |
|
1678 |
-
|
1679 |
-
|
1680 |
|
1681 |
if(empty($sub_fields))
|
1682 |
-
return;
|
1683 |
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
?>
|
1688 |
|
1689 |
-
|
1690 |
-
|
1691 |
-
<div class="acfe-modal-content">
|
1692 |
|
1693 |
-
|
|
|
1694 |
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1709 |
|
|
|
|
|
1710 |
|
1711 |
-
//
|
1712 |
-
$sub_field['
|
1713 |
|
|
|
1714 |
|
1715 |
-
//
|
1716 |
-
|
1717 |
|
1718 |
-
|
1719 |
|
1720 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1721 |
|
1722 |
</div>
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1729 |
|
1730 |
// el
|
1731 |
$el = 'div';
|
@@ -1736,7 +2033,7 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1736 |
|
1737 |
}
|
1738 |
|
1739 |
-
if($
|
1740 |
|
1741 |
<div class="acfe-modal -fields">
|
1742 |
<div class="acfe-modal-wrapper">
|
@@ -1823,7 +2120,7 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1823 |
|
1824 |
?>
|
1825 |
|
1826 |
-
<?php if(!$
|
1827 |
|
1828 |
<div class="acfe-flexible-opened-actions"><a href="javascript:void(0);" class="button"><?php _e('Close', 'acf'); ?></button></a></div>
|
1829 |
|
@@ -1837,7 +2134,7 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1837 |
</div>
|
1838 |
<?php endif; ?>
|
1839 |
|
1840 |
-
<?php if($
|
1841 |
|
1842 |
</div>
|
1843 |
</div>
|
@@ -1847,18 +2144,45 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1847 |
|
1848 |
}
|
1849 |
|
1850 |
-
|
|
|
|
|
|
|
1851 |
|
1852 |
-
|
|
|
|
|
|
|
|
|
|
|
1853 |
|
1854 |
-
return $
|
1855 |
|
1856 |
}
|
1857 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1858 |
function add_layout_icons($icons, $layout, $field){
|
1859 |
|
1860 |
// Settings
|
1861 |
-
if($
|
1862 |
|
1863 |
$new_icons = array(
|
1864 |
'settings' => '<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-admin-generic" href="#" title="Settings" data-acfe-flexible-settings="' . $layout['name'] . '"></a>'
|
@@ -1868,8 +2192,8 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1868 |
|
1869 |
}
|
1870 |
|
1871 |
-
// Copy
|
1872 |
-
if($
|
1873 |
|
1874 |
$new_icons = array(
|
1875 |
'copy' => '<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-category" href="#" title="Copy layout" data-acfe-flexible-control-copy="' . $layout['name'] . '"></a>'
|
@@ -1880,26 +2204,30 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1880 |
}
|
1881 |
|
1882 |
// Clone
|
1883 |
-
$
|
1884 |
-
'clone' => '<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-admin-page" href="#" title="Clone layout" data-acfe-flexible-control-clone="' . $layout['name'] . '"></a>'
|
1885 |
-
);
|
1886 |
-
|
1887 |
-
$icons = array_merge($new_icons, $icons);
|
1888 |
-
|
1889 |
-
// Remove Toggle
|
1890 |
-
if(($this->modal_edition || $this->remove_collapse) && isset($icons['collapse'])){
|
1891 |
|
1892 |
-
|
|
|
|
|
|
|
|
|
|
|
1893 |
|
1894 |
}
|
1895 |
|
1896 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1897 |
|
1898 |
// Add
|
1899 |
if(isset($icons['add'])) unset($icons['add']);
|
1900 |
|
1901 |
-
//
|
1902 |
-
if(isset($icons['
|
1903 |
|
1904 |
// Clone
|
1905 |
if(isset($icons['clone'])) unset($icons['clone']);
|
@@ -1909,33 +2237,81 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1909 |
|
1910 |
}
|
1911 |
|
1912 |
-
|
|
|
|
|
|
|
|
|
|
|
1913 |
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
|
|
|
|
|
|
1917 |
|
1918 |
-
//
|
1919 |
-
if($
|
1920 |
|
1921 |
-
$
|
1922 |
|
1923 |
}
|
1924 |
|
1925 |
-
return $
|
1926 |
|
1927 |
}
|
1928 |
|
1929 |
-
|
|
|
|
|
|
|
1930 |
|
1931 |
-
|
1932 |
-
|
1933 |
|
1934 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1935 |
|
1936 |
}
|
1937 |
|
1938 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1939 |
|
1940 |
}
|
1941 |
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
+
add_action('wp_ajax_acfe/flexible/layout_preview', 'acfe_flexible_layout_preview');
|
7 |
+
function acfe_flexible_layout_preview($args = array()){
|
|
|
|
|
|
|
8 |
|
9 |
+
$options = $args;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
if(empty($options)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
// Options
|
14 |
+
$options = acf_parse_args($_POST, array(
|
15 |
+
'post_id' => 0,
|
16 |
+
'i' => 0,
|
17 |
+
'field_key' => '',
|
18 |
+
'nonce' => '',
|
19 |
+
'layout' => '',
|
20 |
+
'value' => array()
|
21 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
// Load field
|
26 |
+
$field = acf_get_field($options['field_key']);
|
27 |
+
if(!$field)
|
28 |
+
die;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
// Get Flexible
|
31 |
+
$flexible = acf_get_field_type('flexible_content');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
// Vars
|
34 |
+
$layout = $flexible->get_layout($options['layout'], $field);
|
35 |
+
if(!$layout)
|
36 |
+
die;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
if(!acf_maybe_get($layout, 'acfe_flexible_thumbnail'))
|
39 |
+
$layout['acfe_flexible_thumbnail'] = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
+
// Flexible Thumbnails
|
42 |
+
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/thumbnail/name=' . $field['_name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
43 |
+
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/thumbnail/key=' . $field['key'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
// Layout Thumbnails
|
46 |
+
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/layout/thumbnail/layout=' . $layout['name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
47 |
+
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/layout/thumbnail/name=' . $field['_name'] . '&layout=' . $layout['name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
48 |
+
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/layout/thumbnail/key=' . $field['key'] . '&layout=' . $layout['name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
+
$meta = array($options['field_key'] => array(
|
51 |
+
wp_unslash($options['value'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
));
|
53 |
|
54 |
+
acf_setup_meta($meta, $options['field_key'] . '_' . $options['i'], true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
+
if(have_rows($options['field_key'])):
|
57 |
+
while(have_rows($options['field_key'])): the_row();
|
58 |
+
|
59 |
+
global $post;
|
60 |
+
$_post = $post;
|
61 |
+
|
62 |
+
// Flexible Preview
|
63 |
+
do_action('acfe/flexible/preview/name=' . $field['_name'], $field, $layout);
|
64 |
+
do_action('acfe/flexible/preview/key=' . $field['key'], $field, $layout);
|
65 |
+
|
66 |
+
// Flexible Layout Preview
|
67 |
+
do_action('acfe/flexible/layout/preview/layout=' . $layout['name'], $field, $layout);
|
68 |
+
do_action('acfe/flexible/layout/preview/name=' . $field['_name'] . '&layout=' . $layout['name'], $field, $layout);
|
69 |
+
do_action('acfe/flexible/layout/preview/key=' . $field['key'] . '&layout=' . $layout['name'], $field, $layout);
|
70 |
+
|
71 |
+
// ACFE: All Flexible Preview
|
72 |
+
do_action('acfe/flexible/preview', $field, $layout);
|
73 |
+
|
74 |
+
$post = $_post;
|
75 |
+
|
76 |
+
endwhile;
|
77 |
+
endif;
|
78 |
|
79 |
+
acf_reset_meta($options['field_key'] . '_' . $options['i']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
+
if(wp_doing_ajax()){
|
82 |
+
die;
|
83 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
+
}
|
86 |
+
|
87 |
+
add_action('acfe/flexible/preview', 'acfe_flexible_layout_preview_render', 99, 2);
|
88 |
+
function acfe_flexible_layout_preview_render($field, $layout){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
+
global $is_preview;
|
91 |
+
|
92 |
+
$is_preview = true;
|
93 |
+
|
94 |
+
acfe_flexible_render_layout_template($layout, $field);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
}
|
97 |
|
98 |
+
add_filter('acfe/flexible/render/template', 'acfe_flexible_layout_render_template_setting', 0, 4);
|
99 |
+
function acfe_flexible_layout_render_template_setting($return, $field, $layout, $is_preview){
|
100 |
|
101 |
+
if(acf_maybe_get($layout, 'acfe_flexible_render_template'))
|
102 |
+
$return = $layout['acfe_flexible_render_template'];
|
103 |
+
|
104 |
+
return $return;
|
105 |
|
106 |
+
}
|
107 |
+
|
108 |
+
add_filter('acfe/flexible/render/style', 'acfe_flexible_layout_render_style_setting', 0, 4);
|
109 |
+
function acfe_flexible_layout_render_style_setting($return, $field, $layout, $is_preview){
|
110 |
|
111 |
+
if(acf_maybe_get($layout, 'acfe_flexible_render_style'))
|
112 |
+
$return = $layout['acfe_flexible_render_style'];
|
|
|
|
|
|
|
113 |
|
114 |
+
return $return;
|
115 |
|
116 |
}
|
117 |
|
118 |
+
add_filter('acfe/flexible/render/script', 'acfe_flexible_layout_render_script_setting', 0, 4);
|
119 |
+
function acfe_flexible_layout_render_script_setting($return, $field, $layout, $is_preview){
|
120 |
|
121 |
+
if(acf_maybe_get($layout, 'acfe_flexible_render_script'))
|
122 |
+
$return = $layout['acfe_flexible_render_script'];
|
123 |
|
124 |
+
return $return;
|
125 |
+
|
126 |
+
}
|
|
|
127 |
|
128 |
+
if(!class_exists('acfe_field_flexible_content')):
|
|
|
129 |
|
130 |
+
class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
|
131 |
|
132 |
+
public $flexible = '';
|
|
|
|
|
|
|
|
|
133 |
|
134 |
+
function __construct(){
|
|
|
135 |
|
136 |
+
parent::initialize();
|
137 |
+
|
138 |
+
// Retrieve Flexible Content
|
139 |
+
$this->flexible = acf_get_field_type('flexible_content');
|
140 |
+
|
141 |
+
// Remove Inherit Actions
|
142 |
+
remove_action('acf/render_field/type=flexible_content', array($this->flexible, 'render_field'), 9);
|
143 |
+
|
144 |
+
// Field Action
|
145 |
+
$this->add_field_action('acf/render_field_settings', array($this, 'render_field_settings'), 0);
|
146 |
+
$this->add_action('acf/render_field', array($this, 'render_layouts_settings_label'), 0);
|
147 |
+
$this->add_action('acf/render_field', array($this, 'render_layouts_settings'), 10);
|
148 |
+
|
149 |
+
$this->add_field_filter('acf/validate_field', array($this, 'validate_field'));
|
150 |
+
$this->add_field_filter('acf/prepare_field', array($this, 'prepare_field'));
|
151 |
+
$this->add_field_filter('acfe/load_fields', array($this, 'load_fields'), 10, 2);
|
152 |
+
$this->add_field_filter('acfe/field_wrapper_attributes', array($this, 'wrapper_attributes'), 10, 2);
|
153 |
+
$this->add_field_action('acf/render_field', array($this, 'render_field'), 9);
|
154 |
+
|
155 |
+
// General Filters
|
156 |
+
$this->add_filter('acfe/flexible/layouts/icons', array($this, 'add_layout_icons'), 10, 3);
|
157 |
+
$this->add_filter('acfe/flexible/layouts/div', array($this, 'add_layout_div'), 10, 3);
|
158 |
+
$this->add_filter('acfe/flexible/layouts/handle', array($this, 'add_layout_handle'), 10, 3);
|
159 |
+
|
160 |
+
$this->add_filter('acf/fields/flexible_content/no_value_message', array($this, 'add_empty_message'), 10, 2);
|
161 |
+
$this->add_filter('acf/fields/flexible_content/layout_title', array($this, 'add_layout_title'), 0, 4);
|
162 |
+
|
163 |
+
// General Actions
|
164 |
+
$this->add_action('wp_ajax_acfe/flexible/models', array($this, 'ajax_layout_model'));
|
165 |
+
$this->add_action('wp_ajax_nopriv_acfe/flexible/models', array($this, 'ajax_layout_model'));
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Field Settings
|
171 |
+
*/
|
172 |
+
function render_field_settings($field){
|
173 |
+
|
174 |
+
|
175 |
+
// Advanced settings
|
176 |
+
acf_render_field_setting($field, array(
|
177 |
+
'label' => __('Advanced Flexible Content'),
|
178 |
+
'name' => 'acfe_flexible_advanced',
|
179 |
+
'key' => 'acfe_flexible_advanced',
|
180 |
+
'instructions' => __('Show advanced Flexible Content settings'),
|
181 |
+
'type' => 'true_false',
|
182 |
+
'message' => '',
|
183 |
+
'default_value' => false,
|
184 |
+
'ui' => true,
|
185 |
+
'ui_on_text' => '',
|
186 |
+
'ui_off_text' => '',
|
187 |
+
));
|
188 |
+
|
189 |
+
// Stylised button
|
190 |
+
acf_render_field_setting($field, array(
|
191 |
+
'label' => __('Stylised Button'),
|
192 |
+
'name' => 'acfe_flexible_stylised_button',
|
193 |
+
'key' => 'acfe_flexible_stylised_button',
|
194 |
+
'instructions' => __('Better actions buttons integration'),
|
195 |
+
'type' => 'true_false',
|
196 |
+
'message' => '',
|
197 |
+
'default_value' => false,
|
198 |
+
'ui' => true,
|
199 |
+
'ui_on_text' => '',
|
200 |
+
'ui_off_text' => '',
|
201 |
'conditional_logic' => array(
|
202 |
array(
|
203 |
array(
|
204 |
+
'field' => 'acfe_flexible_advanced',
|
205 |
'operator' => '==',
|
206 |
'value' => '1',
|
207 |
),
|
208 |
array(
|
209 |
+
'field' => 'acfe_flexible_remove_add_button',
|
210 |
+
'operator' => '!=',
|
211 |
'value' => '1',
|
212 |
+
),
|
213 |
)
|
214 |
)
|
215 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
|
217 |
+
// Hide Empty Message
|
218 |
+
acf_render_field_setting($field, array(
|
219 |
+
'label' => __('Hide Empty Message'),
|
220 |
+
'name' => 'acfe_flexible_hide_empty_message',
|
221 |
+
'key' => 'acfe_flexible_hide_empty_message',
|
222 |
+
'instructions' => __('Hide the empty message box'),
|
223 |
+
'type' => 'true_false',
|
224 |
+
'message' => '',
|
225 |
+
'default_value' => false,
|
226 |
+
'ui' => true,
|
227 |
+
'ui_on_text' => '',
|
228 |
+
'ui_off_text' => '',
|
229 |
'conditional_logic' => array(
|
230 |
array(
|
231 |
array(
|
232 |
+
'field' => 'acfe_flexible_advanced',
|
233 |
'operator' => '==',
|
234 |
'value' => '1',
|
235 |
+
),
|
236 |
+
array(
|
237 |
+
'field' => 'acfe_flexible_stylised_button',
|
238 |
+
'operator' => '!=',
|
239 |
+
'value' => '1',
|
240 |
+
),
|
241 |
)
|
242 |
)
|
243 |
+
));
|
|
|
|
|
|
|
|
|
244 |
|
245 |
+
// Empty Message
|
246 |
+
acf_render_field_setting($field, array(
|
247 |
+
'label' => __('Empty Message'),
|
248 |
+
'name' => 'acfe_flexible_empty_message',
|
249 |
+
'key' => 'acfe_flexible_empty_message',
|
250 |
+
'instructions' => __('Text displayed when the flexible field is empty'),
|
251 |
'type' => 'text',
|
252 |
+
'placeholder' => __('Click the "Add Row" button below to start creating your layout'),
|
|
|
|
|
|
|
|
|
|
|
253 |
'conditional_logic' => array(
|
254 |
array(
|
255 |
array(
|
256 |
+
'field' => 'acfe_flexible_advanced',
|
257 |
'operator' => '==',
|
258 |
'value' => '1',
|
259 |
+
),
|
260 |
+
array(
|
261 |
+
'field' => 'acfe_flexible_stylised_button',
|
262 |
+
'operator' => '!=',
|
263 |
+
'value' => '1',
|
264 |
+
),
|
265 |
+
array(
|
266 |
+
'field' => 'acfe_flexible_hide_empty_message',
|
267 |
+
'operator' => '!=',
|
268 |
+
'value' => '1',
|
269 |
)
|
270 |
)
|
271 |
)
|
272 |
+
));
|
|
|
|
|
273 |
|
274 |
+
// Disable Legacy Title Ajax
|
275 |
+
acf_render_field_setting($field, array(
|
276 |
+
'label' => __('Disable Legacy Layout Title Ajax'),
|
277 |
+
'name' => 'acfe_flexible_disable_ajax_title',
|
278 |
+
'key' => 'acfe_flexible_disable_ajax_title',
|
279 |
+
'instructions' => __('Disable the native ACF Layout Title Ajax call. More informations: <a href="https://www.advancedcustomfields.com/resources/acf-fields-flexible_content-layout_title/" target="_blank">ACF documentation</a>.'),
|
280 |
+
'type' => 'true_false',
|
281 |
+
'message' => '',
|
282 |
+
'default_value' => false,
|
283 |
+
'ui' => true,
|
284 |
+
'ui_on_text' => '',
|
285 |
+
'ui_off_text' => '',
|
286 |
'conditional_logic' => array(
|
287 |
array(
|
288 |
array(
|
289 |
+
'field' => 'acfe_flexible_advanced',
|
290 |
'operator' => '==',
|
291 |
'value' => '1',
|
292 |
+
),
|
293 |
)
|
294 |
)
|
295 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
|
297 |
+
// Layouts thumbnails
|
298 |
+
acf_render_field_setting($field, array(
|
299 |
+
'label' => __('Layouts: Thumbnails'),
|
300 |
+
'name' => 'acfe_flexible_layouts_thumbnails',
|
301 |
+
'key' => 'acfe_flexible_layouts_thumbnails',
|
302 |
+
'instructions' => __('Set a thumbnail for each layouts. You must save the field group to apply this setting'),
|
303 |
+
'type' => 'true_false',
|
304 |
+
'message' => '',
|
305 |
+
'default_value' => false,
|
306 |
+
'ui' => true,
|
307 |
+
'ui_on_text' => '',
|
308 |
+
'ui_off_text' => '',
|
309 |
'conditional_logic' => array(
|
310 |
array(
|
311 |
array(
|
312 |
+
'field' => 'acfe_flexible_advanced',
|
313 |
'operator' => '==',
|
314 |
'value' => '1',
|
315 |
+
),
|
316 |
)
|
317 |
)
|
318 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
|
320 |
+
// Layouts settings
|
321 |
+
acf_render_field_setting($field, array(
|
322 |
+
'label' => __('Layouts: Settings'),
|
323 |
+
'name' => 'acfe_flexible_layouts_settings',
|
324 |
+
'key' => 'acfe_flexible_layouts_settings',
|
325 |
+
'instructions' => __('Choose a field group to clone and to be used as a configuration modal'),
|
326 |
+
'type' => 'true_false',
|
327 |
+
'message' => '',
|
328 |
+
'default_value' => false,
|
329 |
+
'ui' => true,
|
330 |
+
'ui_on_text' => '',
|
331 |
+
'ui_off_text' => '',
|
332 |
+
'conditional_logic' => array(
|
333 |
+
array(
|
334 |
+
array(
|
335 |
+
'field' => 'acfe_flexible_advanced',
|
336 |
+
'operator' => '==',
|
337 |
+
'value' => '1',
|
338 |
+
),
|
339 |
+
)
|
340 |
+
)
|
341 |
+
));
|
342 |
|
343 |
+
// Layouts ajax
|
344 |
+
acf_render_field_setting($field, array(
|
345 |
+
'label' => __('Layouts: Asynchronous'),
|
346 |
+
'name' => 'acfe_flexible_layouts_ajax',
|
347 |
+
'key' => 'acfe_flexible_layouts_ajax',
|
348 |
+
'instructions' => __('Add layouts using Ajax method. This setting increase performance on complex Flexible Content'),
|
349 |
+
'type' => 'true_false',
|
350 |
+
'message' => '',
|
351 |
+
'default_value' => false,
|
352 |
+
'ui' => true,
|
353 |
+
'ui_on_text' => '',
|
354 |
+
'ui_off_text' => '',
|
355 |
+
'conditional_logic' => array(
|
356 |
+
array(
|
357 |
+
array(
|
358 |
+
'field' => 'acfe_flexible_advanced',
|
359 |
+
'operator' => '==',
|
360 |
+
'value' => '1',
|
361 |
+
),
|
362 |
+
)
|
363 |
+
)
|
364 |
+
));
|
365 |
|
366 |
+
// Layouts: Render
|
367 |
+
acf_render_field_setting($field, array(
|
368 |
+
'label' => __('Layouts: Render'),
|
369 |
+
'name' => 'acfe_flexible_layouts_templates',
|
370 |
+
'key' => 'acfe_flexible_layouts_templates',
|
371 |
+
'instructions' => __('Set template, style & javascript files for each layouts. This setting is mandatory in order to use <code style="font-size:11px;">get_flexible()</code> function. You must save the field group to apply this setting'),
|
372 |
+
'type' => 'true_false',
|
373 |
+
'message' => '',
|
374 |
+
'default_value' => false,
|
375 |
+
'ui' => true,
|
376 |
+
'ui_on_text' => '',
|
377 |
+
'ui_off_text' => '',
|
378 |
+
'conditional_logic' => array(
|
379 |
+
array(
|
380 |
+
array(
|
381 |
+
'field' => 'acfe_flexible_advanced',
|
382 |
+
'operator' => '==',
|
383 |
+
'value' => '1',
|
384 |
+
),
|
385 |
+
)
|
386 |
+
)
|
387 |
+
));
|
388 |
|
389 |
+
// Layouts: Preview
|
390 |
+
acf_render_field_setting($field, array(
|
391 |
+
'label' => __('Layouts: Dynamic Preview'),
|
392 |
+
'name' => 'acfe_flexible_layouts_previews',
|
393 |
+
'key' => 'acfe_flexible_layouts_previews',
|
394 |
+
'instructions' => __('Use layouts render settings to display a dynamic preview in the post administration'),
|
395 |
+
'type' => 'true_false',
|
396 |
+
'message' => '',
|
397 |
+
'default_value' => false,
|
398 |
+
'ui' => true,
|
399 |
+
'ui_on_text' => '',
|
400 |
+
'ui_off_text' => '',
|
401 |
+
'conditional_logic' => array(
|
402 |
+
array(
|
403 |
+
array(
|
404 |
+
'field' => 'acfe_flexible_advanced',
|
405 |
+
'operator' => '==',
|
406 |
+
'value' => '1',
|
407 |
+
),
|
408 |
+
array(
|
409 |
+
'field' => 'acfe_flexible_layouts_templates',
|
410 |
+
'operator' => '==',
|
411 |
+
'value' => '1',
|
412 |
+
),
|
413 |
+
array(
|
414 |
+
'field' => 'acfe_flexible_layouts_remove_collapse',
|
415 |
+
'operator' => '!=',
|
416 |
+
'value' => '1',
|
417 |
+
),
|
418 |
+
)
|
419 |
+
)
|
420 |
+
));
|
421 |
|
422 |
+
// Layouts: Placholder
|
423 |
+
acf_render_field_setting($field, array(
|
424 |
+
'label' => __('Layouts: Placeholder'),
|
425 |
+
'name' => 'acfe_flexible_layouts_placeholder',
|
426 |
+
'key' => 'acfe_flexible_layouts_placeholder',
|
427 |
+
'instructions' => __('Display a placeholder with a pencil icon, making edition easier'),
|
428 |
+
'type' => 'true_false',
|
429 |
+
'message' => '',
|
430 |
+
'default_value' => false,
|
431 |
+
'ui' => true,
|
432 |
+
'ui_on_text' => '',
|
433 |
+
'ui_off_text' => '',
|
434 |
+
'conditional_logic' => array(
|
435 |
+
array(
|
436 |
+
array(
|
437 |
+
'field' => 'acfe_flexible_advanced',
|
438 |
+
'operator' => '==',
|
439 |
+
'value' => '1',
|
440 |
+
),
|
441 |
+
array(
|
442 |
+
'field' => 'acfe_flexible_layouts_previews',
|
443 |
+
'operator' => '==',
|
444 |
+
'value' => '',
|
445 |
+
),
|
446 |
+
array(
|
447 |
+
'field' => 'acfe_flexible_layouts_remove_collapse',
|
448 |
+
'operator' => '!=',
|
449 |
+
'value' => '1',
|
450 |
+
),
|
451 |
+
)
|
452 |
+
)
|
453 |
+
));
|
454 |
|
455 |
+
// Layouts: Title Edition
|
456 |
+
acf_render_field_setting($field, array(
|
457 |
+
'label' => __('Layouts: Title Edition'),
|
458 |
+
'name' => 'acfe_flexible_title_edition',
|
459 |
+
'key' => 'acfe_flexible_title_edition',
|
460 |
+
'instructions' => __('Allow layout title edition'),
|
461 |
+
'type' => 'true_false',
|
462 |
+
'message' => '',
|
463 |
+
'default_value' => false,
|
464 |
+
'ui' => true,
|
465 |
+
'ui_on_text' => '',
|
466 |
+
'ui_off_text' => '',
|
467 |
+
'conditional_logic' => array(
|
468 |
+
array(
|
469 |
+
array(
|
470 |
+
'field' => 'acfe_flexible_advanced',
|
471 |
+
'operator' => '==',
|
472 |
+
'value' => '1',
|
473 |
+
),
|
474 |
+
)
|
475 |
+
)
|
476 |
+
));
|
477 |
|
478 |
+
// Layouts: Clone
|
479 |
+
acf_render_field_setting($field, array(
|
480 |
+
'label' => __('Layouts: Clone'),
|
481 |
+
'name' => 'acfe_flexible_clone',
|
482 |
+
'key' => 'acfe_flexible_clone',
|
483 |
+
'instructions' => __('Allow clone layouts function'),
|
484 |
+
'type' => 'true_false',
|
485 |
+
'message' => '',
|
486 |
+
'default_value' => false,
|
487 |
+
'ui' => true,
|
488 |
+
'ui_on_text' => '',
|
489 |
+
'ui_off_text' => '',
|
490 |
+
'conditional_logic' => array(
|
491 |
+
array(
|
492 |
+
array(
|
493 |
+
'field' => 'acfe_flexible_advanced',
|
494 |
+
'operator' => '==',
|
495 |
+
'value' => '1',
|
496 |
+
),
|
497 |
+
)
|
498 |
+
)
|
499 |
+
));
|
500 |
|
501 |
+
// Layouts: Copy/Paste
|
502 |
+
acf_render_field_setting($field, array(
|
503 |
+
'label' => __('Layouts: Copy/Paste'),
|
504 |
+
'name' => 'acfe_flexible_copy_paste',
|
505 |
+
'key' => 'acfe_flexible_copy_paste',
|
506 |
+
'instructions' => __('Allow copy/paste layouts functions'),
|
507 |
+
'type' => 'true_false',
|
508 |
+
'message' => '',
|
509 |
+
'default_value' => false,
|
510 |
+
'ui' => true,
|
511 |
+
'ui_on_text' => '',
|
512 |
+
'ui_off_text' => '',
|
513 |
+
'conditional_logic' => array(
|
514 |
+
array(
|
515 |
+
array(
|
516 |
+
'field' => 'acfe_flexible_advanced',
|
517 |
+
'operator' => '==',
|
518 |
+
'value' => '1',
|
519 |
+
),
|
520 |
+
)
|
521 |
+
)
|
522 |
+
));
|
523 |
|
524 |
+
// Layouts: Close Button
|
525 |
+
acf_render_field_setting($field, array(
|
526 |
+
'label' => __('Layouts: Close Button'),
|
527 |
+
'name' => 'acfe_flexible_close_button',
|
528 |
+
'key' => 'acfe_flexible_close_button',
|
529 |
+
'instructions' => __('Display a close button to collapse the layout'),
|
530 |
+
'type' => 'true_false',
|
531 |
+
'message' => '',
|
532 |
+
'default_value' => false,
|
533 |
+
'ui' => true,
|
534 |
+
'ui_on_text' => '',
|
535 |
+
'ui_off_text' => '',
|
536 |
+
'conditional_logic' => array(
|
537 |
+
array(
|
538 |
+
array(
|
539 |
+
'field' => 'acfe_flexible_advanced',
|
540 |
+
'operator' => '==',
|
541 |
+
'value' => '1',
|
542 |
+
),
|
543 |
+
array(
|
544 |
+
'field' => 'acfe_flexible_layouts_remove_collapse',
|
545 |
+
'operator' => '!=',
|
546 |
+
'value' => '1',
|
547 |
+
),
|
548 |
+
)
|
549 |
+
)
|
550 |
+
));
|
551 |
|
552 |
+
// Remove: Add Button
|
553 |
+
acf_render_field_setting($field, array(
|
554 |
+
'label' => __('Hide: Add layout button'),
|
555 |
+
'name' => 'acfe_flexible_remove_add_button',
|
556 |
+
'key' => 'acfe_flexible_remove_add_button',
|
557 |
+
'instructions' => __('Hide all "Add layout" buttons'),
|
558 |
+
'type' => 'true_false',
|
559 |
+
'message' => '',
|
560 |
+
'default_value' => false,
|
561 |
+
'ui' => true,
|
562 |
+
'ui_on_text' => '',
|
563 |
+
'ui_off_text' => '',
|
564 |
+
'conditional_logic' => array(
|
565 |
+
array(
|
566 |
+
array(
|
567 |
+
'field' => 'acfe_flexible_advanced',
|
568 |
+
'operator' => '==',
|
569 |
+
'value' => '1',
|
570 |
+
),
|
571 |
+
)
|
572 |
+
)
|
573 |
+
));
|
574 |
|
575 |
+
// Remove: Delete Button
|
576 |
+
acf_render_field_setting($field, array(
|
577 |
+
'label' => __('Hide: Delete layout button'),
|
578 |
+
'name' => 'acfe_flexible_remove_delete_button',
|
579 |
+
'key' => 'acfe_flexible_remove_delete_button',
|
580 |
+
'instructions' => __('Hide the "Delete layout" button'),
|
581 |
+
'type' => 'true_false',
|
582 |
+
'message' => '',
|
583 |
+
'default_value' => false,
|
584 |
+
'ui' => true,
|
585 |
+
'ui_on_text' => '',
|
586 |
+
'ui_off_text' => '',
|
587 |
+
'conditional_logic' => array(
|
588 |
+
array(
|
589 |
+
array(
|
590 |
+
'field' => 'acfe_flexible_advanced',
|
591 |
+
'operator' => '==',
|
592 |
+
'value' => '1',
|
593 |
+
),
|
594 |
+
)
|
595 |
+
)
|
596 |
+
));
|
597 |
|
598 |
+
// Lock
|
599 |
+
acf_render_field_setting($field, array(
|
600 |
+
'label' => __('Lock Flexible Content'),
|
601 |
+
'name' => 'acfe_flexible_lock',
|
602 |
+
'key' => 'acfe_flexible_lock',
|
603 |
+
'instructions' => __('Disable the drag & drop function and lock the flexible content'),
|
604 |
+
'type' => 'true_false',
|
605 |
+
'message' => '',
|
606 |
+
'default_value' => false,
|
607 |
+
'ui' => true,
|
608 |
+
'ui_on_text' => '',
|
609 |
+
'ui_off_text' => '',
|
610 |
+
'conditional_logic' => array(
|
611 |
+
array(
|
612 |
+
array(
|
613 |
+
'field' => 'acfe_flexible_advanced',
|
614 |
+
'operator' => '==',
|
615 |
+
'value' => '1',
|
616 |
+
),
|
617 |
+
)
|
618 |
+
)
|
619 |
+
));
|
620 |
|
621 |
+
// Modal: Edition
|
622 |
+
acf_render_field_setting($field, array(
|
623 |
+
'label' => __('Layouts Modal: Edition'),
|
624 |
+
'name' => 'acfe_flexible_modal_edition',
|
625 |
+
'key' => 'acfe_flexible_modal_edition',
|
626 |
+
'instructions' => __('Edit layout content in a modal'),
|
627 |
+
'type' => 'true_false',
|
628 |
+
'message' => '',
|
629 |
+
'default_value' => false,
|
630 |
+
'ui' => true,
|
631 |
+
'ui_on_text' => '',
|
632 |
+
'ui_off_text' => '',
|
633 |
+
'conditional_logic' => array(
|
634 |
+
array(
|
635 |
+
array(
|
636 |
+
'field' => 'acfe_flexible_advanced',
|
637 |
+
'operator' => '==',
|
638 |
+
'value' => '1',
|
639 |
+
),
|
640 |
+
)
|
641 |
+
)
|
642 |
+
));
|
643 |
|
644 |
+
// Modal: Selection
|
645 |
+
acf_render_field_setting($field, array(
|
646 |
+
'label' => __('Layouts Modal: Selection'),
|
647 |
+
'name' => 'acfe_flexible_modal',
|
648 |
+
'key' => 'acfe_flexible_modal',
|
649 |
+
'instructions' => __('Select layouts in a modal'),
|
650 |
+
'type' => 'group',
|
651 |
+
'layout' => 'block',
|
652 |
+
'sub_fields' => array(
|
653 |
+
array(
|
654 |
+
'label' => '',
|
655 |
+
'name' => 'acfe_flexible_modal_enabled',
|
656 |
+
'key' => 'acfe_flexible_modal_enabled',
|
657 |
+
'type' => 'true_false',
|
658 |
+
'instructions' => '',
|
659 |
+
'required' => false,
|
660 |
+
'wrapper' => array(
|
661 |
+
'width' => '10',
|
662 |
+
'class' => 'acfe_width_auto',
|
663 |
+
'id' => '',
|
664 |
+
),
|
665 |
+
'message' => '',
|
666 |
+
'default_value' => false,
|
667 |
+
'ui' => true,
|
668 |
+
'ui_on_text' => '',
|
669 |
+
'ui_off_text' => '',
|
670 |
+
'conditional_logic' => false,
|
671 |
+
),
|
672 |
+
array(
|
673 |
+
'label' => '',
|
674 |
+
'name' => 'acfe_flexible_modal_title',
|
675 |
+
'key' => 'acfe_flexible_modal_title',
|
676 |
+
'type' => 'text',
|
677 |
+
'prepend' => __('Modal Title'),
|
678 |
+
'placeholder' => 'Add Row',
|
679 |
+
'instructions' => false,
|
680 |
+
'required' => false,
|
681 |
+
'wrapper' => array(
|
682 |
+
'width' => '35',
|
683 |
+
'class' => '',
|
684 |
+
'id' => '',
|
685 |
+
),
|
686 |
+
'conditional_logic' => array(
|
687 |
+
array(
|
688 |
+
array(
|
689 |
+
'field' => 'acfe_flexible_modal_enabled',
|
690 |
+
'operator' => '==',
|
691 |
+
'value' => '1',
|
692 |
+
)
|
693 |
+
)
|
694 |
+
)
|
695 |
+
),
|
696 |
+
array(
|
697 |
+
'label' => '',
|
698 |
+
'name' => 'acfe_flexible_modal_col',
|
699 |
+
'key' => 'acfe_flexible_modal_col',
|
700 |
+
'type' => 'select',
|
701 |
+
'prepend' => '',
|
702 |
+
'instructions' => false,
|
703 |
+
'required' => false,
|
704 |
+
'choices' => array(
|
705 |
+
'1' => '1 column',
|
706 |
+
'2' => '2 columns',
|
707 |
+
'3' => '3 columns',
|
708 |
+
'4' => '4 columns',
|
709 |
+
'5' => '5 columns',
|
710 |
+
'6' => '6 columns',
|
711 |
+
),
|
712 |
+
'default_value' => '4',
|
713 |
+
'wrapper' => array(
|
714 |
+
'width' => '15',
|
715 |
+
'class' => '',
|
716 |
+
'id' => '',
|
717 |
+
),
|
718 |
+
'conditional_logic' => array(
|
719 |
+
array(
|
720 |
+
array(
|
721 |
+
'field' => 'acfe_flexible_modal_enabled',
|
722 |
+
'operator' => '==',
|
723 |
+
'value' => '1',
|
724 |
+
)
|
725 |
+
)
|
726 |
+
)
|
727 |
+
),
|
728 |
+
array(
|
729 |
+
'label' => '',
|
730 |
+
'name' => 'acfe_flexible_modal_categories',
|
731 |
+
'key' => 'acfe_flexible_modal_categories',
|
732 |
+
'type' => 'true_false',
|
733 |
+
'message' => __('Categories'),
|
734 |
+
'instructions' => false,
|
735 |
+
'required' => false,
|
736 |
+
'wrapper' => array(
|
737 |
+
'width' => '25',
|
738 |
+
'class' => '',
|
739 |
+
'id' => '',
|
740 |
+
),
|
741 |
+
'conditional_logic' => array(
|
742 |
+
array(
|
743 |
+
array(
|
744 |
+
'field' => 'acfe_flexible_modal_enabled',
|
745 |
+
'operator' => '==',
|
746 |
+
'value' => '1',
|
747 |
+
)
|
748 |
+
)
|
749 |
+
)
|
750 |
+
),
|
751 |
+
),
|
752 |
+
'conditional_logic' => array(
|
753 |
+
array(
|
754 |
+
array(
|
755 |
+
'field' => 'acfe_flexible_advanced',
|
756 |
+
'operator' => '==',
|
757 |
+
'value' => '1',
|
758 |
+
),
|
759 |
+
)
|
760 |
+
)
|
761 |
+
));
|
762 |
|
763 |
+
// Layouts: Force State
|
764 |
+
acf_render_field_setting($field, array(
|
765 |
+
'label' => __('Layouts: Force State'),
|
766 |
+
'name' => 'acfe_flexible_layouts_state',
|
767 |
+
'key' => 'acfe_flexible_layouts_state',
|
768 |
+
'instructions' => __('Force layouts to be collapsed or opened'),
|
769 |
+
'type' => 'select',
|
770 |
+
'placeholder' => __('Default', 'acfe'),
|
771 |
+
'allow_null' => true,
|
772 |
+
'choices' => array(
|
773 |
+
'collapse' => 'Collapsed',
|
774 |
+
'open' => 'Opened',
|
775 |
+
),
|
776 |
+
'conditional_logic' => array(
|
777 |
+
array(
|
778 |
+
array(
|
779 |
+
'field' => 'acfe_flexible_advanced',
|
780 |
+
'operator' => '==',
|
781 |
+
'value' => '1',
|
782 |
+
),
|
783 |
+
array(
|
784 |
+
'field' => 'acfe_flexible_modal_edition',
|
785 |
+
'operator' => '!=',
|
786 |
+
'value' => '1',
|
787 |
+
)
|
788 |
+
)
|
789 |
+
)
|
790 |
+
));
|
791 |
|
792 |
+
// Layouts: Remove Collapse
|
793 |
+
acf_render_field_setting($field, array(
|
794 |
+
'label' => __('Layouts: Remove Collapse'),
|
795 |
+
'name' => 'acfe_flexible_layouts_remove_collapse',
|
796 |
+
'key' => 'acfe_flexible_layouts_remove_collapse',
|
797 |
+
'instructions' => __('Remove collapse action'),
|
798 |
+
'type' => 'true_false',
|
799 |
+
'message' => '',
|
800 |
+
'default_value' => false,
|
801 |
+
'ui' => true,
|
802 |
+
'ui_on_text' => '',
|
803 |
+
'ui_off_text' => '',
|
804 |
+
'conditional_logic' => array(
|
805 |
+
array(
|
806 |
+
array(
|
807 |
+
'field' => 'acfe_flexible_advanced',
|
808 |
+
'operator' => '==',
|
809 |
+
'value' => '1',
|
810 |
+
),
|
811 |
+
array(
|
812 |
+
'field' => 'acfe_flexible_modal_edition',
|
813 |
+
'operator' => '!=',
|
814 |
+
'value' => '1',
|
815 |
+
),
|
816 |
+
array(
|
817 |
+
'field' => 'acfe_flexible_layouts_state',
|
818 |
+
'operator' => '==',
|
819 |
+
'value' => 'open',
|
820 |
+
)
|
821 |
+
)
|
822 |
+
)
|
823 |
+
));
|
824 |
|
|
|
|
|
|
|
|
|
825 |
}
|
826 |
|
827 |
+
/**
|
828 |
+
* Layout Settings Label
|
829 |
+
*/
|
830 |
+
function render_layouts_settings_label($field){
|
831 |
|
832 |
+
if($field['_name'] !== 'label' || stripos($field['name'], '[layouts]') === false)
|
833 |
+
return;
|
|
|
|
|
834 |
|
835 |
+
echo '</li>';
|
836 |
|
837 |
+
acf_render_field_wrap(array(
|
838 |
+
'label' => __('Settings'),
|
839 |
+
'type' => 'hidden',
|
840 |
+
'name' => 'acfe_flexible_settings_label'
|
841 |
+
), 'ul');
|
842 |
|
843 |
+
echo '<li>';
|
844 |
|
845 |
}
|
846 |
|
847 |
+
/**
|
848 |
+
* Layout Settings
|
849 |
+
*/
|
850 |
+
function render_layouts_settings($field){
|
851 |
|
852 |
+
if($field['_name'] !== 'max' || stripos($field['name'], '[layouts]') === false)
|
853 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
854 |
|
855 |
+
// Prefix
|
856 |
+
$prefix = $field['prefix'];
|
|
|
|
|
857 |
|
858 |
+
// Black magic
|
859 |
+
parse_str($prefix, $output);
|
860 |
+
$keys = acfe_array_keys_r($output);
|
861 |
|
862 |
+
// ...
|
863 |
+
$_field_id = $keys[1];
|
864 |
+
$_layout_key = $keys[3];
|
|
|
|
|
|
|
|
|
|
|
|
|
865 |
|
866 |
+
// Profit!
|
867 |
+
$flexible = acf_get_field($_field_id);
|
868 |
+
$layout = $flexible['layouts'][$_layout_key];
|
869 |
|
870 |
+
// Category
|
871 |
+
if($flexible['acfe_flexible_modal'] && acf_maybe_get($flexible['acfe_flexible_modal'], 'acfe_flexible_modal_categories')){
|
872 |
+
|
873 |
+
acf_render_field_wrap(array(
|
874 |
+
'prepend' => __('Category'),
|
875 |
+
'name' => 'acfe_flexible_category',
|
876 |
+
'type' => 'text',
|
877 |
+
'class' => 'acf-fc-meta-name',
|
878 |
+
'prefix' => $prefix,
|
879 |
+
'value' => $layout['acfe_flexible_category'],
|
880 |
+
'placeholder' => __('Multiple categories can be set using "|"')
|
881 |
+
), 'ul');
|
882 |
|
883 |
+
}
|
884 |
|
885 |
+
// Template
|
886 |
+
if($flexible['acfe_flexible_layouts_templates']){
|
887 |
+
|
888 |
+
acf_render_field_wrap(array(
|
889 |
+
'label' => __('Render'),
|
890 |
+
'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
|
891 |
+
'name' => 'acfe_flexible_render_template',
|
892 |
+
'type' => 'text',
|
893 |
+
'class' => 'acf-fc-meta-name',
|
894 |
+
'prefix' => $prefix,
|
895 |
+
'value' => $layout['acfe_flexible_render_template'],
|
896 |
+
'placeholder' => 'template.php',
|
897 |
+
), 'ul');
|
898 |
+
|
899 |
+
acf_render_field_wrap(array(
|
900 |
+
'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
|
901 |
+
'name' => 'acfe_flexible_render_style',
|
902 |
+
'type' => 'text',
|
903 |
+
'class' => 'acf-fc-meta-name',
|
904 |
+
'prefix' => $prefix,
|
905 |
+
'value' => $layout['acfe_flexible_render_style'],
|
906 |
+
'placeholder' => 'style.css',
|
907 |
+
), 'ul');
|
908 |
+
|
909 |
+
acf_render_field_wrap(array(
|
910 |
+
'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
|
911 |
+
'name' => 'acfe_flexible_render_script',
|
912 |
+
'type' => 'text',
|
913 |
+
'class' => 'acf-fc-meta-name',
|
914 |
+
'prefix' => $prefix,
|
915 |
+
'value' => $layout['acfe_flexible_render_script'],
|
916 |
+
'placeholder' => 'script.js',
|
917 |
+
), 'ul');
|
918 |
|
919 |
+
}
|
920 |
|
921 |
+
// Thumbnail
|
922 |
+
if($flexible['acfe_flexible_layouts_thumbnails']){
|
923 |
+
|
924 |
+
acf_render_field_wrap(array(
|
925 |
+
'label' => __('Thumbnail'),
|
926 |
+
'name' => 'acfe_flexible_thumbnail',
|
927 |
+
'type' => 'image',
|
928 |
+
'class' => '',
|
929 |
+
'prefix' => $prefix,
|
930 |
+
'value' => $layout['acfe_flexible_thumbnail'],
|
931 |
+
'return_format' => 'array',
|
932 |
+
'preview_size' => 'thumbnail',
|
933 |
+
'library' => 'all',
|
934 |
+
), 'ul');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
935 |
|
936 |
+
}
|
|
|
|
|
937 |
|
938 |
+
// Settings
|
939 |
+
if($flexible['acfe_flexible_layouts_settings']){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
940 |
|
941 |
+
acf_disable_filters();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
942 |
|
943 |
+
$choices = array();
|
944 |
|
945 |
+
$field_groups = acf_get_field_groups();
|
946 |
+
if(!empty($field_groups)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
947 |
|
948 |
+
foreach($field_groups as $field_group){
|
|
|
949 |
|
950 |
+
$choices[$field_group['key']] = $field_group['title'];
|
|
|
951 |
|
952 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
953 |
|
954 |
}
|
955 |
|
956 |
+
acf_enable_filters();
|
957 |
|
958 |
+
echo '</li>';
|
|
|
|
|
|
|
959 |
|
960 |
+
acf_render_field_wrap(array(
|
961 |
+
'label' => __('Settings modal'),
|
962 |
+
'type' => 'hidden',
|
963 |
+
'name' => 'acfe_flexible_settings_label'
|
964 |
+
), 'ul');
|
965 |
|
966 |
+
echo '<li>';
|
|
|
|
|
|
|
|
|
967 |
|
968 |
+
acf_render_field_wrap(array(
|
969 |
+
'label' => '',
|
970 |
+
'name' => 'acfe_flexible_settings',
|
971 |
+
'type' => 'select',
|
972 |
+
'class' => '',
|
973 |
+
'prefix' => $prefix,
|
974 |
+
'value' => $layout['acfe_flexible_settings'],
|
975 |
+
'choices' => $choices,
|
976 |
+
'wrapper' => array(
|
977 |
+
'width' => '33'
|
978 |
+
),
|
979 |
+
'allow_null' => 1,
|
980 |
+
'multiple' => 1,
|
981 |
+
'ui' => 1,
|
982 |
+
'ajax' => 0,
|
983 |
+
'return_format' => 0,
|
984 |
+
), 'ul');
|
985 |
+
|
986 |
+
acf_render_field_wrap(array(
|
987 |
+
'label' => '',
|
988 |
+
'name' => 'acfe_flexible_settings_size',
|
989 |
+
'type' => 'select',
|
990 |
+
'class' => '',
|
991 |
+
'prefix' => $prefix,
|
992 |
+
'value' => $layout['acfe_flexible_settings_size'],
|
993 |
+
'choices' => array(
|
994 |
+
'small' => 'Small',
|
995 |
+
'medium' => 'Medium',
|
996 |
+
'large' => 'Large',
|
997 |
+
'xlarge' => 'Extra Large',
|
998 |
+
'full' => 'Full',
|
999 |
+
),
|
1000 |
+
'wrapper' => array(
|
1001 |
+
'width' => '33'
|
1002 |
+
),
|
1003 |
+
'default_value' => 'medium',
|
1004 |
+
'allow_null' => 0,
|
1005 |
+
'multiple' => 0,
|
1006 |
+
'ui' => 0,
|
1007 |
+
'ajax' => 0,
|
1008 |
+
'return_format' => 0,
|
1009 |
+
), 'ul');
|
1010 |
|
1011 |
}
|
1012 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1013 |
}
|
1014 |
|
1015 |
+
/**
|
1016 |
+
* Ajax Layout Model
|
1017 |
+
*/
|
1018 |
+
function ajax_layout_model(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1019 |
|
1020 |
+
// options
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1021 |
$options = acf_parse_args($_POST, array(
|
1022 |
+
'field_key' => '',
|
1023 |
+
'layout' => '',
|
|
|
|
|
|
|
|
|
1024 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1025 |
|
1026 |
+
$field = acf_get_field($options['field_key']);
|
1027 |
+
if(!$field)
|
1028 |
+
die;
|
1029 |
+
|
1030 |
+
$field = acf_prepare_field($field);
|
1031 |
+
|
1032 |
+
foreach($field['layouts'] as $k => $layout){
|
1033 |
+
|
1034 |
+
if($layout['name'] !== $options['layout'])
|
1035 |
+
continue;
|
1036 |
+
|
1037 |
+
$this->render_layout($field, $layout, 'acfcloneindex', array());
|
1038 |
+
|
1039 |
+
die;
|
1040 |
+
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
die;
|
1044 |
+
|
1045 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1046 |
|
1047 |
+
/**
|
1048 |
+
* Validate Field
|
1049 |
+
*/
|
1050 |
+
function validate_field($field){
|
1051 |
+
|
1052 |
+
$defaults = array(
|
1053 |
+
'acfe_flexible_advanced' => 0,
|
1054 |
+
'acfe_flexible_stylised_button' => 0,
|
1055 |
+
'acfe_flexible_hide_empty_message' => 0,
|
1056 |
+
'acfe_flexible_empty_message' => '',
|
1057 |
+
'acfe_flexible_disable_ajax_title' => 0,
|
1058 |
+
|
1059 |
+
'acfe_flexible_layouts_thumbnails' => 0,
|
1060 |
+
'acfe_flexible_layouts_settings' => 0,
|
1061 |
+
'acfe_flexible_layouts_ajax' => 0,
|
1062 |
+
|
1063 |
+
'acfe_flexible_layouts_templates' => 0,
|
1064 |
+
'acfe_flexible_layouts_previews' => 0,
|
1065 |
+
'acfe_flexible_layouts_placeholder' => 0,
|
1066 |
+
|
1067 |
+
'acfe_flexible_title_edition' => 0,
|
1068 |
+
'acfe_flexible_clone' => 0,
|
1069 |
+
'acfe_flexible_copy_paste' => 0,
|
1070 |
+
'acfe_flexible_close_button' => 0,
|
1071 |
+
'acfe_flexible_remove_add_button' => 0,
|
1072 |
+
'acfe_flexible_remove_delete_button' => 0,
|
1073 |
+
'acfe_flexible_lock' => 0,
|
1074 |
+
|
1075 |
+
'acfe_flexible_modal_edition' => 0,
|
1076 |
+
'acfe_flexible_modal' => array(),
|
1077 |
|
1078 |
+
'acfe_flexible_layouts_state' => '',
|
1079 |
+
'acfe_flexible_layouts_remove_collapse' => 0,
|
1080 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1081 |
|
1082 |
+
$defaults['acfe_flexible_modal'] = wp_parse_args($defaults['acfe_flexible_modal'], array(
|
1083 |
+
'acfe_flexible_modal_enabled' => false,
|
1084 |
+
'acfe_flexible_modal_title' => false,
|
1085 |
+
'acfe_flexible_modal_col' => '4',
|
1086 |
+
'acfe_flexible_modal_categories'=> false,
|
1087 |
+
));
|
1088 |
|
1089 |
+
$field = wp_parse_args($field, $defaults);
|
|
|
1090 |
|
1091 |
+
foreach($field['layouts'] as &$layout){
|
1092 |
+
|
1093 |
+
$layout = wp_parse_args($layout, array(
|
1094 |
+
'acfe_flexible_thumbnail' => false,
|
1095 |
+
'acfe_flexible_category' => false,
|
1096 |
+
'acfe_flexible_render_template' => false,
|
1097 |
+
'acfe_flexible_render_style' => false,
|
1098 |
+
'acfe_flexible_render_script' => false,
|
1099 |
+
'acfe_flexible_settings' => false,
|
1100 |
+
'acfe_flexible_settings_size' => 'medium',
|
1101 |
+
));
|
1102 |
+
|
1103 |
+
}
|
1104 |
|
1105 |
+
if(!$field['acfe_flexible_advanced']){
|
1106 |
+
|
1107 |
+
foreach($defaults as $default => $val){
|
1108 |
+
|
1109 |
+
if(($default === 'acfe_flexible_modal' && empty($field['acfe_flexible_modal']['acfe_flexible_modal_enabled'])) ||empty($field[$default]))
|
1110 |
+
continue;
|
1111 |
+
|
1112 |
+
$field['acfe_flexible_advanced'] = 1;
|
1113 |
+
break;
|
1114 |
+
|
1115 |
+
}
|
1116 |
+
|
1117 |
+
}
|
1118 |
|
1119 |
+
return $field;
|
|
|
|
|
|
|
1120 |
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
/**
|
1124 |
+
* Prepare Field
|
1125 |
+
*/
|
1126 |
+
function prepare_field($field){
|
1127 |
|
1128 |
+
foreach($field['layouts'] as &$layout){
|
1129 |
+
|
1130 |
+
// vars
|
1131 |
+
$div = '';
|
1132 |
+
|
1133 |
+
$span = array(
|
1134 |
+
'class' => 'no-thumbnail'
|
1135 |
+
);
|
1136 |
+
|
1137 |
+
// Category
|
1138 |
+
if($layout['acfe_flexible_category'] && $field['acfe_flexible_modal']['acfe_flexible_modal_categories']){
|
1139 |
+
|
1140 |
+
$span['data-acfe-flexible-category'] = trim($layout['acfe_flexible_category']);
|
1141 |
+
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
// Thumbnail
|
1145 |
+
if($field['acfe_flexible_layouts_thumbnails']){
|
1146 |
+
|
1147 |
+
// unset span class
|
1148 |
+
unset($span['class']);
|
1149 |
+
|
1150 |
+
$div = array(
|
1151 |
+
'class' => 'acfe-flexible-layout-thumbnail',
|
1152 |
+
);
|
1153 |
+
|
1154 |
+
// Modal disabled
|
1155 |
+
if(!$field['acfe_flexible_modal']['acfe_flexible_modal_enabled']){
|
1156 |
+
|
1157 |
+
$div['class'] .= ' acfe-flexible-layout-thumbnail-no-modal';
|
1158 |
+
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
// Thumbnail
|
1162 |
+
$thumbnail = $layout['acfe_flexible_thumbnail'] ? $layout['acfe_flexible_thumbnail'] : false;
|
1163 |
+
|
1164 |
+
// Filters
|
1165 |
+
$thumbnail = apply_filters('acfe/flexible/thumbnail/name=' . $field['_name'], $thumbnail, $field, $layout);
|
1166 |
+
$thumbnail = apply_filters('acfe/flexible/thumbnail/key=' . $field['key'], $thumbnail, $field, $layout);
|
1167 |
+
|
1168 |
+
$thumbnail = apply_filters('acfe/flexible/layout/thumbnail/layout=' . $layout['name'], $thumbnail, $field, $layout);
|
1169 |
+
$thumbnail = apply_filters('acfe/flexible/layout/thumbnail/name=' . $field['_name'] . '&layout=' . $layout['name'], $thumbnail, $field, $layout);
|
1170 |
+
$thumbnail = apply_filters('acfe/flexible/layout/thumbnail/key=' . $field['key'] . '&layout=' . $layout['name'], $thumbnail, $field, $layout);
|
1171 |
+
|
1172 |
+
$has_thumbnail = false;
|
1173 |
+
|
1174 |
+
if(!empty($thumbnail)){
|
1175 |
+
|
1176 |
+
$has_thumbnail = true;
|
1177 |
+
$div['style'] = 'background-image:url(' . $thumbnail . ');';
|
1178 |
+
|
1179 |
+
// Attachment ID
|
1180 |
+
if(is_numeric($thumbnail)){
|
1181 |
+
|
1182 |
+
$has_thumbnail = false;
|
1183 |
+
|
1184 |
+
if($thumbnail_src = wp_get_attachment_url($thumbnail)){
|
1185 |
+
|
1186 |
+
$has_thumbnail = true;
|
1187 |
+
$div['style'] = 'background-image:url(' . $thumbnail_src . ');';
|
1188 |
+
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
}
|
1192 |
+
|
1193 |
+
}
|
1194 |
+
|
1195 |
+
// Thumbnail not found
|
1196 |
+
if(!$has_thumbnail){
|
1197 |
+
|
1198 |
+
$div['class'] .= ' acfe-flexible-layout-thumbnail-not-found';
|
1199 |
+
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
$div = '<div ' . acf_esc_attr($div) . '></div>';
|
1203 |
+
|
1204 |
+
}
|
1205 |
+
|
1206 |
+
$layout['label'] = $div . '<span ' . acf_esc_attr($span) . '>' . $layout['label'] . '</span>';
|
1207 |
+
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
return $field;
|
1211 |
|
1212 |
}
|
1213 |
|
1214 |
+
/**
|
1215 |
+
* Load Fields
|
1216 |
+
*/
|
1217 |
function load_fields($fields, $field){
|
1218 |
|
1219 |
+
if(acfe_is_admin_screen())
|
|
|
|
|
|
|
1220 |
return $fields;
|
1221 |
|
1222 |
+
// check layouts
|
1223 |
+
if(empty($field['layouts']))
|
1224 |
return $fields;
|
1225 |
|
1226 |
+
// settings
|
1227 |
+
$has_settings = acf_maybe_get($field, 'acfe_flexible_layouts_settings');
|
1228 |
+
$has_title_edition = acf_maybe_get($field, 'acfe_flexible_title_edition');
|
1229 |
|
1230 |
+
// check settings
|
1231 |
+
if(!$has_settings && !$has_title_edition)
|
1232 |
return $fields;
|
1233 |
|
1234 |
foreach($field['layouts'] as $layout_key => $layout){
|
1235 |
|
1236 |
// Settings
|
1237 |
+
if($has_settings){
|
1238 |
|
1239 |
+
if($settings_keys = acf_maybe_get($layout, 'acfe_flexible_settings')){
|
1240 |
+
|
1241 |
+
// force array
|
1242 |
+
$settings_keys = acf_get_array($settings_keys);
|
1243 |
|
1244 |
+
// style
|
1245 |
+
$field_group_style = 'row';
|
1246 |
+
$field_group = acf_get_field_group($settings_keys[0]);
|
1247 |
+
|
1248 |
+
if(!empty($field_group)){
|
1249 |
+
|
1250 |
+
$field_group_style = $field_group['label_placement'] === 'left' ? 'row' : 'block';
|
1251 |
+
|
1252 |
+
}
|
1253 |
|
1254 |
acf_add_local_field(array(
|
1255 |
'label' => false,
|
1256 |
+
'key' => 'field_' . $layout['key'] . '_settings',
|
1257 |
'name' => 'layout_settings',
|
1258 |
'type' => 'clone',
|
1259 |
+
'clone' => $settings_keys,
|
1260 |
'display' => 'group',
|
1261 |
'acfe_seamless_style' => true,
|
1262 |
+
'layout' => $field_group_style,
|
1263 |
'prefix_label' => 0,
|
1264 |
'prefix_name' => 1,
|
1265 |
'parent_layout' => $layout['key'],
|
1266 |
'parent' => $field['key']
|
1267 |
));
|
1268 |
|
1269 |
+
$clone = acf_get_field('field_' . $layout['key'] . '_settings');
|
1270 |
|
1271 |
array_unshift($fields, $clone);
|
1272 |
|
1273 |
}
|
1274 |
+
|
1275 |
}
|
1276 |
|
1277 |
// Title Edition
|
1278 |
+
if($has_title_edition){
|
1279 |
|
1280 |
acf_add_local_field(array(
|
1281 |
'label' => false,
|
1282 |
+
'key' => 'field_' . $layout['key'] . '_title',
|
1283 |
'name' => 'acfe_flexible_layout_title',
|
1284 |
'type' => 'text',
|
1285 |
'required' => false,
|
1290 |
'parent' => $field['key']
|
1291 |
));
|
1292 |
|
1293 |
+
$title = acf_get_field('field_' . $layout['key'] . '_title');
|
1294 |
|
1295 |
array_unshift($fields, $title);
|
1296 |
|
1302 |
|
1303 |
}
|
1304 |
|
1305 |
+
/**
|
1306 |
+
* Wrapper Attributes
|
1307 |
+
*/
|
1308 |
+
function wrapper_attributes($wrapper, $field){
|
1309 |
|
1310 |
+
// Stylised button
|
1311 |
+
if($field['acfe_flexible_stylised_button']){
|
1312 |
+
|
1313 |
+
$wrapper['data-acfe-flexible-stylised-button'] = 1;
|
1314 |
+
|
1315 |
+
}
|
1316 |
|
1317 |
+
// Hide Empty Message
|
1318 |
+
if($field['acfe_flexible_hide_empty_message'] || $field['acfe_flexible_stylised_button']){
|
1319 |
+
|
1320 |
+
$wrapper['data-acfe-flexible-hide-empty-message'] = 1;
|
1321 |
+
|
1322 |
+
}
|
1323 |
|
1324 |
+
// Ajax
|
1325 |
+
if($field['acfe_flexible_layouts_ajax']){
|
1326 |
+
|
1327 |
+
$wrapper['data-acfe-flexible-ajax'] = 1;
|
1328 |
+
|
1329 |
+
}
|
1330 |
|
1331 |
+
// Modal: Edition
|
1332 |
+
if($field['acfe_flexible_modal_edition']){
|
1333 |
|
1334 |
+
$wrapper['data-acfe-flexible-modal-edition'] = 1;
|
1335 |
+
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
// Modal: Selection
|
1339 |
+
if(isset($field['acfe_flexible_modal']['acfe_flexible_modal_enabled']) && !empty($field['acfe_flexible_modal']['acfe_flexible_modal_enabled'])){
|
1340 |
|
1341 |
+
$wrapper['data-acfe-flexible-modal'] = 1;
|
1342 |
|
1343 |
+
// Columns
|
1344 |
+
if(isset($field['acfe_flexible_modal']['acfe_flexible_modal_col']) && !empty($field['acfe_flexible_modal']['acfe_flexible_modal_col']))
|
1345 |
+
$wrapper['data-acfe-flexible-modal-col'] = $field['acfe_flexible_modal']['acfe_flexible_modal_col'];
|
1346 |
|
1347 |
+
// Title
|
1348 |
+
if(isset($field['acfe_flexible_modal']['acfe_flexible_modal_title']) && !empty($field['acfe_flexible_modal']['acfe_flexible_modal_title']))
|
1349 |
+
$wrapper['data-acfe-flexible-modal-title'] = $field['acfe_flexible_modal']['acfe_flexible_modal_title'];
|
1350 |
+
|
1351 |
}
|
1352 |
|
1353 |
+
// Layouts: Title Edition
|
1354 |
+
if($field['acfe_flexible_title_edition']){
|
1355 |
+
|
1356 |
+
$wrapper['data-acfe-flexible-title-edition'] = 1;
|
1357 |
+
|
1358 |
+
}
|
1359 |
+
|
1360 |
+
// Layouts: Close Button
|
1361 |
+
if($field['acfe_flexible_close_button']){
|
1362 |
+
|
1363 |
+
$wrapper['data-acfe-flexible-close-button'] = 1;
|
1364 |
+
|
1365 |
+
}
|
1366 |
+
|
1367 |
+
// Layouts: Copy/paste
|
1368 |
+
if($field['acfe_flexible_copy_paste']){
|
1369 |
+
|
1370 |
+
$wrapper['data-acfe-flexible-copy-paste'] = 1;
|
1371 |
+
|
1372 |
+
}
|
1373 |
+
|
1374 |
+
// Layouts: State
|
1375 |
+
if(!$field['acfe_flexible_modal_edition']){
|
1376 |
+
|
1377 |
+
// Open
|
1378 |
+
if($field['acfe_flexible_layouts_state'] === 'open'){
|
1379 |
+
|
1380 |
+
$wrapper['data-acfe-flexible-open'] = 1;
|
1381 |
+
|
1382 |
+
}
|
1383 |
+
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
// Layouts Placeholder
|
1387 |
+
if($field['acfe_flexible_layouts_placeholder']){
|
1388 |
+
|
1389 |
+
$wrapper['data-acfe-flexible-placeholder'] = 1;
|
1390 |
+
|
1391 |
+
}
|
1392 |
+
|
1393 |
+
// Layouts Previews
|
1394 |
+
if($field['acfe_flexible_layouts_templates'] && $field['acfe_flexible_layouts_previews']){
|
1395 |
+
|
1396 |
+
$wrapper['data-acfe-flexible-preview'] = 1;
|
1397 |
+
|
1398 |
+
}
|
1399 |
+
|
1400 |
+
// Placeholder Icon
|
1401 |
+
$placeholder_icon = false;
|
1402 |
+
$placeholder_icon = apply_filters('acfe/flexible/placeholder/icon', $placeholder_icon, $field);
|
1403 |
+
$placeholder_icon = apply_filters('acfe/flexible/placeholder/icon/name=' . $field['_name'], $placeholder_icon, $field);
|
1404 |
+
$placeholder_icon = apply_filters('acfe/flexible/placeholder/icon/key=' . $field['key'], $placeholder_icon, $field);
|
1405 |
+
|
1406 |
+
if(!empty($placeholder_icon)){
|
1407 |
+
|
1408 |
+
$wrapper['data-acfe-flexible-placeholder-icon'] = $placeholder_icon;
|
1409 |
+
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
// Lock sortable
|
1413 |
+
$lock_sortable = $field['acfe_flexible_lock'];
|
1414 |
+
|
1415 |
+
$lock_sortable = apply_filters('acfe/flexible/lock', $lock_sortable, $field);
|
1416 |
+
$lock_sortable = apply_filters('acfe/flexible/lock/name=' . $field['_name'], $lock_sortable, $field);
|
1417 |
+
$lock_sortable = apply_filters('acfe/flexible/lock/key=' . $field['key'], $lock_sortable, $field);
|
1418 |
+
|
1419 |
+
if($lock_sortable){
|
1420 |
+
|
1421 |
+
$wrapper['data-acfe-flexible-lock'] = 1;
|
1422 |
+
|
1423 |
+
}
|
1424 |
+
|
1425 |
+
// Remove ajax 'layout_title' call
|
1426 |
+
$remove_ajax_title = $field['acfe_flexible_disable_ajax_title'];
|
1427 |
+
|
1428 |
+
$remove_ajax_title = apply_filters('acfe/flexible/remove_ajax_title', $remove_ajax_title, $field);
|
1429 |
+
$remove_ajax_title = apply_filters('acfe/flexible/remove_ajax_title/name=' . $field['_name'], $remove_ajax_title, $field);
|
1430 |
+
$remove_ajax_title = apply_filters('acfe/flexible/remove_ajax_title/key=' . $field['key'], $remove_ajax_title, $field);
|
1431 |
+
|
1432 |
+
if($remove_ajax_title){
|
1433 |
+
|
1434 |
+
$wrapper['data-acfe-flexible-remove-ajax-title'] = 1;
|
1435 |
+
|
1436 |
+
}
|
1437 |
+
|
1438 |
+
return $wrapper;
|
1439 |
|
1440 |
}
|
1441 |
|
1442 |
+
/**
|
1443 |
+
* Render Field
|
1444 |
+
*/
|
1445 |
function render_field($field){
|
1446 |
|
1447 |
+
// Preview: Enqueue
|
1448 |
+
if($field['acfe_flexible_layouts_templates'] && $field['acfe_flexible_layouts_previews']){
|
1449 |
+
|
1450 |
+
// Vars
|
1451 |
+
global $is_preview;
|
1452 |
+
$is_preview = true;
|
1453 |
+
|
1454 |
+
// Actions
|
1455 |
+
do_action('acfe/flexible/enqueue', $field, $is_preview);
|
1456 |
+
do_action('acfe/flexible/enqueue/name=' . $field['_name'], $field, $is_preview);
|
1457 |
+
do_action('acfe/flexible/enqueue/key=' . $field['key'], $field, $is_preview);
|
1458 |
+
|
1459 |
+
// Layouts Previews
|
1460 |
+
foreach($field['layouts'] as $layout_key => $layout){
|
1461 |
+
|
1462 |
+
// Render: Enqueue
|
1463 |
+
acfe_flexible_render_layout_enqueue($layout, $field);
|
1464 |
+
|
1465 |
+
}
|
1466 |
+
|
1467 |
+
}
|
1468 |
|
1469 |
// Remove actions
|
1470 |
$remove_actions = false;
|
1517 |
<?php foreach($layouts as $layout):
|
1518 |
|
1519 |
// Ajax
|
1520 |
+
if($field['acfe_flexible_layouts_ajax']){
|
1521 |
|
1522 |
$div = array(
|
1523 |
'class' => 'layout acf-clone',
|
1525 |
'data-layout' => $layout['name']
|
1526 |
);
|
1527 |
|
|
|
1528 |
echo '<div ' . acf_esc_attr($div) . '></div>';
|
1529 |
|
1530 |
// No ajax
|
1555 |
endif; ?>
|
1556 |
</div>
|
1557 |
|
1558 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1559 |
|
1560 |
+
if(!$remove_actions && !$field['acfe_flexible_remove_add_button']){
|
|
|
|
|
|
|
1561 |
|
1562 |
+
$button = array(
|
1563 |
+
'class' => 'acf-button button',
|
1564 |
+
'href' => '#',
|
1565 |
+
'data-name' => 'add-layout',
|
1566 |
+
);
|
1567 |
|
1568 |
+
if(!$field['acfe_flexible_stylised_button']){
|
1569 |
|
1570 |
+
$button['class'] .= ' button-primary';
|
|
|
1571 |
|
1572 |
}
|
1573 |
|
1574 |
+
if($field['acfe_flexible_stylised_button']){ ?>
|
1575 |
+
<div class="acfe-flexible-stylised-button">
|
1576 |
+
<?php } ?>
|
|
|
|
|
|
|
|
|
1577 |
|
1578 |
+
<div class="acf-actions">
|
1579 |
+
<a <?php echo acf_esc_attr($button); ?>><?php echo $field['button_label']; ?></a>
|
1580 |
+
|
1581 |
<?php
|
1582 |
|
1583 |
+
$secondary_actions = array();
|
|
|
|
|
|
|
|
|
|
|
1584 |
|
1585 |
+
if($field['acfe_flexible_copy_paste']){
|
1586 |
|
1587 |
+
$secondary_actions['copy'] = '<a href="#" data-acfe-flexible-control-action="copy">' . __('Copy layouts', 'acfe') . '</a>';
|
1588 |
+
$secondary_actions['paste'] = '<a href="#" data-acfe-flexible-control-action="paste">' . __('Paste layouts', 'acfe') . '</a>';
|
1589 |
|
1590 |
}
|
1591 |
+
|
1592 |
+
$secondary_actions = apply_filters('acfe/flexible/secondary_actions', $secondary_actions, $field);
|
1593 |
+
$secondary_actions = apply_filters('acfe/flexible/secondary_actions/name=' . $field['_name'], $secondary_actions, $field);
|
1594 |
+
$secondary_actions = apply_filters('acfe/flexible/secondary_actions/key=' . $field['key'], $secondary_actions, $field);
|
1595 |
+
|
1596 |
?>
|
|
|
|
|
|
|
|
|
1597 |
|
1598 |
+
<?php if(!empty($secondary_actions)){ ?>
|
1599 |
+
|
1600 |
+
<?php
|
1601 |
+
|
1602 |
+
$button_secondary = array(
|
1603 |
+
'class' => 'button',
|
1604 |
+
'style' => 'padding-left:5px;padding-right:5px; margin-left:3px;',
|
1605 |
+
'href' => '#',
|
1606 |
+
'data-name' => 'acfe-flexible-control-button',
|
1607 |
+
);
|
1608 |
+
|
1609 |
+
if(!$field['acfe_flexible_stylised_button']){
|
1610 |
+
|
1611 |
+
$button_secondary['class'] .= ' button-primary';
|
1612 |
+
|
1613 |
+
}
|
1614 |
+
?>
|
1615 |
+
|
1616 |
+
<a <?php echo acf_esc_attr($button_secondary); ?>>
|
1617 |
+
<span class="dashicons dashicons-arrow-down-alt2" style="vertical-align:text-top;width:auto;height:auto;font-size:13px;line-height:20px;"></span>
|
1618 |
+
</a>
|
1619 |
+
|
1620 |
+
<script type="text-html" class="tmpl-acfe-flexible-control-popup">
|
1621 |
+
<ul>
|
1622 |
+
<?php foreach($secondary_actions as $secondary_action){ ?>
|
1623 |
+
<li><?php echo $secondary_action; ?></li>
|
1624 |
+
<?php } ?>
|
1625 |
+
</ul>
|
1626 |
+
</script>
|
1627 |
+
|
1628 |
+
<?php } ?>
|
1629 |
+
|
1630 |
+
</div>
|
1631 |
|
1632 |
+
<?php if($field['acfe_flexible_stylised_button']){ ?>
|
1633 |
+
</div>
|
1634 |
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
1635 |
|
1636 |
+
<script type="text-html" class="tmpl-popup">
|
1637 |
+
<ul>
|
1638 |
+
<?php foreach( $layouts as $layout ):
|
1639 |
+
|
1640 |
+
$atts = array(
|
1641 |
+
'href' => '#',
|
1642 |
+
'data-layout' => $layout['name'],
|
1643 |
+
'data-min' => $layout['min'],
|
1644 |
+
'data-max' => $layout['max'],
|
1645 |
+
);
|
1646 |
+
|
1647 |
+
?><li><a <?php acf_esc_attr_e($atts); ?>><?php echo $layout['label']; ?></a></li><?php
|
1648 |
|
1649 |
+
endforeach; ?>
|
1650 |
+
</ul>
|
1651 |
+
</script>
|
|
|
|
|
1652 |
|
1653 |
<?php } ?>
|
1654 |
|
1657 |
|
1658 |
}
|
1659 |
|
1660 |
+
/**
|
1661 |
+
* Render Layout
|
1662 |
+
*/
|
1663 |
function render_layout($field, $layout, $i, $value){
|
1664 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1665 |
// vars
|
1666 |
$sub_fields = $layout['sub_fields'];
|
1667 |
$id = ($i === 'acfcloneindex') ? 'acfcloneindex' : "row-$i";
|
1674 |
'data-layout' => $layout['name']
|
1675 |
);
|
1676 |
|
1677 |
+
// is clone?
|
1678 |
if(!is_numeric($i)){
|
1679 |
|
1680 |
$div['class'] .= ' acf-clone';
|
1681 |
|
1682 |
}
|
1683 |
|
1684 |
+
$div = apply_filters('acfe/flexible/layouts/div', $div, $layout, $field);
|
1685 |
+
$div = apply_filters('acfe/flexible/layouts/div/name=' . $field['_name'], $div, $layout, $field);
|
1686 |
+
$div = apply_filters('acfe/flexible/layouts/div/key=' . $field['key'], $div, $layout, $field);
|
1687 |
+
$div = apply_filters('acfe/flexible/layouts/div/name=' . $field['_name'] . '&layout=' . $layout['name'], $div, $layout, $field);
|
1688 |
+
$div = apply_filters('acfe/flexible/layouts/div/key=' . $field['key'] . '&layout=' . $layout['name'], $div, $layout, $field);
|
1689 |
|
1690 |
// handle
|
1691 |
+
$handle = array(
|
1692 |
+
'class' => 'acf-fc-layout-handle',
|
1693 |
+
'title' => __('Drag to reorder','acf'),
|
1694 |
+
'data-name' => 'collapse-layout',
|
1695 |
+
);
|
1696 |
+
|
1697 |
+
if($field['acfe_flexible_layouts_remove_collapse']){
|
1698 |
+
|
1699 |
+
unset($handle['data-name']);
|
1700 |
+
|
1701 |
+
}
|
1702 |
+
|
1703 |
+
$handle = apply_filters('acfe/flexible/layouts/handle', $handle, $layout, $field);
|
1704 |
+
$handle = apply_filters('acfe/flexible/layouts/handle/name=' . $field['_name'], $handle, $layout, $field);
|
1705 |
+
$handle = apply_filters('acfe/flexible/layouts/handle/key=' . $field['key'], $handle, $layout, $field);
|
1706 |
+
$handle = apply_filters('acfe/flexible/layouts/handle/name=' . $field['_name'] . '&layout=' . $layout['name'], $handle, $layout, $field);
|
1707 |
+
$handle = apply_filters('acfe/flexible/layouts/handle/key=' . $field['key'] . '&layout=' . $layout['name'], $handle, $layout, $field);
|
1708 |
|
1709 |
// title
|
1710 |
$title = $this->get_layout_title($field, $layout, $i, $value);
|
1722 |
<?php
|
1723 |
|
1724 |
// Title Edition
|
1725 |
+
$this->render_layout_title_edition($layout, $sub_fields, $value, $field, $prefix);
|
1726 |
|
1727 |
// Icons
|
1728 |
$this->render_layout_icons($layout, $field);
|
1731 |
$this->render_layout_placeholder($value, $layout, $field, $i);
|
1732 |
|
1733 |
|
1734 |
+
add_filter('acf/prepare_field/type=wysiwyg', array($this, 'field_editor_delay'));
|
1735 |
+
|
1736 |
+
// Layouts settings
|
1737 |
+
$this->render_layout_settings($layout, $sub_fields, $value, $field, $prefix);
|
1738 |
|
1739 |
+
// Layouts fields
|
1740 |
+
$this->render_layout_fields($layout, $sub_fields, $value, $field, $prefix);
|
1741 |
|
1742 |
+
remove_filter('acf/prepare_field/type=wysiwyg', array($this, 'field_editor_delay'));
|
1743 |
|
1744 |
?>
|
1745 |
|
1748 |
|
1749 |
}
|
1750 |
|
1751 |
+
/**
|
1752 |
+
* Render Title Edition
|
1753 |
+
*/
|
1754 |
+
function render_layout_title_edition($layout, &$sub_fields, $value, $field, $prefix){
|
|
|
|
|
|
|
1755 |
|
1756 |
+
if(!$field['acfe_flexible_title_edition'])
|
1757 |
+
return false;
|
1758 |
|
1759 |
+
if(empty($sub_fields))
|
1760 |
+
return false;
|
|
|
1761 |
|
1762 |
+
$title_key = false;
|
|
|
|
|
|
|
|
|
1763 |
|
1764 |
+
foreach($sub_fields as $sub_key => $sub_field){
|
|
|
|
|
1765 |
|
1766 |
+
if($sub_field['name'] !== 'acfe_flexible_layout_title')
|
1767 |
+
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1768 |
|
1769 |
+
// Remove other potential duplicate
|
1770 |
+
if($title_key !== false){
|
1771 |
|
1772 |
+
unset($sub_fields[$sub_key]);
|
|
|
|
|
1773 |
|
1774 |
+
continue;
|
1775 |
+
|
1776 |
+
}
|
1777 |
|
1778 |
+
$title_key = $sub_key;
|
1779 |
+
|
1780 |
+
}
|
|
|
|
|
|
|
|
|
|
|
1781 |
|
1782 |
+
if($title_key === false)
|
1783 |
return false;
|
1784 |
|
1785 |
// Extract
|
1786 |
+
$title = acf_extract_var($sub_fields, $title_key);
|
1787 |
|
1788 |
+
// Reset keys
|
1789 |
$sub_fields = array_values($sub_fields);
|
1790 |
|
1791 |
// add value
|
1812 |
|
1813 |
$input_attrs = array();
|
1814 |
foreach( array( 'type', 'id', 'class', 'name', 'value', 'placeholder', 'maxlength', 'pattern', 'readonly', 'disabled', 'required', 'data-acfe-flexible-control-title-input' ) as $k ) {
|
1815 |
+
|
1816 |
if( isset($title[ $k ]) ) {
|
1817 |
$input_attrs[ $k ] = $title[ $k ];
|
1818 |
}
|
1819 |
+
|
1820 |
}
|
1821 |
|
1822 |
// render input
|
1824 |
|
1825 |
}
|
1826 |
|
1827 |
+
/**
|
1828 |
+
* Render Layout Icons
|
1829 |
+
*/
|
1830 |
+
function render_layout_icons($layout, $field){
|
1831 |
+
|
1832 |
+
// icons
|
1833 |
+
$icons = array(
|
1834 |
+
'add' => '<a class="acf-icon -plus small light acf-js-tooltip" href="#" data-name="add-layout" title="' . __('Add layout','acf') . '"></a>',
|
1835 |
+
'delete' => '<a class="acf-icon -minus small light acf-js-tooltip" href="#" data-name="remove-layout" title="' . __('Remove layout','acf') . '"></a>',
|
1836 |
+
'collapse' => '<a class="acf-icon -collapse small acf-js-tooltip" href="#" data-name="collapse-layout" title="' . __('Click to toggle','acf') . '"></a>'
|
1837 |
+
);
|
1838 |
+
|
1839 |
+
$icons = apply_filters('acfe/flexible/layouts/icons', $icons, $layout, $field);
|
1840 |
+
$icons = apply_filters('acfe/flexible/layouts/icons/name=' . $field['_name'], $icons, $layout, $field);
|
1841 |
+
$icons = apply_filters('acfe/flexible/layouts/icons/key=' . $field['key'], $icons, $layout, $field);
|
1842 |
+
$icons = apply_filters('acfe/flexible/layouts/icons/name=' . $field['_name'] . '&layout=' . $layout['name'], $icons, $layout, $field);
|
1843 |
+
$icons = apply_filters('acfe/flexible/layouts/icons/key=' . $field['key'] . '&layout=' . $layout['name'], $icons, $layout, $field);
|
1844 |
+
|
1845 |
+
if(!empty($icons)){ ?>
|
1846 |
+
|
1847 |
+
<div class="acf-fc-layout-controls">
|
1848 |
+
|
1849 |
+
<?php foreach($icons as $icon){ ?>
|
1850 |
+
|
1851 |
+
<?php echo $icon; ?>
|
1852 |
+
|
1853 |
+
<?php } ?>
|
1854 |
+
|
1855 |
+
</div>
|
1856 |
+
|
1857 |
+
<?php }
|
1858 |
+
|
1859 |
+
}
|
1860 |
+
|
1861 |
+
/**
|
1862 |
+
* Render Layout Placeholder
|
1863 |
+
*/
|
1864 |
function render_layout_placeholder($value, $layout, $field, $i){
|
1865 |
|
1866 |
+
if(!$field['acfe_flexible_layouts_placeholder'] && !$field['acfe_flexible_layouts_previews'])
|
1867 |
return false;
|
1868 |
|
1869 |
$placeholder = array(
|
1871 |
'title' => __('Edit layout', 'acfe'),
|
1872 |
);
|
1873 |
|
1874 |
+
if(!$field['acfe_flexible_modal_edition'] && !$field['acfe_flexible_layouts_previews'] && $field['acfe_flexible_layouts_state'] !== 'collapse'){
|
1875 |
|
1876 |
$placeholder['class'] .= ' acf-hidden';
|
1877 |
|
1879 |
|
1880 |
$preview_html = false;
|
1881 |
|
1882 |
+
if($field['acfe_flexible_layouts_previews'] && !empty($value)){
|
1883 |
|
1884 |
+
ob_start();
|
1885 |
+
|
1886 |
+
acfe_flexible_layout_preview(array(
|
1887 |
+
'post_id' => acf_get_valid_post_id(),
|
1888 |
+
'i' => $i,
|
1889 |
+
'field_key' => $field['key'],
|
1890 |
+
'layout' => $layout['name'],
|
1891 |
+
'value' => $value,
|
1892 |
+
));
|
1893 |
+
|
1894 |
+
$preview_html = ob_get_clean();
|
1895 |
+
|
1896 |
+
if(strlen($preview_html) > 0){
|
1897 |
|
1898 |
+
$placeholder['class'] .= ' acfe-fc-preview';
|
|
|
|
|
|
|
|
|
1899 |
|
1900 |
}
|
1901 |
|
1902 |
}
|
1903 |
|
1904 |
+
if($field['acfe_flexible_modal_edition']){
|
1905 |
|
1906 |
$placeholder['data-action'] = 'acfe-flexible-modal-edit';
|
1907 |
|
1927 |
|
1928 |
}
|
1929 |
|
1930 |
+
/**
|
1931 |
+
* Render Layout Settings
|
1932 |
+
*/
|
1933 |
+
function render_layout_settings($layout, &$sub_fields, $value, $field, $prefix){
|
1934 |
|
1935 |
+
if(!$field['acfe_flexible_layouts_settings'])
|
1936 |
+
return false;
|
1937 |
|
1938 |
if(empty($sub_fields))
|
1939 |
+
return false;
|
1940 |
|
1941 |
+
$setting_key = false;
|
1942 |
+
|
1943 |
+
foreach($sub_fields as $sub_key => $sub_field){
|
|
|
1944 |
|
1945 |
+
if($sub_field['name'] !== 'layout_settings')
|
1946 |
+
continue;
|
|
|
1947 |
|
1948 |
+
// Remove other potential duplicate
|
1949 |
+
if($setting_key !== false){
|
1950 |
|
1951 |
+
unset($sub_fields[$sub_key]);
|
1952 |
+
|
1953 |
+
continue;
|
1954 |
+
|
1955 |
+
}
|
1956 |
+
|
1957 |
+
$setting_key = $sub_key;
|
1958 |
+
|
1959 |
+
}
|
1960 |
+
|
1961 |
+
// Not found
|
1962 |
+
if($setting_key === false)
|
1963 |
+
return false;
|
1964 |
+
|
1965 |
+
// Extract
|
1966 |
+
$sub_field = acf_extract_var($sub_fields, $setting_key);
|
1967 |
+
|
1968 |
+
// Reset keys
|
1969 |
+
$sub_fields = array_values($sub_fields);
|
1970 |
+
|
1971 |
+
$size = 'medium';
|
1972 |
+
if($layout['acfe_flexible_settings_size']){
|
1973 |
+
|
1974 |
+
$size = $layout['acfe_flexible_settings_size'];
|
1975 |
+
|
1976 |
+
}
|
1977 |
+
|
1978 |
+
?>
|
1979 |
+
|
1980 |
+
<div class="acfe-modal -settings -<?php echo $size; ?>">
|
1981 |
+
<div class="acfe-modal-wrapper">
|
1982 |
+
<div class="acfe-modal-content">
|
1983 |
+
|
1984 |
+
<div class="acf-fields -top">
|
1985 |
+
|
1986 |
+
<?php
|
1987 |
|
1988 |
+
// add value
|
1989 |
+
if( isset($value[ $sub_field['key'] ]) ) {
|
1990 |
|
1991 |
+
// this is a normal value
|
1992 |
+
$sub_field['value'] = $value[ $sub_field['key'] ];
|
1993 |
|
1994 |
+
} elseif( isset($sub_field['default_value']) ) {
|
1995 |
|
1996 |
+
// no value, but this sub field has a default value
|
1997 |
+
$sub_field['value'] = $sub_field['default_value'];
|
1998 |
|
1999 |
+
}
|
2000 |
|
2001 |
+
// update prefix to allow for nested values
|
2002 |
+
$sub_field['prefix'] = $prefix;
|
2003 |
+
|
2004 |
+
// render
|
2005 |
+
acf_render_field_wrap($sub_field, 'div');
|
2006 |
+
|
2007 |
+
?>
|
2008 |
|
2009 |
</div>
|
2010 |
+
|
2011 |
+
</div>
|
2012 |
+
</div>
|
2013 |
+
</div>
|
2014 |
+
|
2015 |
+
<?php
|
2016 |
+
|
2017 |
+
}
|
2018 |
+
|
2019 |
+
/**
|
2020 |
+
* Render Layout Fields
|
2021 |
+
*/
|
2022 |
+
function render_layout_fields($layout, $sub_fields, $value, $field, $prefix){
|
2023 |
+
|
2024 |
+
if(empty($sub_fields))
|
2025 |
+
return false;
|
2026 |
|
2027 |
// el
|
2028 |
$el = 'div';
|
2033 |
|
2034 |
}
|
2035 |
|
2036 |
+
if($field['acfe_flexible_modal_edition']){ ?>
|
2037 |
|
2038 |
<div class="acfe-modal -fields">
|
2039 |
<div class="acfe-modal-wrapper">
|
2120 |
|
2121 |
?>
|
2122 |
|
2123 |
+
<?php if(!$field['acfe_flexible_modal_edition'] && $field['acfe_flexible_close_button']){ ?>
|
2124 |
|
2125 |
<div class="acfe-flexible-opened-actions"><a href="javascript:void(0);" class="button"><?php _e('Close', 'acf'); ?></button></a></div>
|
2126 |
|
2134 |
</div>
|
2135 |
<?php endif; ?>
|
2136 |
|
2137 |
+
<?php if($field['acfe_flexible_modal_edition']){ ?>
|
2138 |
|
2139 |
</div>
|
2140 |
</div>
|
2144 |
|
2145 |
}
|
2146 |
|
2147 |
+
/**
|
2148 |
+
* Add Layout Div
|
2149 |
+
*/
|
2150 |
+
function add_layout_div($div, $layout, $field){
|
2151 |
|
2152 |
+
// Class
|
2153 |
+
if($field['acfe_flexible_layouts_state'] === 'collapse' || $field['acfe_flexible_layouts_previews'] || $field['acfe_flexible_modal_edition']){
|
2154 |
+
|
2155 |
+
$div['class'] .= ' -collapsed';
|
2156 |
+
|
2157 |
+
}
|
2158 |
|
2159 |
+
return $div;
|
2160 |
|
2161 |
}
|
2162 |
|
2163 |
+
/**
|
2164 |
+
* Add Layout Handle
|
2165 |
+
*/
|
2166 |
+
function add_layout_handle($handle, $layout, $field){
|
2167 |
+
|
2168 |
+
// Data
|
2169 |
+
if($field['acfe_flexible_modal_edition']){
|
2170 |
+
|
2171 |
+
$handle['data-action'] = 'acfe-flexible-modal-edit';
|
2172 |
+
|
2173 |
+
}
|
2174 |
+
|
2175 |
+
return $handle;
|
2176 |
+
|
2177 |
+
}
|
2178 |
+
|
2179 |
+
/**
|
2180 |
+
* Add Layout Icons
|
2181 |
+
*/
|
2182 |
function add_layout_icons($icons, $layout, $field){
|
2183 |
|
2184 |
// Settings
|
2185 |
+
if($field['acfe_flexible_layouts_settings'] && acf_maybe_get($layout, 'acfe_flexible_settings')){
|
2186 |
|
2187 |
$new_icons = array(
|
2188 |
'settings' => '<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-admin-generic" href="#" title="Settings" data-acfe-flexible-settings="' . $layout['name'] . '"></a>'
|
2192 |
|
2193 |
}
|
2194 |
|
2195 |
+
// Copy
|
2196 |
+
if($field['acfe_flexible_copy_paste']){
|
2197 |
|
2198 |
$new_icons = array(
|
2199 |
'copy' => '<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-category" href="#" title="Copy layout" data-acfe-flexible-control-copy="' . $layout['name'] . '"></a>'
|
2204 |
}
|
2205 |
|
2206 |
// Clone
|
2207 |
+
if($field['acfe_flexible_clone']){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2208 |
|
2209 |
+
// Clone
|
2210 |
+
$new_icons = array(
|
2211 |
+
'clone' => '<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-admin-page" href="#" title="Clone layout" data-acfe-flexible-control-clone="' . $layout['name'] . '"></a>'
|
2212 |
+
);
|
2213 |
+
|
2214 |
+
$icons = array_merge($new_icons, $icons);
|
2215 |
|
2216 |
}
|
2217 |
|
2218 |
+
// Remove: Action filter
|
2219 |
+
$remove_actions = false;
|
2220 |
+
$remove_actions = apply_filters('acfe/flexible/remove_actions', $remove_actions, $field);
|
2221 |
+
$remove_actions = apply_filters('acfe/flexible/remove_actions/name=' . $field['_name'], $remove_actions, $field);
|
2222 |
+
$remove_actions = apply_filters('acfe/flexible/remove_actions/key=' . $field['key'], $remove_actions, $field);
|
2223 |
+
|
2224 |
+
if($remove_actions){
|
2225 |
|
2226 |
// Add
|
2227 |
if(isset($icons['add'])) unset($icons['add']);
|
2228 |
|
2229 |
+
// Delete
|
2230 |
+
if(isset($icons['delete'])) unset($icons['delete']);
|
2231 |
|
2232 |
// Clone
|
2233 |
if(isset($icons['clone'])) unset($icons['clone']);
|
2237 |
|
2238 |
}
|
2239 |
|
2240 |
+
// Remove: Add button
|
2241 |
+
if($field['acfe_flexible_remove_add_button'] && isset($icons['add'])){
|
2242 |
+
|
2243 |
+
unset($icons['add']);
|
2244 |
+
|
2245 |
+
}
|
2246 |
|
2247 |
+
// Remove: Delete button
|
2248 |
+
if($field['acfe_flexible_remove_delete_button'] && isset($icons['delete'])){
|
2249 |
+
|
2250 |
+
unset($icons['delete']);
|
2251 |
+
|
2252 |
+
}
|
2253 |
|
2254 |
+
// Remove: Toggle
|
2255 |
+
if(($field['acfe_flexible_modal_edition'] || $field['acfe_flexible_layouts_remove_collapse']) && isset($icons['collapse'])){
|
2256 |
|
2257 |
+
unset($icons['collapse']);
|
2258 |
|
2259 |
}
|
2260 |
|
2261 |
+
return $icons;
|
2262 |
|
2263 |
}
|
2264 |
|
2265 |
+
/**
|
2266 |
+
* Add Empty Message
|
2267 |
+
*/
|
2268 |
+
function add_empty_message($message, $field){
|
2269 |
|
2270 |
+
if(!$field['acfe_flexible_empty_message'])
|
2271 |
+
return $message;
|
2272 |
|
2273 |
+
return $field['acfe_flexible_empty_message'];
|
2274 |
+
|
2275 |
+
}
|
2276 |
+
|
2277 |
+
/**
|
2278 |
+
* Add Layout Title
|
2279 |
+
*/
|
2280 |
+
function add_layout_title($title, $field, $layout, $i){
|
2281 |
+
|
2282 |
+
// Remove thumbnail
|
2283 |
+
$title = preg_replace('#<div class="acfe-flexible-layout-thumbnail(.*?)</div>#', '', $title);
|
2284 |
+
|
2285 |
+
// Title Edition
|
2286 |
+
if($field['acfe_flexible_title_edition']){
|
2287 |
+
|
2288 |
+
// Get Layout Title
|
2289 |
+
$acfe_flexible_layout_title = get_sub_field('acfe_flexible_layout_title');
|
2290 |
+
|
2291 |
+
if(!empty($acfe_flexible_layout_title)){
|
2292 |
+
|
2293 |
+
$title = wp_unslash($acfe_flexible_layout_title);
|
2294 |
+
|
2295 |
+
}
|
2296 |
+
|
2297 |
+
// Return
|
2298 |
+
return '<span class="acfe-layout-title acf-js-tooltip" title="' . __('Layout', 'acfe') . ': ' . esc_attr(strip_tags($layout['label'])) . '"><span class="acfe-layout-title-text">' . $title . '</span></span>';
|
2299 |
|
2300 |
}
|
2301 |
|
2302 |
+
// Return
|
2303 |
+
return '<span class="acfe-layout-title-text">' . $title . '</span></span>';
|
2304 |
+
|
2305 |
+
}
|
2306 |
+
|
2307 |
+
/**
|
2308 |
+
* Wysiwyg Editor Delay
|
2309 |
+
*/
|
2310 |
+
function field_editor_delay($field){
|
2311 |
+
|
2312 |
+
$field['delay'] = 1;
|
2313 |
+
|
2314 |
+
return $field;
|
2315 |
|
2316 |
}
|
2317 |
|
includes/fields/field-group.php
CHANGED
@@ -1,107 +1,173 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if(!defined('ABSPATH'))
|
4 |
-
exit;
|
5 |
-
|
6 |
-
add_action('acf/render_field_settings/type=group', 'acfe_field_group_settings');
|
7 |
-
function acfe_field_group_settings($field){
|
8 |
-
|
9 |
-
acf_render_field_setting($field, array(
|
10 |
-
'label' => __('Seamless Style', 'acfe'),
|
11 |
-
'name' => 'acfe_seamless_style',
|
12 |
-
'key' => 'acfe_seamless_style',
|
13 |
-
'instructions' => __('Enable better CSS integration: remove borders and padding'),
|
14 |
-
'type' => 'true_false',
|
15 |
-
'message' => '',
|
16 |
-
'default_value' => false,
|
17 |
-
'ui' => true,
|
18 |
-
'conditional_logic' => array(
|
19 |
-
array(
|
20 |
-
array(
|
21 |
-
'field' => 'acfe_group_modal',
|
22 |
-
'operator' => '!=',
|
23 |
-
'value' => '1',
|
24 |
-
)
|
25 |
-
)
|
26 |
-
)
|
27 |
-
));
|
28 |
-
|
29 |
-
acf_render_field_setting($field, array(
|
30 |
-
'label' => __('Edition modal'),
|
31 |
-
'name' => 'acfe_group_modal',
|
32 |
-
'key' => 'acfe_group_modal',
|
33 |
-
'instructions' => __('Edit fields in a modal'),
|
34 |
-
'type' => 'true_false',
|
35 |
-
'message' => '',
|
36 |
-
'default_value' => false,
|
37 |
-
'ui' => true,
|
38 |
-
'conditional_logic' => array(
|
39 |
-
array(
|
40 |
-
array(
|
41 |
-
'field' => 'display',
|
42 |
-
'operator' => '==',
|
43 |
-
'value' => 'group',
|
44 |
-
),
|
45 |
-
)
|
46 |
-
)
|
47 |
-
));
|
48 |
-
|
49 |
-
acf_render_field_setting($field, array(
|
50 |
-
'label' => __('Edition modal button'),
|
51 |
-
'name' => '
|
52 |
-
'key' => '
|
53 |
-
'instructions' => __('
|
54 |
-
'type' => '
|
55 |
-
'
|
56 |
-
'
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
'
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
'
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
add_action('acf/render_field_settings/type=group', 'acfe_field_group_settings');
|
7 |
+
function acfe_field_group_settings($field){
|
8 |
+
|
9 |
+
acf_render_field_setting($field, array(
|
10 |
+
'label' => __('Seamless Style', 'acfe'),
|
11 |
+
'name' => 'acfe_seamless_style',
|
12 |
+
'key' => 'acfe_seamless_style',
|
13 |
+
'instructions' => __('Enable better CSS integration: remove borders and padding'),
|
14 |
+
'type' => 'true_false',
|
15 |
+
'message' => '',
|
16 |
+
'default_value' => false,
|
17 |
+
'ui' => true,
|
18 |
+
'conditional_logic' => array(
|
19 |
+
array(
|
20 |
+
array(
|
21 |
+
'field' => 'acfe_group_modal',
|
22 |
+
'operator' => '!=',
|
23 |
+
'value' => '1',
|
24 |
+
)
|
25 |
+
)
|
26 |
+
)
|
27 |
+
));
|
28 |
+
|
29 |
+
acf_render_field_setting($field, array(
|
30 |
+
'label' => __('Edition modal'),
|
31 |
+
'name' => 'acfe_group_modal',
|
32 |
+
'key' => 'acfe_group_modal',
|
33 |
+
'instructions' => __('Edit fields in a modal'),
|
34 |
+
'type' => 'true_false',
|
35 |
+
'message' => '',
|
36 |
+
'default_value' => false,
|
37 |
+
'ui' => true,
|
38 |
+
'conditional_logic' => array(
|
39 |
+
array(
|
40 |
+
array(
|
41 |
+
'field' => 'display',
|
42 |
+
'operator' => '==',
|
43 |
+
'value' => 'group',
|
44 |
+
),
|
45 |
+
)
|
46 |
+
)
|
47 |
+
));
|
48 |
+
|
49 |
+
acf_render_field_setting($field, array(
|
50 |
+
'label' => __('Edition modal: Close button'),
|
51 |
+
'name' => 'acfe_group_modal_close',
|
52 |
+
'key' => 'acfe_group_modal_close',
|
53 |
+
'instructions' => __('Display close button'),
|
54 |
+
'type' => 'true_false',
|
55 |
+
'message' => '',
|
56 |
+
'default_value' => false,
|
57 |
+
'ui' => true,
|
58 |
+
'conditional_logic' => array(
|
59 |
+
array(
|
60 |
+
array(
|
61 |
+
'field' => 'display',
|
62 |
+
'operator' => '==',
|
63 |
+
'value' => 'group',
|
64 |
+
),
|
65 |
+
array(
|
66 |
+
'field' => 'acfe_group_modal',
|
67 |
+
'operator' => '==',
|
68 |
+
'value' => '1',
|
69 |
+
),
|
70 |
+
)
|
71 |
+
)
|
72 |
+
));
|
73 |
+
|
74 |
+
acf_render_field_setting($field, array(
|
75 |
+
'label' => __('Edition modal: Text button'),
|
76 |
+
'name' => 'acfe_group_modal_button',
|
77 |
+
'key' => 'acfe_group_modal_button',
|
78 |
+
'instructions' => __('Text displayed in the edition modal button'),
|
79 |
+
'type' => 'text',
|
80 |
+
'placeholder' => __('Edit', 'acf'),
|
81 |
+
'conditional_logic' => array(
|
82 |
+
array(
|
83 |
+
array(
|
84 |
+
'field' => 'display',
|
85 |
+
'operator' => '==',
|
86 |
+
'value' => 'group',
|
87 |
+
),
|
88 |
+
array(
|
89 |
+
'field' => 'acfe_group_modal',
|
90 |
+
'operator' => '==',
|
91 |
+
'value' => '1',
|
92 |
+
),
|
93 |
+
)
|
94 |
+
)
|
95 |
+
));
|
96 |
+
|
97 |
+
acf_render_field_setting($field, array(
|
98 |
+
'label' => __('Edition modal: Size'),
|
99 |
+
'name' => 'acfe_group_modal_size',
|
100 |
+
'key' => 'acfe_group_modal_size',
|
101 |
+
'instructions' => __('Choose the modal size'),
|
102 |
+
'type' => 'select',
|
103 |
+
'choices' => array(
|
104 |
+
'small' => 'Small',
|
105 |
+
'medium' => 'Medium',
|
106 |
+
'large' => 'Large',
|
107 |
+
'full' => 'Full',
|
108 |
+
),
|
109 |
+
'default_value' => 'large',
|
110 |
+
'conditional_logic' => array(
|
111 |
+
array(
|
112 |
+
array(
|
113 |
+
'field' => 'display',
|
114 |
+
'operator' => '==',
|
115 |
+
'value' => 'group',
|
116 |
+
),
|
117 |
+
array(
|
118 |
+
'field' => 'acfe_group_modal',
|
119 |
+
'operator' => '==',
|
120 |
+
'value' => '1',
|
121 |
+
),
|
122 |
+
)
|
123 |
+
)
|
124 |
+
));
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
add_filter('acfe/field_wrapper_attributes/type=group', 'acfe_field_group_wrapper', 10, 2);
|
129 |
+
function acfe_field_group_wrapper($wrapper, $field){
|
130 |
+
|
131 |
+
if(isset($field['acfe_group_modal']) && !empty($field['acfe_group_modal'])){
|
132 |
+
|
133 |
+
$wrapper['data-acfe-group-modal'] = 1;
|
134 |
+
$wrapper['data-acfe-group-modal-button'] = __('Edit', 'acf');
|
135 |
+
|
136 |
+
if(isset($field['acfe_group_modal_button']) && !empty($field['acfe_group_modal_button'])){
|
137 |
+
|
138 |
+
$wrapper['data-acfe-group-modal-button'] = $field['acfe_group_modal_button'];
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
if(acf_maybe_get($field, 'acfe_group_modal_close')){
|
143 |
+
|
144 |
+
$wrapper['data-acfe-group-modal-close'] = $field['acfe_group_modal_close'];
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
if(acf_maybe_get($field, 'acfe_group_modal_size')){
|
149 |
+
|
150 |
+
$wrapper['data-acfe-group-modal-size'] = $field['acfe_group_modal_size'];
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
}
|
155 |
+
|
156 |
+
return $wrapper;
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
add_filter('acf/prepare_field/type=group', 'acfe_field_group_type_class', 99);
|
161 |
+
function acfe_field_group_type_class($field){
|
162 |
+
|
163 |
+
if(acf_maybe_get($field, 'acfe_seamless_style')){
|
164 |
+
|
165 |
+
$field['wrapper']['class'] .= ' acfe-seamless-style';
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
$field['wrapper']['class'] .= ' acfe-field-group-layout-' . $field['layout'];
|
170 |
+
|
171 |
+
return $field;
|
172 |
+
|
173 |
}
|
includes/fields/field-hidden.php
CHANGED
@@ -23,14 +23,7 @@ class acfe_field_hidden extends acf_field{
|
|
23 |
function render_field($field){
|
24 |
|
25 |
?>
|
26 |
-
<
|
27 |
-
.field_key-<?php echo $field['key']; ?>,
|
28 |
-
.acf-<?php echo str_replace('_', '-', $field['key']); ?>,
|
29 |
-
.acf-field-<?php echo str_replace('_', '-', $field['key']); ?>{
|
30 |
-
display: none;
|
31 |
-
}
|
32 |
-
</style>
|
33 |
-
<input type="hidden" name="<?php echo esc_attr($field['name']) ?>" value="<?php echo esc_attr($field['value']) ?>" style="display:none;" />
|
34 |
<?php
|
35 |
|
36 |
}
|
23 |
function render_field($field){
|
24 |
|
25 |
?>
|
26 |
+
<input type="hidden" name="<?php echo esc_attr($field['name']) ?>" value="<?php echo esc_attr($field['value']) ?>" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
<?php
|
28 |
|
29 |
}
|
includes/fields/field-taxonomy-terms.php
CHANGED
@@ -690,7 +690,7 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
690 |
function load_value($value, $post_id, $field){
|
691 |
|
692 |
// get valid terms
|
693 |
-
|
694 |
|
695 |
// load_terms
|
696 |
if($field['load_terms']){
|
690 |
function load_value($value, $post_id, $field){
|
691 |
|
692 |
// get valid terms
|
693 |
+
$value = acf_get_array($value);
|
694 |
|
695 |
// load_terms
|
696 |
if($field['load_terms']){
|
includes/locations/post-type-archive.php
CHANGED
@@ -100,14 +100,8 @@ class acfe_location_post_type_archive{
|
|
100 |
|
101 |
function get_options_pages($pages){
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
'acf-field-group',
|
106 |
-
'acf_page_acf-tools'
|
107 |
-
));
|
108 |
-
|
109 |
-
// Bail early if screen is Field Group configuration & Ajax Calls
|
110 |
-
if(!$check_current_screen && !wp_doing_ajax())
|
111 |
return $pages;
|
112 |
|
113 |
foreach($pages as $page => $args){
|
100 |
|
101 |
function get_options_pages($pages){
|
102 |
|
103 |
+
// Bail early if screen is not Field Group configuration & Ajax Calls
|
104 |
+
if(!acfe_is_admin_screen() && !wp_doing_ajax())
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
return $pages;
|
106 |
|
107 |
foreach($pages as $page => $args){
|
includes/modules/dev.php
CHANGED
@@ -36,8 +36,14 @@ class acfe_dev{
|
|
36 |
add_action('show_user_profile', array($this, 'load_user'));
|
37 |
add_action('edit_user_profile', array($this, 'load_user'));
|
38 |
|
|
|
|
|
|
|
39 |
}
|
40 |
-
|
|
|
|
|
|
|
41 |
function load_post(){
|
42 |
|
43 |
global $typenow;
|
@@ -49,7 +55,7 @@ class acfe_dev{
|
|
49 |
|
50 |
if(!$this->is_super_dev){
|
51 |
|
52 |
-
$restricted = array('acfe-dbt', 'acfe-dop', 'acfe-dpt', 'acfe-dt', 'acfe-form');
|
53 |
|
54 |
if(in_array($post_type, $restricted))
|
55 |
return;
|
@@ -57,10 +63,20 @@ class acfe_dev{
|
|
57 |
}
|
58 |
|
59 |
// actions
|
60 |
-
add_action('add_meta_boxes', array($this, '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
}
|
63 |
|
|
|
|
|
|
|
64 |
function load_term(){
|
65 |
|
66 |
$screen = get_current_screen();
|
@@ -73,22 +89,13 @@ class acfe_dev{
|
|
73 |
|
74 |
function edit_term($term, $taxonomy){
|
75 |
|
|
|
76 |
$post_id = acf_get_term_post_id($term->taxonomy, $term->term_id);
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
if(!empty($this->wp_meta)){
|
81 |
-
|
82 |
-
add_meta_box('acfe-wp-custom-fields', 'WP Custom fields', array($this, 'wp_render_meta_box'), 'edit-term', 'normal', 'low');
|
83 |
-
|
84 |
-
}
|
85 |
-
|
86 |
-
if(!empty($this->acf_meta)){
|
87 |
-
|
88 |
-
add_meta_box('acfe-acf-custom-fields', 'ACF Custom fields', array($this, 'acf_render_meta_box'), 'edit-term', 'normal', 'low');
|
89 |
-
|
90 |
-
}
|
91 |
|
|
|
92 |
echo '<div id="poststuff">';
|
93 |
|
94 |
do_meta_boxes('edit-term', 'normal', array());
|
@@ -97,28 +104,22 @@ class acfe_dev{
|
|
97 |
|
98 |
}
|
99 |
|
|
|
|
|
|
|
100 |
function load_user(){
|
101 |
|
|
|
102 |
global $user_id;
|
103 |
$user_id = (int) $user_id;
|
104 |
|
105 |
if(empty($user_id))
|
106 |
return;
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
if(!empty($this->wp_meta)){
|
111 |
-
|
112 |
-
add_meta_box('acfe-wp-custom-fields', 'WP Custom fields', array($this, 'wp_render_meta_box'), 'edit-user', 'normal', 'low');
|
113 |
-
|
114 |
-
}
|
115 |
-
|
116 |
-
if(!empty($this->acf_meta)){
|
117 |
-
|
118 |
-
add_meta_box('acfe-acf-custom-fields', 'ACF Custom fields', array($this, 'acf_render_meta_box'), 'edit-user', 'normal', 'low');
|
119 |
-
|
120 |
-
}
|
121 |
|
|
|
122 |
echo '<div id="poststuff">';
|
123 |
|
124 |
do_meta_boxes('edit-user', 'normal', array());
|
@@ -127,117 +128,44 @@ class acfe_dev{
|
|
127 |
|
128 |
}
|
129 |
|
130 |
-
|
131 |
-
|
|
|
|
|
132 |
|
|
|
133 |
|
134 |
}
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
if(empty($post_id))
|
142 |
-
return;
|
143 |
-
|
144 |
-
$info = acf_get_post_id_info($post_id);
|
145 |
-
|
146 |
-
|
147 |
-
global $wpdb;
|
148 |
-
|
149 |
-
// Post
|
150 |
-
if($info['type'] === 'post'){
|
151 |
-
|
152 |
-
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d ", $info['id']));
|
153 |
-
|
154 |
-
}
|
155 |
-
|
156 |
-
// Term
|
157 |
-
elseif($info['type'] === 'term'){
|
158 |
-
|
159 |
-
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->termmeta WHERE term_id = %d ", $info['id']));
|
160 |
-
|
161 |
-
}
|
162 |
-
|
163 |
-
// User
|
164 |
-
elseif($info['type'] === 'user'){
|
165 |
-
|
166 |
-
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d ", $info['id']));
|
167 |
-
|
168 |
-
}
|
169 |
-
|
170 |
-
usort($get_meta, function($a, $b){
|
171 |
-
return strcmp($a->meta_key, $b->meta_key);
|
172 |
-
});
|
173 |
-
|
174 |
-
if(empty($get_meta))
|
175 |
-
return;
|
176 |
-
|
177 |
-
$wp_meta = array();
|
178 |
-
|
179 |
-
foreach($get_meta as $meta){
|
180 |
-
|
181 |
-
$wp_meta[$meta->meta_key] = $meta->meta_value;
|
182 |
-
|
183 |
-
}
|
184 |
-
|
185 |
-
$acf_meta = array();
|
186 |
-
|
187 |
-
foreach($wp_meta as $key => $value){
|
188 |
-
|
189 |
-
// ACF Meta
|
190 |
-
if(isset($wp_meta["_$key"])){
|
191 |
-
|
192 |
-
$field = false;
|
193 |
-
$field_group = false;
|
194 |
-
|
195 |
-
if(acf_is_field_key($wp_meta["_$key"])){
|
196 |
-
|
197 |
-
$field = acf_get_field($wp_meta["_$key"]);
|
198 |
-
$field_group = acfe_get_field_group_from_field($field);
|
199 |
-
|
200 |
-
}
|
201 |
-
|
202 |
-
$acf_meta[] = array(
|
203 |
-
'key' => "_$key",
|
204 |
-
'value' => $wp_meta["_$key"],
|
205 |
-
'field' => $field,
|
206 |
-
'field_group' => $field_group,
|
207 |
-
);
|
208 |
-
|
209 |
-
$acf_meta[] = array(
|
210 |
-
'key' => $key,
|
211 |
-
'value' => $wp_meta[$key],
|
212 |
-
'field' => $field,
|
213 |
-
'field_group' => $field_group,
|
214 |
-
);
|
215 |
-
|
216 |
-
unset($wp_meta["_$key"]);
|
217 |
-
unset($wp_meta[$key]);
|
218 |
-
|
219 |
-
}
|
220 |
-
|
221 |
-
}
|
222 |
-
|
223 |
-
$this->wp_meta = $wp_meta;
|
224 |
-
$this->acf_meta = $acf_meta;
|
225 |
|
226 |
-
|
227 |
-
|
228 |
-
function add_meta_boxes($post_type, $post){
|
229 |
-
|
230 |
-
$this->get_meta();
|
231 |
|
|
|
232 |
if(!empty($this->wp_meta)){
|
233 |
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
}
|
237 |
|
|
|
238 |
if(!empty($this->acf_meta)){
|
239 |
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
}
|
243 |
|
@@ -295,12 +223,15 @@ class acfe_dev{
|
|
295 |
<?php foreach($this->acf_meta as $meta){ ?>
|
296 |
|
297 |
<?php
|
|
|
|
|
|
|
298 |
$meta_key = $meta['key'];
|
299 |
$value = $meta['value'];
|
300 |
|
301 |
-
|
302 |
-
$field_group = $meta['field_group'];
|
303 |
$field_group_display = '<span style="color:#aaa;">' . __('Unknown', 'acf') . '</span>';
|
|
|
304 |
|
305 |
if($field_group){
|
306 |
|
@@ -310,8 +241,11 @@ class acfe_dev{
|
|
310 |
|
311 |
$post_status = get_post_status($field_group['ID']);
|
312 |
|
313 |
-
if($post_status === 'publish')
|
|
|
314 |
$field_group_display = '<a href="' . admin_url('post.php?post=' . $field_group['ID'] . '&action=edit') . '">' . $field_group['title'] . '</a>';
|
|
|
|
|
315 |
|
316 |
}
|
317 |
|
@@ -383,6 +317,130 @@ class acfe_dev{
|
|
383 |
|
384 |
}
|
385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
}
|
387 |
|
388 |
new acfe_dev();
|
36 |
add_action('show_user_profile', array($this, 'load_user'));
|
37 |
add_action('edit_user_profile', array($this, 'load_user'));
|
38 |
|
39 |
+
// Admin
|
40 |
+
add_action('acf/options_page/submitbox_before_major_actions', array($this, 'load_admin'));
|
41 |
+
|
42 |
}
|
43 |
+
|
44 |
+
/*
|
45 |
+
* Post
|
46 |
+
*/
|
47 |
function load_post(){
|
48 |
|
49 |
global $typenow;
|
55 |
|
56 |
if(!$this->is_super_dev){
|
57 |
|
58 |
+
$restricted = array('acf-field-group', 'acfe-dbt', 'acfe-dop', 'acfe-dpt', 'acfe-dt', 'acfe-form', 'acfe-template');
|
59 |
|
60 |
if(in_array($post_type, $restricted))
|
61 |
return;
|
63 |
}
|
64 |
|
65 |
// actions
|
66 |
+
add_action('add_meta_boxes', array($this, 'add_post_meta_boxes'), 10, 2);
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
function add_post_meta_boxes($post_type, $post){
|
71 |
+
|
72 |
+
// Add Meta Boxes
|
73 |
+
$this->add_meta_boxes(0, $post_type);
|
74 |
|
75 |
}
|
76 |
|
77 |
+
/*
|
78 |
+
* Term
|
79 |
+
*/
|
80 |
function load_term(){
|
81 |
|
82 |
$screen = get_current_screen();
|
89 |
|
90 |
function edit_term($term, $taxonomy){
|
91 |
|
92 |
+
// Get Term ID
|
93 |
$post_id = acf_get_term_post_id($term->taxonomy, $term->term_id);
|
94 |
|
95 |
+
// Add Meta Boxes
|
96 |
+
$this->add_meta_boxes($post_id, 'edit-term');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
+
// Poststuff
|
99 |
echo '<div id="poststuff">';
|
100 |
|
101 |
do_meta_boxes('edit-term', 'normal', array());
|
104 |
|
105 |
}
|
106 |
|
107 |
+
/*
|
108 |
+
* User
|
109 |
+
*/
|
110 |
function load_user(){
|
111 |
|
112 |
+
// Get User ID
|
113 |
global $user_id;
|
114 |
$user_id = (int) $user_id;
|
115 |
|
116 |
if(empty($user_id))
|
117 |
return;
|
118 |
|
119 |
+
// Add Meta Boxes
|
120 |
+
$this->add_meta_boxes('user_' . $user_id, 'edit-user');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
+
// Poststuff
|
123 |
echo '<div id="poststuff">';
|
124 |
|
125 |
do_meta_boxes('edit-user', 'normal', array());
|
128 |
|
129 |
}
|
130 |
|
131 |
+
/*
|
132 |
+
* Admin
|
133 |
+
*/
|
134 |
+
function load_admin($page){
|
135 |
|
136 |
+
$this->add_meta_boxes($page['post_id'], 'acf_options_page');
|
137 |
|
138 |
}
|
139 |
|
140 |
+
/*
|
141 |
+
* Add Meta Boxes
|
142 |
+
*/
|
143 |
+
function add_meta_boxes($post_id = 0, $object_type){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
+
// Get Meta
|
146 |
+
$this->get_meta($post_id);
|
|
|
|
|
|
|
147 |
|
148 |
+
// WP Metabox
|
149 |
if(!empty($this->wp_meta)){
|
150 |
|
151 |
+
$id = 'acfe-wp-custom-fields';
|
152 |
+
$title = 'WP Custom fields <span style="background: #72777c;padding: 1px 5px;border-radius: 4px;color: #fff;margin-left: 3px;font-size: 12px;">' . count($this->wp_meta) . '</span>';
|
153 |
+
$context = 'normal';
|
154 |
+
$priority = 'low';
|
155 |
+
|
156 |
+
add_meta_box($id, $title, array($this, 'wp_render_meta_box'), $object_type, $context, $priority);
|
157 |
|
158 |
}
|
159 |
|
160 |
+
// ACF Metabox
|
161 |
if(!empty($this->acf_meta)){
|
162 |
|
163 |
+
$id = 'acfe-acf-custom-fields';
|
164 |
+
$title = 'ACF Custom fields <span style="background: #72777c;padding: 1px 5px;border-radius: 4px;color: #fff;margin-left: 3px;font-size: 12px;">' . count($this->acf_meta) . '</span>';
|
165 |
+
$context = 'normal';
|
166 |
+
$priority = 'low';
|
167 |
+
|
168 |
+
add_meta_box($id, $title, array($this, 'acf_render_meta_box'), $object_type, $context, $priority);
|
169 |
|
170 |
}
|
171 |
|
223 |
<?php foreach($this->acf_meta as $meta){ ?>
|
224 |
|
225 |
<?php
|
226 |
+
|
227 |
+
// Field
|
228 |
+
$field = $meta['field'];
|
229 |
$meta_key = $meta['key'];
|
230 |
$value = $meta['value'];
|
231 |
|
232 |
+
// Field Group
|
|
|
233 |
$field_group_display = '<span style="color:#aaa;">' . __('Unknown', 'acf') . '</span>';
|
234 |
+
$field_group = $meta['field_group'];
|
235 |
|
236 |
if($field_group){
|
237 |
|
241 |
|
242 |
$post_status = get_post_status($field_group['ID']);
|
243 |
|
244 |
+
if($post_status === 'publish' || $post_status === 'acf-disabled'){
|
245 |
+
|
246 |
$field_group_display = '<a href="' . admin_url('post.php?post=' . $field_group['ID'] . '&action=edit') . '">' . $field_group['title'] . '</a>';
|
247 |
+
|
248 |
+
}
|
249 |
|
250 |
}
|
251 |
|
317 |
|
318 |
}
|
319 |
|
320 |
+
function get_meta($post_id = 0){
|
321 |
+
|
322 |
+
if(!$post_id)
|
323 |
+
$post_id = acf_get_valid_post_id();
|
324 |
+
|
325 |
+
if(empty($post_id))
|
326 |
+
return;
|
327 |
+
|
328 |
+
$info = acf_get_post_id_info($post_id);
|
329 |
+
|
330 |
+
global $wpdb;
|
331 |
+
|
332 |
+
// Post
|
333 |
+
if($info['type'] === 'post'){
|
334 |
+
|
335 |
+
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d ", $info['id']));
|
336 |
+
|
337 |
+
}
|
338 |
+
|
339 |
+
// Term
|
340 |
+
elseif($info['type'] === 'term'){
|
341 |
+
|
342 |
+
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->termmeta WHERE term_id = %d ", $info['id']));
|
343 |
+
|
344 |
+
}
|
345 |
+
|
346 |
+
// User
|
347 |
+
elseif($info['type'] === 'user'){
|
348 |
+
|
349 |
+
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d ", $info['id']));
|
350 |
+
|
351 |
+
}
|
352 |
+
|
353 |
+
// Option
|
354 |
+
elseif($info['type'] === 'option'){
|
355 |
+
|
356 |
+
$id = $info['id'];
|
357 |
+
|
358 |
+
$search = "{$id}_%";
|
359 |
+
$_search = "_{$id}_%";
|
360 |
+
|
361 |
+
$search = str_replace('_', '\_', $search);
|
362 |
+
$_search = str_replace('_', '\_', $_search);
|
363 |
+
|
364 |
+
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s", $search, $_search));
|
365 |
+
|
366 |
+
}
|
367 |
+
|
368 |
+
if(empty($get_meta))
|
369 |
+
return;
|
370 |
+
|
371 |
+
$wp_meta = array();
|
372 |
+
|
373 |
+
// Post / Term / User
|
374 |
+
if($info['type'] !== 'option'){
|
375 |
+
|
376 |
+
usort($get_meta, function($a, $b){
|
377 |
+
return strcmp($a->meta_key, $b->meta_key);
|
378 |
+
});
|
379 |
+
|
380 |
+
foreach($get_meta as $meta){
|
381 |
+
|
382 |
+
$wp_meta[$meta->meta_key] = $meta->meta_value;
|
383 |
+
|
384 |
+
}
|
385 |
+
|
386 |
+
// Option
|
387 |
+
}else{
|
388 |
+
|
389 |
+
usort($get_meta, function($a, $b){
|
390 |
+
return strcmp($a->option_name, $b->option_name);
|
391 |
+
});
|
392 |
+
|
393 |
+
foreach($get_meta as $meta){
|
394 |
+
|
395 |
+
$wp_meta[$meta->option_name] = $meta->option_value;
|
396 |
+
|
397 |
+
}
|
398 |
+
|
399 |
+
}
|
400 |
+
|
401 |
+
$acf_meta = array();
|
402 |
+
|
403 |
+
foreach($wp_meta as $key => $value){
|
404 |
+
|
405 |
+
// ACF Meta
|
406 |
+
if(isset($wp_meta["_$key"])){
|
407 |
+
|
408 |
+
$field = false;
|
409 |
+
$field_group = false;
|
410 |
+
|
411 |
+
if(acf_is_field_key($wp_meta["_$key"])){
|
412 |
+
|
413 |
+
$field = acf_get_field($wp_meta["_$key"]);
|
414 |
+
$field_group = acfe_get_field_group_from_field($field);
|
415 |
+
|
416 |
+
}
|
417 |
+
|
418 |
+
$acf_meta[] = array(
|
419 |
+
'key' => "_$key",
|
420 |
+
'value' => $wp_meta["_$key"],
|
421 |
+
'field' => $field,
|
422 |
+
'field_group' => $field_group,
|
423 |
+
);
|
424 |
+
|
425 |
+
$acf_meta[] = array(
|
426 |
+
'key' => $key,
|
427 |
+
'value' => $wp_meta[$key],
|
428 |
+
'field' => $field,
|
429 |
+
'field_group' => $field_group,
|
430 |
+
);
|
431 |
+
|
432 |
+
unset($wp_meta["_$key"]);
|
433 |
+
unset($wp_meta[$key]);
|
434 |
+
|
435 |
+
}
|
436 |
+
|
437 |
+
}
|
438 |
+
|
439 |
+
$this->wp_meta = $wp_meta;
|
440 |
+
$this->acf_meta = $acf_meta;
|
441 |
+
|
442 |
+
}
|
443 |
+
|
444 |
}
|
445 |
|
446 |
new acfe_dev();
|
includes/modules/dynamic-options-page.php
CHANGED
@@ -238,6 +238,20 @@ function acfe_dop_filter_save($post_id){
|
|
238 |
$update_button = get_field('update_button', $post_id);
|
239 |
$updated_message = get_field('updated_message', $post_id);
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
// Register: Args
|
242 |
$register_args = array(
|
243 |
'page_title' => $page_title,
|
238 |
$update_button = get_field('update_button', $post_id);
|
239 |
$updated_message = get_field('updated_message', $post_id);
|
240 |
|
241 |
+
if(empty($menu_title)){
|
242 |
+
|
243 |
+
$menu_title = $page_title;
|
244 |
+
update_field('menu_title', $menu_title, $post_id);
|
245 |
+
|
246 |
+
}
|
247 |
+
|
248 |
+
if(empty($menu_slug)){
|
249 |
+
|
250 |
+
$menu_slug = sanitize_title($menu_title);
|
251 |
+
update_field('menu_slug', $menu_slug, $post_id);
|
252 |
+
|
253 |
+
}
|
254 |
+
|
255 |
// Register: Args
|
256 |
$register_args = array(
|
257 |
'page_title' => $page_title,
|
includes/modules/form/actions/email.php
CHANGED
@@ -9,13 +9,14 @@ class acfe_form_email{
|
|
9 |
|
10 |
function __construct(){
|
11 |
|
12 |
-
add_action('acfe/form/prepare/email', array($this, '
|
|
|
13 |
|
14 |
add_filter('acf/prepare_field/name=acfe_form_email_file', array(acfe()->acfe_form, 'map_fields_deep'));
|
15 |
|
16 |
}
|
17 |
|
18 |
-
function
|
19 |
|
20 |
$form_name = acf_maybe_get($form, 'form_name');
|
21 |
$form_id = acf_maybe_get($form, 'form_id');
|
@@ -67,26 +68,66 @@ class acfe_form_email{
|
|
67 |
);
|
68 |
|
69 |
$args = apply_filters('acfe/form/submit/email/args', $args, $form, $action);
|
70 |
-
$args = apply_filters('acfe/form/submit/email/args/
|
71 |
-
$args = apply_filters('acfe/form/submit/email/args/id=' . $form_id, $args, $form, $action);
|
72 |
|
73 |
if(!empty($action))
|
74 |
$args = apply_filters('acfe/form/submit/email/args/action=' . $action, $args, $form, $action);
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
if(!$args)
|
77 |
return;
|
78 |
|
79 |
wp_mail($args['to'], $args['subject'], $args['content'], $args['headers'], $args['attachments']);
|
80 |
|
81 |
do_action('acfe/form/submit/email', $args, $form, $action);
|
82 |
-
do_action('acfe/form/submit/email/
|
83 |
-
do_action('acfe/form/submit/email/id=' . $form_id, $args, $form, $action);
|
84 |
|
85 |
if(!empty($action))
|
86 |
do_action('acfe/form/submit/email/action=' . $action, $args, $form, $action);
|
87 |
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
|
92 |
new acfe_form_email();
|
9 |
|
10 |
function __construct(){
|
11 |
|
12 |
+
add_action('acfe/form/prepare/email', array($this, 'prepare'), 1, 3);
|
13 |
+
add_action('acfe/form/submit/email', array($this, 'submit'), 1, 3);
|
14 |
|
15 |
add_filter('acf/prepare_field/name=acfe_form_email_file', array(acfe()->acfe_form, 'map_fields_deep'));
|
16 |
|
17 |
}
|
18 |
|
19 |
+
function prepare($form, $post_id, $action){
|
20 |
|
21 |
$form_name = acf_maybe_get($form, 'form_name');
|
22 |
$form_id = acf_maybe_get($form, 'form_id');
|
68 |
);
|
69 |
|
70 |
$args = apply_filters('acfe/form/submit/email/args', $args, $form, $action);
|
71 |
+
$args = apply_filters('acfe/form/submit/email/args/form=' . $form_name, $args, $form, $action);
|
|
|
72 |
|
73 |
if(!empty($action))
|
74 |
$args = apply_filters('acfe/form/submit/email/args/action=' . $action, $args, $form, $action);
|
75 |
|
76 |
+
// Check if 'from' has changed
|
77 |
+
$new_from = acf_maybe_get($args, 'from');
|
78 |
+
|
79 |
+
// Re-assign header
|
80 |
+
if(!empty($new_from) && $new_from !== $from){
|
81 |
+
|
82 |
+
foreach($args['headers'] as &$header){
|
83 |
+
|
84 |
+
if(stripos($header, 'from:') !== 0)
|
85 |
+
continue;
|
86 |
+
|
87 |
+
$header = 'From: ' . $args['from'];
|
88 |
+
break;
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
if(!$args)
|
95 |
return;
|
96 |
|
97 |
wp_mail($args['to'], $args['subject'], $args['content'], $args['headers'], $args['attachments']);
|
98 |
|
99 |
do_action('acfe/form/submit/email', $args, $form, $action);
|
100 |
+
do_action('acfe/form/submit/email/form=' . $form_name, $args, $form, $action);
|
|
|
101 |
|
102 |
if(!empty($action))
|
103 |
do_action('acfe/form/submit/email/action=' . $action, $args, $form, $action);
|
104 |
|
105 |
}
|
106 |
|
107 |
+
function submit($args, $form, $action){
|
108 |
+
|
109 |
+
if(!empty($action)){
|
110 |
+
|
111 |
+
// Custom Query Var
|
112 |
+
$custom_query_var = get_sub_field('acfe_form_custom_query_var');
|
113 |
+
|
114 |
+
if(!empty($custom_query_var)){
|
115 |
+
|
116 |
+
// Form name
|
117 |
+
$form_name = acf_maybe_get($form, 'form_name');
|
118 |
+
|
119 |
+
$args = apply_filters('acfe/form/query_var/email', $args, $form, $action);
|
120 |
+
$args = apply_filters('acfe/form/query_var/email/form=' . $form_name, $args, $form, $action);
|
121 |
+
$args = apply_filters('acfe/form/query_var/email/action=' . $action, $args, $form, $action);
|
122 |
+
|
123 |
+
set_query_var($action, $args);
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
}
|
130 |
+
|
131 |
}
|
132 |
|
133 |
new acfe_form_email();
|
includes/modules/form/actions/post.php
CHANGED
@@ -14,7 +14,7 @@ class acfe_form_post{
|
|
14 |
*/
|
15 |
add_filter('acfe/form/load/post', array($this, 'load'), 1, 3);
|
16 |
add_action('acfe/form/prepare/post', array($this, 'prepare'), 1, 3);
|
17 |
-
add_action('acfe/form/submit/post', array($this, 'submit'),
|
18 |
|
19 |
/*
|
20 |
* Admin
|
@@ -88,6 +88,9 @@ class acfe_form_post{
|
|
88 |
if(!empty($action))
|
89 |
$_post_id = apply_filters('acfe/form/load/post_id/action=' . $action, $_post_id, $form, $action);
|
90 |
|
|
|
|
|
|
|
91 |
// Invalid Post ID
|
92 |
if(!$_post_id)
|
93 |
return $form;
|
@@ -325,20 +328,19 @@ class acfe_form_post{
|
|
325 |
elseif($post_action === 'update_post'){
|
326 |
|
327 |
// Custom Post ID
|
328 |
-
|
329 |
-
|
330 |
-
$_post_id = $_target;
|
331 |
-
|
332 |
-
}
|
333 |
|
334 |
// Current Post
|
335 |
-
|
336 |
|
337 |
if($post_info['type'] === 'post')
|
338 |
$_post_id = $post_info['id'];
|
339 |
|
340 |
}
|
341 |
|
|
|
|
|
|
|
342 |
}
|
343 |
|
344 |
// Invalid Post ID
|
@@ -499,12 +501,38 @@ class acfe_form_post{
|
|
499 |
do_action('acfe/form/submit/post/form=' . $form_name, $_post_id, $post_action, $args, $form, $action);
|
500 |
|
501 |
if(!empty($action))
|
502 |
-
|
503 |
|
504 |
}
|
505 |
|
506 |
function submit($_post_id, $post_action, $args, $form, $action){
|
507 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
// Meta save
|
509 |
$save_meta = get_sub_field('acfe_form_post_save_meta');
|
510 |
|
14 |
*/
|
15 |
add_filter('acfe/form/load/post', array($this, 'load'), 1, 3);
|
16 |
add_action('acfe/form/prepare/post', array($this, 'prepare'), 1, 3);
|
17 |
+
add_action('acfe/form/submit/post', array($this, 'submit'), 1, 5);
|
18 |
|
19 |
/*
|
20 |
* Admin
|
88 |
if(!empty($action))
|
89 |
$_post_id = apply_filters('acfe/form/load/post_id/action=' . $action, $_post_id, $form, $action);
|
90 |
|
91 |
+
// Query Var
|
92 |
+
$_post_id = acfe_form_map_query_var($_post_id);
|
93 |
+
|
94 |
// Invalid Post ID
|
95 |
if(!$_post_id)
|
96 |
return $form;
|
328 |
elseif($post_action === 'update_post'){
|
329 |
|
330 |
// Custom Post ID
|
331 |
+
$_post_id = $_target;
|
|
|
|
|
|
|
|
|
332 |
|
333 |
// Current Post
|
334 |
+
if($_target === 'current_post'){
|
335 |
|
336 |
if($post_info['type'] === 'post')
|
337 |
$_post_id = $post_info['id'];
|
338 |
|
339 |
}
|
340 |
|
341 |
+
// Query Var
|
342 |
+
$_post_id = acfe_form_map_query_var($_post_id);
|
343 |
+
|
344 |
}
|
345 |
|
346 |
// Invalid Post ID
|
501 |
do_action('acfe/form/submit/post/form=' . $form_name, $_post_id, $post_action, $args, $form, $action);
|
502 |
|
503 |
if(!empty($action))
|
504 |
+
do_action('acfe/form/submit/post/action=' . $action, $_post_id, $post_action, $args, $form, $action);
|
505 |
|
506 |
}
|
507 |
|
508 |
function submit($_post_id, $post_action, $args, $form, $action){
|
509 |
|
510 |
+
if(!empty($action)){
|
511 |
+
|
512 |
+
// Custom Query Var
|
513 |
+
$custom_query_var = get_sub_field('acfe_form_custom_query_var');
|
514 |
+
|
515 |
+
if(!empty($custom_query_var)){
|
516 |
+
|
517 |
+
// Form name
|
518 |
+
$form_name = acf_maybe_get($form, 'form_name');
|
519 |
+
|
520 |
+
// Get post array
|
521 |
+
$post_object = get_post($_post_id, 'ARRAY_A');
|
522 |
+
|
523 |
+
$post_object['permalink'] = get_permalink($_post_id);
|
524 |
+
$post_object['admin_url'] = admin_url('post.php?post=' . $_post_id . '&action=edit');
|
525 |
+
|
526 |
+
$post_object = apply_filters('acfe/form/query_var/post', $post_object, $_post_id, $post_action, $args, $form, $action);
|
527 |
+
$post_object = apply_filters('acfe/form/query_var/post/form=' . $form_name, $post_object, $_post_id, $post_action, $args, $form, $action);
|
528 |
+
$post_object = apply_filters('acfe/form/query_var/post/action=' . $action, $post_object, $_post_id, $post_action, $args, $form, $action);
|
529 |
+
|
530 |
+
set_query_var($action, $post_object);
|
531 |
+
|
532 |
+
}
|
533 |
+
|
534 |
+
}
|
535 |
+
|
536 |
// Meta save
|
537 |
$save_meta = get_sub_field('acfe_form_post_save_meta');
|
538 |
|
includes/modules/form/actions/term.php
CHANGED
@@ -14,7 +14,7 @@ class acfe_form_term{
|
|
14 |
*/
|
15 |
add_filter('acfe/form/load/term', array($this, 'load'), 1, 3);
|
16 |
add_action('acfe/form/prepare/term', array($this, 'prepare'), 1, 3);
|
17 |
-
add_action('acfe/form/submit/term', array($this, 'submit'),
|
18 |
|
19 |
/*
|
20 |
* Admin
|
@@ -34,7 +34,7 @@ class acfe_form_term{
|
|
34 |
|
35 |
}
|
36 |
|
37 |
-
function load($form, $post_id, $
|
38 |
|
39 |
// Form
|
40 |
$form_name = acf_maybe_get($form, 'form_name');
|
@@ -76,11 +76,14 @@ class acfe_form_term{
|
|
76 |
|
77 |
}
|
78 |
|
79 |
-
$_term_id = apply_filters('acfe/form/load/term_id', $_term_id, $form);
|
80 |
-
$_term_id = apply_filters('acfe/form/load/term_id/form=' . $form_name, $_term_id, $form);
|
81 |
|
82 |
-
if(!empty($
|
83 |
-
$_term_id = apply_filters('acfe/form/load/term_id/action=' . $
|
|
|
|
|
|
|
84 |
|
85 |
// Invalid Term ID
|
86 |
if(!$_term_id)
|
@@ -177,7 +180,7 @@ class acfe_form_term{
|
|
177 |
|
178 |
}
|
179 |
|
180 |
-
function prepare($form, $post_id, $
|
181 |
|
182 |
$form_name = acf_maybe_get($form, 'form_name');
|
183 |
$form_id = acf_maybe_get($form, 'form_id');
|
@@ -237,6 +240,9 @@ class acfe_form_term{
|
|
237 |
|
238 |
}
|
239 |
|
|
|
|
|
|
|
240 |
$args['ID'] = $_term_id;
|
241 |
|
242 |
}
|
@@ -305,11 +311,11 @@ class acfe_form_term{
|
|
305 |
|
306 |
}
|
307 |
|
308 |
-
$args = apply_filters('acfe/form/submit/term_args', $args, $term_action, $form);
|
309 |
-
$args = apply_filters('acfe/form/submit/term_args/form=' . $form_name, $args, $term_action, $form);
|
310 |
|
311 |
-
if(!empty($
|
312 |
-
$args = apply_filters('acfe/form/submit/term_args/action=' . $
|
313 |
|
314 |
// Insert Term
|
315 |
if($term_action === 'insert_term'){
|
@@ -345,17 +351,45 @@ class acfe_form_term{
|
|
345 |
|
346 |
$_term_id = $_insert_term['term_id'];
|
347 |
|
|
|
|
|
348 |
// Save meta
|
349 |
-
do_action('acfe/form/submit/term', $_term_id, $term_action, $args, $form);
|
350 |
-
do_action('acfe/form/submit/term/name=' . $form_name, $_term_id, $term_action, $args, $form);
|
351 |
|
352 |
-
if(!empty($
|
353 |
-
do_action('acfe/form/submit/term/action=' . $
|
354 |
|
355 |
}
|
356 |
|
357 |
function submit($_term_id, $term_action, $args, $form, $action){
|
358 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
// Meta save
|
360 |
$save_meta = get_sub_field('acfe_form_term_save_meta');
|
361 |
|
14 |
*/
|
15 |
add_filter('acfe/form/load/term', array($this, 'load'), 1, 3);
|
16 |
add_action('acfe/form/prepare/term', array($this, 'prepare'), 1, 3);
|
17 |
+
add_action('acfe/form/submit/term', array($this, 'submit'), 1, 5);
|
18 |
|
19 |
/*
|
20 |
* Admin
|
34 |
|
35 |
}
|
36 |
|
37 |
+
function load($form, $post_id, $action){
|
38 |
|
39 |
// Form
|
40 |
$form_name = acf_maybe_get($form, 'form_name');
|
76 |
|
77 |
}
|
78 |
|
79 |
+
$_term_id = apply_filters('acfe/form/load/term_id', $_term_id, $form, $action);
|
80 |
+
$_term_id = apply_filters('acfe/form/load/term_id/form=' . $form_name, $_term_id, $form, $action);
|
81 |
|
82 |
+
if(!empty($action))
|
83 |
+
$_term_id = apply_filters('acfe/form/load/term_id/action=' . $action, $_term_id, $form, $action);
|
84 |
+
|
85 |
+
// Query Var
|
86 |
+
$_term_id = acfe_form_map_query_var($_term_id);
|
87 |
|
88 |
// Invalid Term ID
|
89 |
if(!$_term_id)
|
180 |
|
181 |
}
|
182 |
|
183 |
+
function prepare($form, $post_id, $action){
|
184 |
|
185 |
$form_name = acf_maybe_get($form, 'form_name');
|
186 |
$form_id = acf_maybe_get($form, 'form_id');
|
240 |
|
241 |
}
|
242 |
|
243 |
+
// Query Var
|
244 |
+
$_term_id = acfe_form_map_query_var($_term_id);
|
245 |
+
|
246 |
$args['ID'] = $_term_id;
|
247 |
|
248 |
}
|
311 |
|
312 |
}
|
313 |
|
314 |
+
$args = apply_filters('acfe/form/submit/term_args', $args, $term_action, $form, $action);
|
315 |
+
$args = apply_filters('acfe/form/submit/term_args/form=' . $form_name, $args, $term_action, $form, $action);
|
316 |
|
317 |
+
if(!empty($action))
|
318 |
+
$args = apply_filters('acfe/form/submit/term_args/action=' . $action, $args, $term_action, $form, $action);
|
319 |
|
320 |
// Insert Term
|
321 |
if($term_action === 'insert_term'){
|
351 |
|
352 |
$_term_id = $_insert_term['term_id'];
|
353 |
|
354 |
+
$args['ID'] = $_term_id;
|
355 |
+
|
356 |
// Save meta
|
357 |
+
do_action('acfe/form/submit/term', $_term_id, $term_action, $args, $form, $action);
|
358 |
+
do_action('acfe/form/submit/term/name=' . $form_name, $_term_id, $term_action, $args, $form, $action);
|
359 |
|
360 |
+
if(!empty($action))
|
361 |
+
do_action('acfe/form/submit/term/action=' . $action, $_term_id, $term_action, $args, $form, $action);
|
362 |
|
363 |
}
|
364 |
|
365 |
function submit($_term_id, $term_action, $args, $form, $action){
|
366 |
|
367 |
+
if(!empty($action)){
|
368 |
+
|
369 |
+
// Custom Query Var
|
370 |
+
$custom_query_var = get_sub_field('acfe_form_custom_query_var');
|
371 |
+
|
372 |
+
if(!empty($custom_query_var)){
|
373 |
+
|
374 |
+
// Form name
|
375 |
+
$form_name = acf_maybe_get($form, 'form_name');
|
376 |
+
|
377 |
+
// Get term array
|
378 |
+
$term_object = get_term($_term_id, $args['taxonomy'], 'ARRAY_A');
|
379 |
+
|
380 |
+
$term_object['permalink'] = get_term_link($_term_id, $args['taxonomy']);
|
381 |
+
$term_object['admin_url'] = admin_url('post.php?post=' . $_term_id . '&action=edit');
|
382 |
+
|
383 |
+
$term_object = apply_filters('acfe/form/query_var/term', $term_object, $_term_id, $term_action, $args, $form, $action);
|
384 |
+
$term_object = apply_filters('acfe/form/query_var/term/form=' . $form_name, $term_object, $_term_id, $term_action, $args, $form, $action);
|
385 |
+
$term_object = apply_filters('acfe/form/query_var/term/action=' . $action, $term_object, $_term_id, $term_action, $args, $form, $action);
|
386 |
+
|
387 |
+
set_query_var($action, $term_object);
|
388 |
+
|
389 |
+
}
|
390 |
+
|
391 |
+
}
|
392 |
+
|
393 |
// Meta save
|
394 |
$save_meta = get_sub_field('acfe_form_term_save_meta');
|
395 |
|
includes/modules/form/actions/user.php
CHANGED
@@ -14,7 +14,7 @@ class acfe_form_user{
|
|
14 |
*/
|
15 |
add_filter('acfe/form/load/user', array($this, 'load'), 1, 3);
|
16 |
add_action('acfe/form/prepare/user', array($this, 'prepare'), 1, 3);
|
17 |
-
add_action('acfe/form/submit/user', array($this, 'submit'),
|
18 |
|
19 |
/*
|
20 |
* Admin
|
@@ -92,6 +92,9 @@ class acfe_form_user{
|
|
92 |
if(!empty($action))
|
93 |
$_user_id = apply_filters('acfe/form/load/user_id/action=' . $action, $_user_id, $form, $action);
|
94 |
|
|
|
|
|
|
|
95 |
// Invalid User ID
|
96 |
if(!$_user_id)
|
97 |
return $form;
|
@@ -591,6 +594,32 @@ class acfe_form_user{
|
|
591 |
|
592 |
function submit($_user_id, $user_action, $args, $form, $action){
|
593 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
594 |
// Meta save
|
595 |
$save_meta = get_sub_field('acfe_form_user_save_meta');
|
596 |
|
14 |
*/
|
15 |
add_filter('acfe/form/load/user', array($this, 'load'), 1, 3);
|
16 |
add_action('acfe/form/prepare/user', array($this, 'prepare'), 1, 3);
|
17 |
+
add_action('acfe/form/submit/user', array($this, 'submit'), 1, 5);
|
18 |
|
19 |
/*
|
20 |
* Admin
|
92 |
if(!empty($action))
|
93 |
$_user_id = apply_filters('acfe/form/load/user_id/action=' . $action, $_user_id, $form, $action);
|
94 |
|
95 |
+
// Query Var
|
96 |
+
$_user_id = acfe_form_map_query_var($_user_id);
|
97 |
+
|
98 |
// Invalid User ID
|
99 |
if(!$_user_id)
|
100 |
return $form;
|
594 |
|
595 |
function submit($_user_id, $user_action, $args, $form, $action){
|
596 |
|
597 |
+
if(!empty($action)){
|
598 |
+
|
599 |
+
// Custom Query Var
|
600 |
+
$custom_query_var = get_sub_field('acfe_form_custom_query_var');
|
601 |
+
|
602 |
+
if(!empty($custom_query_var)){
|
603 |
+
|
604 |
+
// Form name
|
605 |
+
$form_name = acf_maybe_get($form, 'form_name');
|
606 |
+
|
607 |
+
// Get user array
|
608 |
+
$user_object = get_userdata($_user_id);
|
609 |
+
|
610 |
+
$user_json = json_encode($user_object);
|
611 |
+
$user_array = json_decode($user_json, true);
|
612 |
+
|
613 |
+
$user_array = apply_filters('acfe/form/query_var/user', $user_array, $_user_id, $user_action, $args, $form, $action);
|
614 |
+
$user_array = apply_filters('acfe/form/query_var/user/form=' . $form_name, $user_array, $_user_id, $user_action, $args, $form, $action);
|
615 |
+
$user_array = apply_filters('acfe/form/query_var/user/action=' . $action, $user_array, $_user_id, $user_action, $args, $form, $action);
|
616 |
+
|
617 |
+
set_query_var($action, $user_array);
|
618 |
+
|
619 |
+
}
|
620 |
+
|
621 |
+
}
|
622 |
+
|
623 |
// Meta save
|
624 |
$save_meta = get_sub_field('acfe_form_user_save_meta');
|
625 |
|
includes/modules/form/admin.php
CHANGED
@@ -44,7 +44,7 @@ class acfe_form{
|
|
44 |
add_filter('acfe/form/format_value/type=checkbox', array($this, 'format_value_select'), 5, 4);
|
45 |
add_filter('acfe/form/format_value/type=radio', array($this, 'format_value_select'), 5, 4);
|
46 |
|
47 |
-
// Posts
|
48 |
$this->posts = array(
|
49 |
'acfe_form_post_save_target',
|
50 |
'acfe_form_post_save_post_parent',
|
@@ -57,20 +57,7 @@ class acfe_form{
|
|
57 |
|
58 |
}
|
59 |
|
60 |
-
//
|
61 |
-
$this->users = array(
|
62 |
-
'acfe_form_post_save_post_author',
|
63 |
-
'acfe_form_user_save_target',
|
64 |
-
'acfe_form_user_load_source',
|
65 |
-
);
|
66 |
-
|
67 |
-
foreach($this->users as $tag){
|
68 |
-
|
69 |
-
add_filter('acf/prepare_field/name=' . $tag, array($this, 'prepare_value_user'));
|
70 |
-
|
71 |
-
}
|
72 |
-
|
73 |
-
// Terms
|
74 |
$this->terms = array(
|
75 |
'acfe_form_term_save_target',
|
76 |
'acfe_form_term_save_parent',
|
@@ -83,6 +70,19 @@ class acfe_form{
|
|
83 |
|
84 |
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
// Ajax
|
87 |
add_action('wp_ajax_acf/fields/select/query', array($this, 'ajax_query_post'), 5);
|
88 |
add_action('wp_ajax_nopriv_acf/fields/select/query', array($this, 'ajax_query_post'), 5);
|
@@ -987,7 +987,7 @@ class acfe_form{
|
|
987 |
$acf = $_POST['acf'];
|
988 |
|
989 |
if(!$acf)
|
990 |
-
|
991 |
|
992 |
$data = $this->map_fields_values($acf);
|
993 |
|
@@ -1011,6 +1011,33 @@ class acfe_form{
|
|
1011 |
// Content
|
1012 |
else{
|
1013 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1014 |
// Match {field:key}
|
1015 |
if(preg_match_all('/{field:(.*?)}/', $content, $matches)){
|
1016 |
|
@@ -1312,6 +1339,9 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1312 |
|
1313 |
}
|
1314 |
|
|
|
|
|
|
|
1315 |
function admin_columns($columns){
|
1316 |
|
1317 |
if(isset($columns['date']))
|
@@ -1326,6 +1356,9 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1326 |
|
1327 |
}
|
1328 |
|
|
|
|
|
|
|
1329 |
function admin_columns_html($column, $post_id){
|
1330 |
|
1331 |
// Name
|
@@ -1493,6 +1526,9 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1493 |
|
1494 |
}
|
1495 |
|
|
|
|
|
|
|
1496 |
function ajax_query_post(){
|
1497 |
|
1498 |
if(!acf_verify_ajax())
|
@@ -1517,7 +1553,8 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1517 |
'post_id' => 0,
|
1518 |
's' => '',
|
1519 |
'field_key' => '',
|
1520 |
-
'paged' => 1
|
|
|
1521 |
));
|
1522 |
|
1523 |
// load field
|
@@ -1565,14 +1602,25 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1565 |
|
1566 |
if(!$is_search && $args['paged'] === 1){
|
1567 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1568 |
$results[] = array(
|
1569 |
'text' => 'Generic',
|
1570 |
-
'children' =>
|
1571 |
-
array(
|
1572 |
-
'id' => 'current_post',
|
1573 |
-
'text' => 'Current Post',
|
1574 |
-
)
|
1575 |
-
)
|
1576 |
);
|
1577 |
|
1578 |
}
|
@@ -1636,12 +1684,22 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1636 |
|
1637 |
}
|
1638 |
|
|
|
|
|
|
|
1639 |
function prepare_value_post($field){
|
1640 |
|
1641 |
if(!acf_maybe_get($field, 'value'))
|
1642 |
return $field;
|
1643 |
|
1644 |
$field['choices'] = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1645 |
$field['choices']['current_post'] = 'Current Post';
|
1646 |
|
1647 |
$field_type = acf_get_field_type('post_object');
|
@@ -1668,13 +1726,16 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1668 |
|
1669 |
}
|
1670 |
|
1671 |
-
|
|
|
|
|
|
|
1672 |
|
1673 |
if(!acf_verify_ajax())
|
1674 |
die();
|
1675 |
|
1676 |
// get choices
|
1677 |
-
$response = $this->
|
1678 |
|
1679 |
// return
|
1680 |
if(!$response)
|
@@ -1685,28 +1746,26 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1685 |
|
1686 |
}
|
1687 |
|
1688 |
-
function
|
1689 |
|
1690 |
// defaults
|
1691 |
$options = acf_parse_args($options, array(
|
1692 |
'post_id' => 0,
|
1693 |
's' => '',
|
1694 |
'field_key' => '',
|
1695 |
-
'paged' => 1
|
|
|
1696 |
));
|
1697 |
|
1698 |
-
|
1699 |
// load field
|
1700 |
$field = acf_get_field($options['field_key']);
|
1701 |
if(!$field)
|
1702 |
return false;
|
1703 |
|
1704 |
// Target field name
|
1705 |
-
if(!in_array($field['name'], $this->
|
1706 |
return false;
|
1707 |
|
1708 |
-
$field_type = acf_get_field_type('user');
|
1709 |
-
|
1710 |
// vars
|
1711 |
$results = array();
|
1712 |
$args = array();
|
@@ -1714,7 +1773,7 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1714 |
$is_search = false;
|
1715 |
|
1716 |
// paged
|
1717 |
-
$args['
|
1718 |
$args['paged'] = $options['paged'];
|
1719 |
|
1720 |
// search
|
@@ -1729,102 +1788,81 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1729 |
|
1730 |
}
|
1731 |
|
1732 |
-
|
1733 |
-
|
|
|
|
|
1734 |
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
|
1739 |
-
//
|
1740 |
-
if($
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
|
1745 |
-
|
1746 |
-
$field_type->field = $field;
|
1747 |
|
1748 |
-
|
1749 |
-
|
|
|
|
|
1750 |
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
|
|
1758 |
|
1759 |
$results[] = array(
|
1760 |
'text' => 'Generic',
|
1761 |
-
'children' =>
|
1762 |
-
array(
|
1763 |
-
'id' => 'current_user',
|
1764 |
-
'text' => 'Current User',
|
1765 |
-
),
|
1766 |
-
array(
|
1767 |
-
'id' => 'current_post_author',
|
1768 |
-
'text' => 'Current Post Author',
|
1769 |
-
),
|
1770 |
-
)
|
1771 |
);
|
1772 |
|
1773 |
}
|
1774 |
|
1775 |
// loop
|
1776 |
-
|
1777 |
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
foreach( array_keys($users) as $user_id ) {
|
1789 |
-
|
1790 |
-
$users[ $user_id ] = $field_type->get_result( $users[ $user_id ], $field, $options['post_id'] );
|
1791 |
-
|
1792 |
-
};
|
1793 |
-
|
1794 |
-
// order by search
|
1795 |
-
if( $is_search && empty($args['orderby']) ) {
|
1796 |
-
|
1797 |
-
$users = acf_order_by_search( $users, $args['s'] );
|
1798 |
-
|
1799 |
-
}
|
1800 |
-
|
1801 |
-
// append to $data
|
1802 |
-
foreach( $users as $id => $title ) {
|
1803 |
-
|
1804 |
-
$data['children'][] = array(
|
1805 |
-
'id' => $id,
|
1806 |
-
'text' => $title
|
1807 |
-
);
|
1808 |
-
|
1809 |
-
}
|
1810 |
|
1811 |
-
|
1812 |
-
$results[] = $data;
|
1813 |
|
1814 |
}
|
1815 |
|
1816 |
-
//
|
1817 |
-
|
1818 |
|
1819 |
-
$
|
|
|
|
|
|
|
1820 |
|
1821 |
}
|
|
|
|
|
|
|
|
|
1822 |
}
|
1823 |
|
1824 |
// vars
|
1825 |
$response = array(
|
1826 |
'results' => $results,
|
1827 |
-
'limit' => $args['
|
1828 |
);
|
1829 |
|
1830 |
// return
|
@@ -1832,31 +1870,34 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1832 |
|
1833 |
}
|
1834 |
|
1835 |
-
|
|
|
|
|
|
|
1836 |
|
1837 |
if(!acf_maybe_get($field, 'value'))
|
1838 |
return $field;
|
1839 |
|
|
|
|
|
1840 |
$field['choices'] = array();
|
1841 |
-
$field['choices']['current_user'] = 'Current User';
|
1842 |
-
$field['choices']['current_post_author'] = 'Current Post Author';
|
1843 |
|
1844 |
-
$
|
|
|
|
|
|
|
|
|
1845 |
|
1846 |
-
|
1847 |
-
$user_ids = array_map('intval', acf_array($field['value']));
|
1848 |
|
1849 |
-
|
1850 |
-
|
1851 |
-
'include' => $user_ids
|
1852 |
-
));
|
1853 |
|
1854 |
-
|
1855 |
-
|
|
|
1856 |
|
1857 |
-
|
1858 |
-
$field['choices'][$user->ID] = $field_type->get_result($user, $field);
|
1859 |
-
}
|
1860 |
|
1861 |
}
|
1862 |
|
@@ -1864,13 +1905,16 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1864 |
|
1865 |
}
|
1866 |
|
1867 |
-
|
|
|
|
|
|
|
1868 |
|
1869 |
if(!acf_verify_ajax())
|
1870 |
die();
|
1871 |
|
1872 |
// get choices
|
1873 |
-
$response = $this->
|
1874 |
|
1875 |
// return
|
1876 |
if(!$response)
|
@@ -1881,25 +1925,29 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1881 |
|
1882 |
}
|
1883 |
|
1884 |
-
function
|
1885 |
|
1886 |
// defaults
|
1887 |
$options = acf_parse_args($options, array(
|
1888 |
'post_id' => 0,
|
1889 |
's' => '',
|
1890 |
'field_key' => '',
|
1891 |
-
'paged' => 1
|
|
|
1892 |
));
|
1893 |
|
|
|
1894 |
// load field
|
1895 |
$field = acf_get_field($options['field_key']);
|
1896 |
if(!$field)
|
1897 |
return false;
|
1898 |
|
1899 |
// Target field name
|
1900 |
-
if(!in_array($field['name'], $this->
|
1901 |
return false;
|
1902 |
|
|
|
|
|
1903 |
// vars
|
1904 |
$results = array();
|
1905 |
$args = array();
|
@@ -1907,7 +1955,7 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1907 |
$is_search = false;
|
1908 |
|
1909 |
// paged
|
1910 |
-
$args['
|
1911 |
$args['paged'] = $options['paged'];
|
1912 |
|
1913 |
// search
|
@@ -1922,70 +1970,113 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1922 |
|
1923 |
}
|
1924 |
|
1925 |
-
|
1926 |
-
|
1927 |
-
'offset' => ($args['paged'] - 1) * $args['posts_per_page'],
|
1928 |
-
);
|
1929 |
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
|
1934 |
-
//
|
1935 |
-
if(
|
1936 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1937 |
|
1938 |
if(!$is_search && $args['paged'] === 1){
|
1939 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1940 |
$results[] = array(
|
1941 |
'text' => 'Generic',
|
1942 |
-
'children' =>
|
1943 |
-
array(
|
1944 |
-
'id' => 'current_term',
|
1945 |
-
'text' => 'Current Term',
|
1946 |
-
)
|
1947 |
-
)
|
1948 |
);
|
1949 |
|
1950 |
}
|
1951 |
|
1952 |
// loop
|
1953 |
-
|
1954 |
-
|
1955 |
-
// vars
|
1956 |
-
$terms = acf_extract_var($groups, $group_title);
|
1957 |
-
|
1958 |
-
// data
|
1959 |
-
$data = array(
|
1960 |
-
'text' => $group_title,
|
1961 |
-
'children' => array()
|
1962 |
-
);
|
1963 |
|
1964 |
-
|
1965 |
|
1966 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1967 |
|
1968 |
}
|
1969 |
|
1970 |
-
//
|
1971 |
-
|
1972 |
|
1973 |
-
$
|
1974 |
-
'id' => $term_id,
|
1975 |
-
'text' => $name
|
1976 |
-
);
|
1977 |
|
1978 |
}
|
1979 |
-
|
1980 |
-
// append to $results
|
1981 |
-
$results[] = $data;
|
1982 |
-
|
1983 |
}
|
1984 |
|
1985 |
// vars
|
1986 |
$response = array(
|
1987 |
'results' => $results,
|
1988 |
-
'limit' => $args['
|
1989 |
);
|
1990 |
|
1991 |
// return
|
@@ -1993,24 +2084,41 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1993 |
|
1994 |
}
|
1995 |
|
1996 |
-
|
|
|
|
|
|
|
1997 |
|
1998 |
if(!acf_maybe_get($field, 'value'))
|
1999 |
return $field;
|
2000 |
|
2001 |
-
$value = $field['value'];
|
2002 |
-
|
2003 |
$field['choices'] = array();
|
2004 |
-
$field['choices']['current_term'] = 'Current Term';
|
2005 |
|
2006 |
-
if(
|
2007 |
-
|
|
|
|
|
|
|
2008 |
|
2009 |
-
$
|
|
|
2010 |
|
2011 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012 |
|
2013 |
-
$
|
|
|
|
|
2014 |
|
2015 |
}
|
2016 |
|
@@ -2047,4 +2155,43 @@ function acfe_form_filter_meta($meta, $acf){
|
|
2047 |
|
2048 |
return acfe()->acfe_form->filter_meta($meta, $acf);
|
2049 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2050 |
}
|
44 |
add_filter('acfe/form/format_value/type=checkbox', array($this, 'format_value_select'), 5, 4);
|
45 |
add_filter('acfe/form/format_value/type=radio', array($this, 'format_value_select'), 5, 4);
|
46 |
|
47 |
+
// Posts Actions
|
48 |
$this->posts = array(
|
49 |
'acfe_form_post_save_target',
|
50 |
'acfe_form_post_save_post_parent',
|
57 |
|
58 |
}
|
59 |
|
60 |
+
// Terms Actions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
$this->terms = array(
|
62 |
'acfe_form_term_save_target',
|
63 |
'acfe_form_term_save_parent',
|
70 |
|
71 |
}
|
72 |
|
73 |
+
// Users Actions
|
74 |
+
$this->users = array(
|
75 |
+
'acfe_form_post_save_post_author',
|
76 |
+
'acfe_form_user_save_target',
|
77 |
+
'acfe_form_user_load_source',
|
78 |
+
);
|
79 |
+
|
80 |
+
foreach($this->users as $tag){
|
81 |
+
|
82 |
+
add_filter('acf/prepare_field/name=' . $tag, array($this, 'prepare_value_user'));
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
// Ajax
|
87 |
add_action('wp_ajax_acf/fields/select/query', array($this, 'ajax_query_post'), 5);
|
88 |
add_action('wp_ajax_nopriv_acf/fields/select/query', array($this, 'ajax_query_post'), 5);
|
987 |
$acf = $_POST['acf'];
|
988 |
|
989 |
if(!$acf)
|
990 |
+
$acf = array();
|
991 |
|
992 |
$data = $this->map_fields_values($acf);
|
993 |
|
1011 |
// Content
|
1012 |
else{
|
1013 |
|
1014 |
+
// Match {query_var:name}
|
1015 |
+
if(preg_match_all('/{query_var:(.*?)}/', $content, $matches)){
|
1016 |
+
|
1017 |
+
foreach($matches[1] as $i => $name){
|
1018 |
+
|
1019 |
+
$query_var = get_query_var($name);
|
1020 |
+
|
1021 |
+
if(strpos($name, ':') !== false){
|
1022 |
+
|
1023 |
+
$explode = explode(':', $name);
|
1024 |
+
|
1025 |
+
$query_var = get_query_var($explode[0]);
|
1026 |
+
|
1027 |
+
if(is_array($query_var) && isset($query_var[$explode[1]])){
|
1028 |
+
|
1029 |
+
$query_var = $query_var[$explode[1]];
|
1030 |
+
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
}
|
1034 |
+
|
1035 |
+
$content = str_replace('{query_var:' . $name . '}', $query_var, $content);
|
1036 |
+
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
}
|
1040 |
+
|
1041 |
// Match {field:key}
|
1042 |
if(preg_match_all('/{field:(.*?)}/', $content, $matches)){
|
1043 |
|
1339 |
|
1340 |
}
|
1341 |
|
1342 |
+
/**
|
1343 |
+
* List: Columns
|
1344 |
+
*/
|
1345 |
function admin_columns($columns){
|
1346 |
|
1347 |
if(isset($columns['date']))
|
1356 |
|
1357 |
}
|
1358 |
|
1359 |
+
/**
|
1360 |
+
* List: Columns HTML
|
1361 |
+
*/
|
1362 |
function admin_columns_html($column, $post_id){
|
1363 |
|
1364 |
// Name
|
1526 |
|
1527 |
}
|
1528 |
|
1529 |
+
/**
|
1530 |
+
* Post: Select2 Ajax
|
1531 |
+
*/
|
1532 |
function ajax_query_post(){
|
1533 |
|
1534 |
if(!acf_verify_ajax())
|
1553 |
'post_id' => 0,
|
1554 |
's' => '',
|
1555 |
'field_key' => '',
|
1556 |
+
'paged' => 1,
|
1557 |
+
'value' => '',
|
1558 |
));
|
1559 |
|
1560 |
// load field
|
1602 |
|
1603 |
if(!$is_search && $args['paged'] === 1){
|
1604 |
|
1605 |
+
$children = array();
|
1606 |
+
|
1607 |
+
$children[] = array(
|
1608 |
+
'id' => 'current_post',
|
1609 |
+
'text' => 'Current Post',
|
1610 |
+
);
|
1611 |
+
|
1612 |
+
if(!empty($options['value']) && is_string($options['value']) && !is_numeric($options['value']) && $options['value'] !== 'current_post'){
|
1613 |
+
|
1614 |
+
$children[] = array(
|
1615 |
+
'id' => $options['value'],
|
1616 |
+
'text' => $options['value'],
|
1617 |
+
);
|
1618 |
+
|
1619 |
+
}
|
1620 |
+
|
1621 |
$results[] = array(
|
1622 |
'text' => 'Generic',
|
1623 |
+
'children' => $children
|
|
|
|
|
|
|
|
|
|
|
1624 |
);
|
1625 |
|
1626 |
}
|
1684 |
|
1685 |
}
|
1686 |
|
1687 |
+
/**
|
1688 |
+
* Post: Select2 Choices
|
1689 |
+
*/
|
1690 |
function prepare_value_post($field){
|
1691 |
|
1692 |
if(!acf_maybe_get($field, 'value'))
|
1693 |
return $field;
|
1694 |
|
1695 |
$field['choices'] = array();
|
1696 |
+
|
1697 |
+
if(!empty($field['value']) && is_string($field['value']) && !is_numeric($field['value']) && $field['value'] !== 'current_post'){
|
1698 |
+
|
1699 |
+
$field['choices'][$field['value']] = $field['value'];
|
1700 |
+
|
1701 |
+
}
|
1702 |
+
|
1703 |
$field['choices']['current_post'] = 'Current Post';
|
1704 |
|
1705 |
$field_type = acf_get_field_type('post_object');
|
1726 |
|
1727 |
}
|
1728 |
|
1729 |
+
/**
|
1730 |
+
* Term: Select2 Ajax
|
1731 |
+
*/
|
1732 |
+
function ajax_query_term(){
|
1733 |
|
1734 |
if(!acf_verify_ajax())
|
1735 |
die();
|
1736 |
|
1737 |
// get choices
|
1738 |
+
$response = $this->get_ajax_query_term($_POST);
|
1739 |
|
1740 |
// return
|
1741 |
if(!$response)
|
1746 |
|
1747 |
}
|
1748 |
|
1749 |
+
function get_ajax_query_term($options = array()){
|
1750 |
|
1751 |
// defaults
|
1752 |
$options = acf_parse_args($options, array(
|
1753 |
'post_id' => 0,
|
1754 |
's' => '',
|
1755 |
'field_key' => '',
|
1756 |
+
'paged' => 1,
|
1757 |
+
'value' => '',
|
1758 |
));
|
1759 |
|
|
|
1760 |
// load field
|
1761 |
$field = acf_get_field($options['field_key']);
|
1762 |
if(!$field)
|
1763 |
return false;
|
1764 |
|
1765 |
// Target field name
|
1766 |
+
if(!in_array($field['name'], $this->terms))
|
1767 |
return false;
|
1768 |
|
|
|
|
|
1769 |
// vars
|
1770 |
$results = array();
|
1771 |
$args = array();
|
1773 |
$is_search = false;
|
1774 |
|
1775 |
// paged
|
1776 |
+
$args['posts_per_page'] = 20;
|
1777 |
$args['paged'] = $options['paged'];
|
1778 |
|
1779 |
// search
|
1788 |
|
1789 |
}
|
1790 |
|
1791 |
+
$terms_args = array(
|
1792 |
+
'number' => $args['posts_per_page'],
|
1793 |
+
'offset' => ($args['paged'] - 1) * $args['posts_per_page'],
|
1794 |
+
);
|
1795 |
|
1796 |
+
// get grouped terms
|
1797 |
+
$terms = acf_get_grouped_terms($terms_args);
|
1798 |
+
$groups = acf_get_choices_from_grouped_terms($terms, 'name');
|
1799 |
|
1800 |
+
// bail early if no posts
|
1801 |
+
if(empty($groups))
|
1802 |
+
return false;
|
1803 |
+
|
1804 |
+
if(!$is_search && $args['paged'] === 1){
|
1805 |
|
1806 |
+
$children = array();
|
|
|
1807 |
|
1808 |
+
$children[] = array(
|
1809 |
+
'id' => 'current_term',
|
1810 |
+
'text' => 'Current Term',
|
1811 |
+
);
|
1812 |
|
1813 |
+
if(!empty($options['value']) && is_string($options['value']) && !is_numeric($options['value']) && $options['value'] !== 'current_term'){
|
1814 |
+
|
1815 |
+
$children[] = array(
|
1816 |
+
'id' => $options['value'],
|
1817 |
+
'text' => $options['value'],
|
1818 |
+
);
|
1819 |
+
|
1820 |
+
}
|
1821 |
|
1822 |
$results[] = array(
|
1823 |
'text' => 'Generic',
|
1824 |
+
'children' => $children
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1825 |
);
|
1826 |
|
1827 |
}
|
1828 |
|
1829 |
// loop
|
1830 |
+
foreach(array_keys($groups) as $group_title){
|
1831 |
|
1832 |
+
// vars
|
1833 |
+
$terms = acf_extract_var($groups, $group_title);
|
1834 |
+
|
1835 |
+
// data
|
1836 |
+
$data = array(
|
1837 |
+
'text' => $group_title,
|
1838 |
+
'children' => array()
|
1839 |
+
);
|
1840 |
+
|
1841 |
+
if($is_search && empty($args['orderby'])){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1842 |
|
1843 |
+
$terms = acf_order_by_search($terms, $args['s']);
|
|
|
1844 |
|
1845 |
}
|
1846 |
|
1847 |
+
// append to $data
|
1848 |
+
foreach($terms as $term_id => $name){
|
1849 |
|
1850 |
+
$data['children'][] = array(
|
1851 |
+
'id' => $term_id,
|
1852 |
+
'text' => $name
|
1853 |
+
);
|
1854 |
|
1855 |
}
|
1856 |
+
|
1857 |
+
// append to $results
|
1858 |
+
$results[] = $data;
|
1859 |
+
|
1860 |
}
|
1861 |
|
1862 |
// vars
|
1863 |
$response = array(
|
1864 |
'results' => $results,
|
1865 |
+
'limit' => $args['posts_per_page']
|
1866 |
);
|
1867 |
|
1868 |
// return
|
1870 |
|
1871 |
}
|
1872 |
|
1873 |
+
/**
|
1874 |
+
* Term: Select2 Choices
|
1875 |
+
*/
|
1876 |
+
function prepare_value_term($field){
|
1877 |
|
1878 |
if(!acf_maybe_get($field, 'value'))
|
1879 |
return $field;
|
1880 |
|
1881 |
+
$value = $field['value'];
|
1882 |
+
|
1883 |
$field['choices'] = array();
|
|
|
|
|
1884 |
|
1885 |
+
if(!empty($field['value']) && is_string($field['value']) && !is_numeric($field['value']) && $field['value'] !== 'current_term'){
|
1886 |
+
|
1887 |
+
$field['choices'][$field['value']] = $field['value'];
|
1888 |
+
|
1889 |
+
}
|
1890 |
|
1891 |
+
$field['choices']['current_term'] = 'Current Term';
|
|
|
1892 |
|
1893 |
+
if(is_array($value))
|
1894 |
+
$value = $value[0];
|
|
|
|
|
1895 |
|
1896 |
+
$term = get_term($value);
|
1897 |
+
|
1898 |
+
if($term){
|
1899 |
|
1900 |
+
$field['choices'][$term->term_id] = $term->name;
|
|
|
|
|
1901 |
|
1902 |
}
|
1903 |
|
1905 |
|
1906 |
}
|
1907 |
|
1908 |
+
/**
|
1909 |
+
* User: Select2 Ajax
|
1910 |
+
*/
|
1911 |
+
function ajax_query_user(){
|
1912 |
|
1913 |
if(!acf_verify_ajax())
|
1914 |
die();
|
1915 |
|
1916 |
// get choices
|
1917 |
+
$response = $this->get_ajax_query_user($_POST);
|
1918 |
|
1919 |
// return
|
1920 |
if(!$response)
|
1925 |
|
1926 |
}
|
1927 |
|
1928 |
+
function get_ajax_query_user($options = array()){
|
1929 |
|
1930 |
// defaults
|
1931 |
$options = acf_parse_args($options, array(
|
1932 |
'post_id' => 0,
|
1933 |
's' => '',
|
1934 |
'field_key' => '',
|
1935 |
+
'paged' => 1,
|
1936 |
+
'value' => '',
|
1937 |
));
|
1938 |
|
1939 |
+
|
1940 |
// load field
|
1941 |
$field = acf_get_field($options['field_key']);
|
1942 |
if(!$field)
|
1943 |
return false;
|
1944 |
|
1945 |
// Target field name
|
1946 |
+
if(!in_array($field['name'], $this->users))
|
1947 |
return false;
|
1948 |
|
1949 |
+
$field_type = acf_get_field_type('user');
|
1950 |
+
|
1951 |
// vars
|
1952 |
$results = array();
|
1953 |
$args = array();
|
1955 |
$is_search = false;
|
1956 |
|
1957 |
// paged
|
1958 |
+
$args['users_per_page'] = 20;
|
1959 |
$args['paged'] = $options['paged'];
|
1960 |
|
1961 |
// search
|
1970 |
|
1971 |
}
|
1972 |
|
1973 |
+
// role
|
1974 |
+
if(!empty($field['role'])){
|
|
|
|
|
1975 |
|
1976 |
+
$args['role'] = acf_get_array( $field['role'] );
|
1977 |
+
|
1978 |
+
}
|
1979 |
|
1980 |
+
// search
|
1981 |
+
if($is_search){
|
1982 |
+
|
1983 |
+
// append to $args
|
1984 |
+
$args['search'] = '*' . $options['s'] . '*';
|
1985 |
+
|
1986 |
+
// add reference
|
1987 |
+
$field_type->field = $field;
|
1988 |
+
|
1989 |
+
// add filter to modify search colums
|
1990 |
+
add_filter('user_search_columns', array($field_type, 'user_search_columns'), 10, 3);
|
1991 |
+
|
1992 |
+
}
|
1993 |
+
|
1994 |
+
// get users
|
1995 |
+
$groups = acf_get_grouped_users($args);
|
1996 |
|
1997 |
if(!$is_search && $args['paged'] === 1){
|
1998 |
|
1999 |
+
$children = array();
|
2000 |
+
|
2001 |
+
$children[] = array(
|
2002 |
+
'id' => 'current_user',
|
2003 |
+
'text' => 'Current User',
|
2004 |
+
);
|
2005 |
+
|
2006 |
+
$children[] = array(
|
2007 |
+
'id' => 'current_post_author',
|
2008 |
+
'text' => 'Current Post Author',
|
2009 |
+
);
|
2010 |
+
|
2011 |
+
if(!empty($options['value']) && is_string($options['value']) && !is_numeric($options['value']) && $options['value'] !== 'current_user' && $options['value'] !== 'current_post_author'){
|
2012 |
+
|
2013 |
+
$children[] = array(
|
2014 |
+
'id' => $options['value'],
|
2015 |
+
'text' => $options['value'],
|
2016 |
+
);
|
2017 |
+
|
2018 |
+
}
|
2019 |
+
|
2020 |
$results[] = array(
|
2021 |
'text' => 'Generic',
|
2022 |
+
'children' => $children
|
|
|
|
|
|
|
|
|
|
|
2023 |
);
|
2024 |
|
2025 |
}
|
2026 |
|
2027 |
// loop
|
2028 |
+
if(!empty($groups)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2029 |
|
2030 |
+
foreach(array_keys($groups) as $group_title){
|
2031 |
|
2032 |
+
// vars
|
2033 |
+
$users = acf_extract_var( $groups, $group_title );
|
2034 |
+
$data = array(
|
2035 |
+
'text' => $group_title,
|
2036 |
+
'children' => array()
|
2037 |
+
);
|
2038 |
+
|
2039 |
+
// append users
|
2040 |
+
foreach( array_keys($users) as $user_id ) {
|
2041 |
+
|
2042 |
+
$users[ $user_id ] = $field_type->get_result( $users[ $user_id ], $field, $options['post_id'] );
|
2043 |
+
|
2044 |
+
};
|
2045 |
+
|
2046 |
+
// order by search
|
2047 |
+
if( $is_search && empty($args['orderby']) ) {
|
2048 |
+
|
2049 |
+
$users = acf_order_by_search( $users, $args['s'] );
|
2050 |
+
|
2051 |
+
}
|
2052 |
+
|
2053 |
+
// append to $data
|
2054 |
+
foreach( $users as $id => $title ) {
|
2055 |
+
|
2056 |
+
$data['children'][] = array(
|
2057 |
+
'id' => $id,
|
2058 |
+
'text' => $title
|
2059 |
+
);
|
2060 |
+
|
2061 |
+
}
|
2062 |
+
|
2063 |
+
// append to $r
|
2064 |
+
$results[] = $data;
|
2065 |
|
2066 |
}
|
2067 |
|
2068 |
+
// optgroup or single
|
2069 |
+
if(!empty($args['role']) && count($args['role']) == 1){
|
2070 |
|
2071 |
+
$results = $results[0]['children'];
|
|
|
|
|
|
|
2072 |
|
2073 |
}
|
|
|
|
|
|
|
|
|
2074 |
}
|
2075 |
|
2076 |
// vars
|
2077 |
$response = array(
|
2078 |
'results' => $results,
|
2079 |
+
'limit' => $args['users_per_page']
|
2080 |
);
|
2081 |
|
2082 |
// return
|
2084 |
|
2085 |
}
|
2086 |
|
2087 |
+
/**
|
2088 |
+
* User: Select2 Choices
|
2089 |
+
*/
|
2090 |
+
function prepare_value_user($field){
|
2091 |
|
2092 |
if(!acf_maybe_get($field, 'value'))
|
2093 |
return $field;
|
2094 |
|
|
|
|
|
2095 |
$field['choices'] = array();
|
|
|
2096 |
|
2097 |
+
if(!empty($field['value']) && is_string($field['value']) && !is_numeric($field['value']) && $field['value'] !== 'current_term' && $field['value'] !== 'current_post_author'){
|
2098 |
+
|
2099 |
+
$field['choices'][$field['value']] = $field['value'];
|
2100 |
+
|
2101 |
+
}
|
2102 |
|
2103 |
+
$field['choices']['current_user'] = 'Current User';
|
2104 |
+
$field['choices']['current_post_author'] = 'Current Post Author';
|
2105 |
|
2106 |
+
$field_type = acf_get_field_type('user');
|
2107 |
+
|
2108 |
+
// Clean value into an array of IDs.
|
2109 |
+
$user_ids = array_map('intval', acf_array($field['value']));
|
2110 |
+
|
2111 |
+
// Find users in database (ensures all results are real).
|
2112 |
+
$users = acf_get_users(array(
|
2113 |
+
'include' => $user_ids
|
2114 |
+
));
|
2115 |
+
|
2116 |
+
// Append.
|
2117 |
+
if($users){
|
2118 |
|
2119 |
+
foreach($users as $user){
|
2120 |
+
$field['choices'][$user->ID] = $field_type->get_result($user, $field);
|
2121 |
+
}
|
2122 |
|
2123 |
}
|
2124 |
|
2155 |
|
2156 |
return acfe()->acfe_form->filter_meta($meta, $acf);
|
2157 |
|
2158 |
+
}
|
2159 |
+
|
2160 |
+
function acfe_form_map_query_var($content){
|
2161 |
+
|
2162 |
+
if(empty($content))
|
2163 |
+
return $content;
|
2164 |
+
|
2165 |
+
if(strpos($content, '{query_var:') === false)
|
2166 |
+
return $content;
|
2167 |
+
|
2168 |
+
// Match {query_var:name}
|
2169 |
+
if(preg_match_all('/{query_var:(.*?)}/', $content, $matches)){
|
2170 |
+
|
2171 |
+
foreach($matches[1] as $i => $name){
|
2172 |
+
|
2173 |
+
$query_var = get_query_var($name);
|
2174 |
+
|
2175 |
+
if(strpos($name, ':') !== false){
|
2176 |
+
|
2177 |
+
$explode = explode(':', $name);
|
2178 |
+
|
2179 |
+
$query_var = get_query_var($explode[0]);
|
2180 |
+
|
2181 |
+
if(is_array($query_var) && isset($query_var[$explode[1]])){
|
2182 |
+
|
2183 |
+
$query_var = $query_var[$explode[1]];
|
2184 |
+
|
2185 |
+
}
|
2186 |
+
|
2187 |
+
}
|
2188 |
+
|
2189 |
+
$content = str_replace('{query_var:' . $name . '}', $query_var, $content);
|
2190 |
+
|
2191 |
+
}
|
2192 |
+
|
2193 |
+
}
|
2194 |
+
|
2195 |
+
return $content;
|
2196 |
+
|
2197 |
}
|
includes/modules/form/field-group.php
CHANGED
@@ -547,7 +547,7 @@ acf_add_local_field_group(array(
|
|
547 |
'label' => 'Success message',
|
548 |
'name' => 'acfe_form_updated_message',
|
549 |
'type' => 'wysiwyg',
|
550 |
-
'instructions' => 'A message displayed above the form after being redirected. Can also be empty for no message.<br /><br />You may use <code>{field:field_name}</code>
|
551 |
'required' => 0,
|
552 |
'conditional_logic' => 0,
|
553 |
'wrapper' => array(
|
@@ -607,9 +607,7 @@ acf_add_local_field_group(array(
|
|
607 |
'label' => 'Redirection',
|
608 |
'name' => 'acfe_form_return',
|
609 |
'type' => 'text',
|
610 |
-
'instructions' => 'The URL to be redirected to after the form is submit. Defaults to the current URL.<br /><br />
|
611 |
-
A special placeholder <code>%post_url%</code> will be converted to post\'s permalink (handy if creating a new post)<br /><br />
|
612 |
-
A special placeholder <code>%post_id%</code> will be converted to post\'s ID (handy if creating a new post)<br />',
|
613 |
'required' => 0,
|
614 |
'conditional_logic' => 0,
|
615 |
'wrapper' => array(
|
@@ -666,8 +664,8 @@ acf_add_local_field_group(array(
|
|
666 |
'acfe_flexible_modal' => array(
|
667 |
'acfe_flexible_modal_enabled' => '0',
|
668 |
),
|
669 |
-
'acfe_flexible_layouts_state' => '
|
670 |
-
'acfe_flexible_layouts_remove_collapse' =>
|
671 |
'layouts' => array(
|
672 |
|
673 |
/*
|
@@ -713,31 +711,12 @@ acf_add_local_field_group(array(
|
|
713 |
'label' => 'Email action',
|
714 |
'display' => 'row',
|
715 |
'sub_fields' => array(
|
716 |
-
array(
|
717 |
-
'key' => 'field_acfe_form_email_instructions',
|
718 |
-
'label' => 'Instructions',
|
719 |
-
'name' => '',
|
720 |
-
'type' => 'message',
|
721 |
-
'instructions' => '',
|
722 |
-
'required' => 0,
|
723 |
-
'conditional_logic' => 0,
|
724 |
-
'wrapper' => array(
|
725 |
-
'width' => '',
|
726 |
-
'class' => '',
|
727 |
-
'id' => '',
|
728 |
-
),
|
729 |
-
'acfe_permissions' => '',
|
730 |
-
'message' => 'Fields may be included using <code>{field:field_key}</code> or <code>{field:title}</code>.<br />
|
731 |
-
All fields may be included using <code>{fields}</code>.',
|
732 |
-
'new_lines' => '',
|
733 |
-
'esc_html' => 0,
|
734 |
-
),
|
735 |
array(
|
736 |
'key' => 'field_acfe_form_email_custom_alias',
|
737 |
-
'label' => 'Action
|
738 |
'name' => 'acfe_form_custom_alias',
|
739 |
'type' => 'acfe_slug',
|
740 |
-
'instructions' => '',
|
741 |
'required' => 0,
|
742 |
'conditional_logic' => 0,
|
743 |
'wrapper' => array(
|
@@ -752,6 +731,34 @@ acf_add_local_field_group(array(
|
|
752 |
'append' => '',
|
753 |
'maxlength' => '',
|
754 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
755 |
array(
|
756 |
'key' => 'field_acfe_form_email_from',
|
757 |
'label' => 'From',
|
@@ -816,7 +823,7 @@ acf_add_local_field_group(array(
|
|
816 |
'label' => 'Content',
|
817 |
'name' => 'acfe_form_email_content',
|
818 |
'type' => 'wysiwyg',
|
819 |
-
'instructions' => '',
|
820 |
'required' => 1,
|
821 |
'conditional_logic' => 0,
|
822 |
'wrapper' => array(
|
@@ -1070,10 +1077,10 @@ acf_add_local_field_group(array(
|
|
1070 |
),
|
1071 |
array(
|
1072 |
'key' => 'field_acfe_form_post_custom_alias',
|
1073 |
-
'label' => 'Action
|
1074 |
'name' => 'acfe_form_custom_alias',
|
1075 |
'type' => 'acfe_slug',
|
1076 |
-
'instructions' => '',
|
1077 |
'required' => 0,
|
1078 |
'conditional_logic' => 0,
|
1079 |
'wrapper' => array(
|
@@ -1088,12 +1095,40 @@ acf_add_local_field_group(array(
|
|
1088 |
'append' => '',
|
1089 |
'maxlength' => '',
|
1090 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1091 |
array(
|
1092 |
'key' => 'field_acfe_form_post_save_target',
|
1093 |
'label' => 'Target',
|
1094 |
'name' => 'acfe_form_post_save_target',
|
1095 |
'type' => 'select',
|
1096 |
-
'instructions' => '',
|
1097 |
'required' => 0,
|
1098 |
'conditional_logic' => array(
|
1099 |
array(
|
@@ -1781,7 +1816,7 @@ acf_add_local_field_group(array(
|
|
1781 |
'label' => 'Values Source',
|
1782 |
'name' => 'acfe_form_post_load_source',
|
1783 |
'type' => 'select',
|
1784 |
-
'instructions' => '',
|
1785 |
'required' => 0,
|
1786 |
'conditional_logic' => array(
|
1787 |
array(
|
@@ -2182,10 +2217,10 @@ acf_add_local_field_group(array(
|
|
2182 |
),
|
2183 |
array(
|
2184 |
'key' => 'field_acfe_form_term_custom_alias',
|
2185 |
-
'label' => 'Action
|
2186 |
'name' => 'acfe_form_custom_alias',
|
2187 |
'type' => 'acfe_slug',
|
2188 |
-
'instructions' => '',
|
2189 |
'required' => 0,
|
2190 |
'conditional_logic' => 0,
|
2191 |
'wrapper' => array(
|
@@ -2200,12 +2235,40 @@ acf_add_local_field_group(array(
|
|
2200 |
'append' => '',
|
2201 |
'maxlength' => '',
|
2202 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2203 |
array(
|
2204 |
'key' => 'field_acfe_form_term_save_target',
|
2205 |
'label' => 'Target',
|
2206 |
'name' => 'acfe_form_term_save_target',
|
2207 |
'type' => 'select',
|
2208 |
-
'instructions' => '',
|
2209 |
'required' => 0,
|
2210 |
'conditional_logic' => array(
|
2211 |
array(
|
@@ -2721,7 +2784,7 @@ acf_add_local_field_group(array(
|
|
2721 |
'label' => 'Values Source',
|
2722 |
'name' => 'acfe_form_term_load_source',
|
2723 |
'type' => 'select',
|
2724 |
-
'instructions' => '',
|
2725 |
'required' => 0,
|
2726 |
'conditional_logic' => array(
|
2727 |
array(
|
@@ -3047,10 +3110,10 @@ acf_add_local_field_group(array(
|
|
3047 |
),
|
3048 |
array(
|
3049 |
'key' => 'field_acfe_form_user_custom_alias',
|
3050 |
-
'label' => 'Action
|
3051 |
'name' => 'acfe_form_custom_alias',
|
3052 |
'type' => 'acfe_slug',
|
3053 |
-
'instructions' => '',
|
3054 |
'required' => 0,
|
3055 |
'conditional_logic' => 0,
|
3056 |
'wrapper' => array(
|
@@ -3065,12 +3128,40 @@ acf_add_local_field_group(array(
|
|
3065 |
'append' => '',
|
3066 |
'maxlength' => '',
|
3067 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3068 |
array(
|
3069 |
'key' => 'field_acfe_form_user_save_target',
|
3070 |
'label' => 'Target',
|
3071 |
'name' => 'acfe_form_user_save_target',
|
3072 |
'type' => 'select',
|
3073 |
-
'instructions' => '',
|
3074 |
'required' => 0,
|
3075 |
'conditional_logic' => array(
|
3076 |
array(
|
@@ -4150,7 +4241,7 @@ acf_add_local_field_group(array(
|
|
4150 |
'label' => 'Values Source',
|
4151 |
'name' => 'acfe_form_user_load_source',
|
4152 |
'type' => 'select',
|
4153 |
-
'instructions' => '',
|
4154 |
'required' => 0,
|
4155 |
'conditional_logic' => array(
|
4156 |
array(
|
547 |
'label' => 'Success message',
|
548 |
'name' => 'acfe_form_updated_message',
|
549 |
'type' => 'wysiwyg',
|
550 |
+
'instructions' => 'A message displayed above the form after being redirected. Can also be empty for no message.<br /><br />You may use <code>{field:field_name}</code> <code>{field:field_key}</code> <code>{query_var:name}</code> <code>{query_var:name:key}</code>.',
|
551 |
'required' => 0,
|
552 |
'conditional_logic' => 0,
|
553 |
'wrapper' => array(
|
607 |
'label' => 'Redirection',
|
608 |
'name' => 'acfe_form_return',
|
609 |
'type' => 'text',
|
610 |
+
'instructions' => 'The URL to be redirected to after the form is submit. Defaults to the current URL.<br /><br />You may use <code>{field:field_name}</code> <code>{field:field_key}</code> <code>{query_var:name}</code> <code>{query_var:name:key}</code>.',
|
|
|
|
|
611 |
'required' => 0,
|
612 |
'conditional_logic' => 0,
|
613 |
'wrapper' => array(
|
664 |
'acfe_flexible_modal' => array(
|
665 |
'acfe_flexible_modal_enabled' => '0',
|
666 |
),
|
667 |
+
'acfe_flexible_layouts_state' => '',
|
668 |
+
'acfe_flexible_layouts_remove_collapse' => 0,
|
669 |
'layouts' => array(
|
670 |
|
671 |
/*
|
711 |
'label' => 'Email action',
|
712 |
'display' => 'row',
|
713 |
'sub_fields' => array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
714 |
array(
|
715 |
'key' => 'field_acfe_form_email_custom_alias',
|
716 |
+
'label' => 'Action name',
|
717 |
'name' => 'acfe_form_custom_alias',
|
718 |
'type' => 'acfe_slug',
|
719 |
+
'instructions' => '(Optional) Advanced usage. Allow the action to be targeted specifically with PHP hooks (must be unique). See "Advanced" tab.',
|
720 |
'required' => 0,
|
721 |
'conditional_logic' => 0,
|
722 |
'wrapper' => array(
|
731 |
'append' => '',
|
732 |
'maxlength' => '',
|
733 |
),
|
734 |
+
array(
|
735 |
+
'key' => 'field_acfe_form_email_custom_query_var',
|
736 |
+
'label' => 'Query var',
|
737 |
+
'name' => 'acfe_form_custom_query_var',
|
738 |
+
'type' => 'true_false',
|
739 |
+
'instructions' => 'Automatically create a query var with the data of the email that has been sent.<br />Retrieve data using <code>{query_var:my-action:subject}</code> template tags.',
|
740 |
+
'required' => 0,
|
741 |
+
'conditional_logic' => 0,
|
742 |
+
'wrapper' => array(
|
743 |
+
'width' => '',
|
744 |
+
'class' => '',
|
745 |
+
'id' => '',
|
746 |
+
),
|
747 |
+
'acfe_permissions' => '',
|
748 |
+
'message' => '',
|
749 |
+
'default_value' => 0,
|
750 |
+
'ui' => 1,
|
751 |
+
'ui_on_text' => '',
|
752 |
+
'ui_off_text' => '',
|
753 |
+
'conditional_logic' => array(
|
754 |
+
array(
|
755 |
+
array(
|
756 |
+
'field' => 'field_acfe_form_email_custom_alias',
|
757 |
+
'operator' => '!=empty',
|
758 |
+
),
|
759 |
+
),
|
760 |
+
),
|
761 |
+
),
|
762 |
array(
|
763 |
'key' => 'field_acfe_form_email_from',
|
764 |
'label' => 'From',
|
823 |
'label' => 'Content',
|
824 |
'name' => 'acfe_form_email_content',
|
825 |
'type' => 'wysiwyg',
|
826 |
+
'instructions' => 'Fields values may be included using <code>{field:field_key}</code> <code>{field:title}</code>.<br />All fields may be included using <code>{fields}</code>.<br /><br />You can access Posts, Terms or Users that were created or updated with actions using query_vars.<br />Available template tags: <code>{query_var:my-post-action:post_title}</code> <code>{query_var:my-post-action:permalink}</code>.',
|
827 |
'required' => 1,
|
828 |
'conditional_logic' => 0,
|
829 |
'wrapper' => array(
|
1077 |
),
|
1078 |
array(
|
1079 |
'key' => 'field_acfe_form_post_custom_alias',
|
1080 |
+
'label' => 'Action name',
|
1081 |
'name' => 'acfe_form_custom_alias',
|
1082 |
'type' => 'acfe_slug',
|
1083 |
+
'instructions' => '(Optional) Advanced usage. Allow the action to be targeted specifically with PHP hooks (must be unique). See "Advanced" tab.',
|
1084 |
'required' => 0,
|
1085 |
'conditional_logic' => 0,
|
1086 |
'wrapper' => array(
|
1095 |
'append' => '',
|
1096 |
'maxlength' => '',
|
1097 |
),
|
1098 |
+
array(
|
1099 |
+
'key' => 'field_acfe_form_post_custom_query_var',
|
1100 |
+
'label' => 'Query var',
|
1101 |
+
'name' => 'acfe_form_custom_query_var',
|
1102 |
+
'type' => 'true_false',
|
1103 |
+
'instructions' => 'Automatically create a query var with the data of the post that has been created/updated.<br />Retrieve data using <code>{query_var:my-action:post_title}</code> <code>{query_var:my-action:permalink}</code> template tags.',
|
1104 |
+
'required' => 0,
|
1105 |
+
'conditional_logic' => 0,
|
1106 |
+
'wrapper' => array(
|
1107 |
+
'width' => '',
|
1108 |
+
'class' => '',
|
1109 |
+
'id' => '',
|
1110 |
+
),
|
1111 |
+
'acfe_permissions' => '',
|
1112 |
+
'message' => '',
|
1113 |
+
'default_value' => 0,
|
1114 |
+
'ui' => 1,
|
1115 |
+
'ui_on_text' => '',
|
1116 |
+
'ui_off_text' => '',
|
1117 |
+
'conditional_logic' => array(
|
1118 |
+
array(
|
1119 |
+
array(
|
1120 |
+
'field' => 'field_acfe_form_post_custom_alias',
|
1121 |
+
'operator' => '!=empty',
|
1122 |
+
),
|
1123 |
+
),
|
1124 |
+
),
|
1125 |
+
),
|
1126 |
array(
|
1127 |
'key' => 'field_acfe_form_post_save_target',
|
1128 |
'label' => 'Target',
|
1129 |
'name' => 'acfe_form_post_save_target',
|
1130 |
'type' => 'select',
|
1131 |
+
'instructions' => 'Available template tags: <code>{query_var:my-var}</code> <code>{query_var:my-var:my-key}</code>',
|
1132 |
'required' => 0,
|
1133 |
'conditional_logic' => array(
|
1134 |
array(
|
1816 |
'label' => 'Values Source',
|
1817 |
'name' => 'acfe_form_post_load_source',
|
1818 |
'type' => 'select',
|
1819 |
+
'instructions' => 'Available template tags: <code>{query_var:my-var}</code> <code>{query_var:my-var:my-key}</code>',
|
1820 |
'required' => 0,
|
1821 |
'conditional_logic' => array(
|
1822 |
array(
|
2217 |
),
|
2218 |
array(
|
2219 |
'key' => 'field_acfe_form_term_custom_alias',
|
2220 |
+
'label' => 'Action name',
|
2221 |
'name' => 'acfe_form_custom_alias',
|
2222 |
'type' => 'acfe_slug',
|
2223 |
+
'instructions' => '(Optional) Advanced usage. Allow the action to be targeted specifically with PHP hooks (must be unique). See "Advanced" tab.',
|
2224 |
'required' => 0,
|
2225 |
'conditional_logic' => 0,
|
2226 |
'wrapper' => array(
|
2235 |
'append' => '',
|
2236 |
'maxlength' => '',
|
2237 |
),
|
2238 |
+
array(
|
2239 |
+
'key' => 'field_acfe_form_term_custom_query_var',
|
2240 |
+
'label' => 'Query var',
|
2241 |
+
'name' => 'acfe_form_custom_query_var',
|
2242 |
+
'type' => 'true_false',
|
2243 |
+
'instructions' => 'Automatically create a query var with the data of the term that has been created/updated.<br />Retrieve data using <code>{query_var:my-action:name}</code> <code>{query_var:my-action:permalink}</code> template tags.',
|
2244 |
+
'required' => 0,
|
2245 |
+
'conditional_logic' => 0,
|
2246 |
+
'wrapper' => array(
|
2247 |
+
'width' => '',
|
2248 |
+
'class' => '',
|
2249 |
+
'id' => '',
|
2250 |
+
),
|
2251 |
+
'acfe_permissions' => '',
|
2252 |
+
'message' => '',
|
2253 |
+
'default_value' => 0,
|
2254 |
+
'ui' => 1,
|
2255 |
+
'ui_on_text' => '',
|
2256 |
+
'ui_off_text' => '',
|
2257 |
+
'conditional_logic' => array(
|
2258 |
+
array(
|
2259 |
+
array(
|
2260 |
+
'field' => 'field_acfe_form_term_custom_alias',
|
2261 |
+
'operator' => '!=empty',
|
2262 |
+
),
|
2263 |
+
),
|
2264 |
+
),
|
2265 |
+
),
|
2266 |
array(
|
2267 |
'key' => 'field_acfe_form_term_save_target',
|
2268 |
'label' => 'Target',
|
2269 |
'name' => 'acfe_form_term_save_target',
|
2270 |
'type' => 'select',
|
2271 |
+
'instructions' => 'Available template tags: <code>{query_var:my-var}</code> <code>{query_var:my-var:my-key}</code>',
|
2272 |
'required' => 0,
|
2273 |
'conditional_logic' => array(
|
2274 |
array(
|
2784 |
'label' => 'Values Source',
|
2785 |
'name' => 'acfe_form_term_load_source',
|
2786 |
'type' => 'select',
|
2787 |
+
'instructions' => 'Available template tags: <code>{query_var:my-var}</code> <code>{query_var:my-var:my-key}</code>',
|
2788 |
'required' => 0,
|
2789 |
'conditional_logic' => array(
|
2790 |
array(
|
3110 |
),
|
3111 |
array(
|
3112 |
'key' => 'field_acfe_form_user_custom_alias',
|
3113 |
+
'label' => 'Action name',
|
3114 |
'name' => 'acfe_form_custom_alias',
|
3115 |
'type' => 'acfe_slug',
|
3116 |
+
'instructions' => '(Optional) Advanced usage. Allow the action to be targeted specifically with PHP hooks (must be unique). See "Advanced" tab.',
|
3117 |
'required' => 0,
|
3118 |
'conditional_logic' => 0,
|
3119 |
'wrapper' => array(
|
3128 |
'append' => '',
|
3129 |
'maxlength' => '',
|
3130 |
),
|
3131 |
+
array(
|
3132 |
+
'key' => 'field_acfe_form_user_custom_query_var',
|
3133 |
+
'label' => 'Query var',
|
3134 |
+
'name' => 'acfe_form_custom_query_var',
|
3135 |
+
'type' => 'true_false',
|
3136 |
+
'instructions' => 'Automatically create a query var with the data of the user that has been created/updated.<br />Retrieve data using <code>{query_var:my-action:display_name}</code> template tags.',
|
3137 |
+
'required' => 0,
|
3138 |
+
'conditional_logic' => 0,
|
3139 |
+
'wrapper' => array(
|
3140 |
+
'width' => '',
|
3141 |
+
'class' => '',
|
3142 |
+
'id' => '',
|
3143 |
+
),
|
3144 |
+
'acfe_permissions' => '',
|
3145 |
+
'message' => '',
|
3146 |
+
'default_value' => 0,
|
3147 |
+
'ui' => 1,
|
3148 |
+
'ui_on_text' => '',
|
3149 |
+
'ui_off_text' => '',
|
3150 |
+
'conditional_logic' => array(
|
3151 |
+
array(
|
3152 |
+
array(
|
3153 |
+
'field' => 'field_acfe_form_user_custom_alias',
|
3154 |
+
'operator' => '!=empty',
|
3155 |
+
),
|
3156 |
+
),
|
3157 |
+
),
|
3158 |
+
),
|
3159 |
array(
|
3160 |
'key' => 'field_acfe_form_user_save_target',
|
3161 |
'label' => 'Target',
|
3162 |
'name' => 'acfe_form_user_save_target',
|
3163 |
'type' => 'select',
|
3164 |
+
'instructions' => 'Available template tags: <code>{query_var:my-var}</code> <code>{query_var:my-var:my-key}</code>',
|
3165 |
'required' => 0,
|
3166 |
'conditional_logic' => array(
|
3167 |
array(
|
4241 |
'label' => 'Values Source',
|
4242 |
'name' => 'acfe_form_user_load_source',
|
4243 |
'type' => 'select',
|
4244 |
+
'instructions' => 'Available template tags: <code>{query_var:my-var}</code> <code>{query_var:my-var:my-key}</code>',
|
4245 |
'required' => 0,
|
4246 |
'conditional_logic' => array(
|
4247 |
array(
|
includes/modules/form/form-front.php
CHANGED
@@ -129,22 +129,20 @@ class acfe_form_front{
|
|
129 |
do_action('acfe/form/submit/form=' . $form_name, $form, $post_id);
|
130 |
|
131 |
acf_reset_meta('acfe_form_submit');
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
}
|
148 |
|
149 |
}
|
150 |
|
@@ -153,8 +151,8 @@ class acfe_form_front{
|
|
153 |
$form_name = false;
|
154 |
$form_id = false;
|
155 |
|
156 |
-
//
|
157 |
-
if(
|
158 |
|
159 |
$form = get_page_by_path($param, OBJECT, 'acfe-form');
|
160 |
if(!$form)
|
@@ -166,8 +164,8 @@ class acfe_form_front{
|
|
166 |
|
167 |
}
|
168 |
|
169 |
-
//
|
170 |
-
|
171 |
|
172 |
if(get_post_type($param) !== 'acfe-form')
|
173 |
return false;
|
@@ -449,8 +447,11 @@ class acfe_form_front{
|
|
449 |
|
450 |
$message = $args['updated_message'];
|
451 |
|
452 |
-
if(acf_maybe_get_POST('acf'))
|
|
|
453 |
$message = acfe_form_map_field_value($args['updated_message'], $_POST['acf']);
|
|
|
|
|
454 |
|
455 |
if(!empty($args['html_updated_message'])){
|
456 |
|
@@ -594,7 +595,7 @@ class acfe_form_front{
|
|
594 |
|
595 |
$atts = shortcode_atts(array(
|
596 |
'name' => false,
|
597 |
-
'
|
598 |
), $atts, 'acfe_form');
|
599 |
|
600 |
if(!empty($atts['name'])){
|
@@ -607,11 +608,11 @@ class acfe_form_front{
|
|
607 |
|
608 |
}
|
609 |
|
610 |
-
if(!empty($atts['
|
611 |
|
612 |
ob_start();
|
613 |
|
614 |
-
acfe_form($atts['
|
615 |
|
616 |
return ob_get_clean();
|
617 |
|
129 |
do_action('acfe/form/submit/form=' . $form_name, $form, $post_id);
|
130 |
|
131 |
acf_reset_meta('acfe_form_submit');
|
132 |
+
|
133 |
+
// vars
|
134 |
+
$return = acf_maybe_get($form, 'return', '');
|
135 |
+
|
136 |
+
// redirect
|
137 |
+
if($return){
|
138 |
+
|
139 |
+
$return = acfe_form_map_field_value($return, $_POST['acf']);
|
140 |
+
|
141 |
+
// redirect
|
142 |
+
wp_redirect($return);
|
143 |
+
exit;
|
144 |
+
|
145 |
+
}
|
|
|
|
|
146 |
|
147 |
}
|
148 |
|
151 |
$form_name = false;
|
152 |
$form_id = false;
|
153 |
|
154 |
+
// Name
|
155 |
+
if(!is_numeric($param)){
|
156 |
|
157 |
$form = get_page_by_path($param, OBJECT, 'acfe-form');
|
158 |
if(!$form)
|
164 |
|
165 |
}
|
166 |
|
167 |
+
// ID
|
168 |
+
else{
|
169 |
|
170 |
if(get_post_type($param) !== 'acfe-form')
|
171 |
return false;
|
447 |
|
448 |
$message = $args['updated_message'];
|
449 |
|
450 |
+
if(acf_maybe_get_POST('acf')){
|
451 |
+
|
452 |
$message = acfe_form_map_field_value($args['updated_message'], $_POST['acf']);
|
453 |
+
|
454 |
+
}
|
455 |
|
456 |
if(!empty($args['html_updated_message'])){
|
457 |
|
595 |
|
596 |
$atts = shortcode_atts(array(
|
597 |
'name' => false,
|
598 |
+
'id' => false
|
599 |
), $atts, 'acfe_form');
|
600 |
|
601 |
if(!empty($atts['name'])){
|
608 |
|
609 |
}
|
610 |
|
611 |
+
if(!empty($atts['id'])){
|
612 |
|
613 |
ob_start();
|
614 |
|
615 |
+
acfe_form($atts['id']);
|
616 |
|
617 |
return ob_get_clean();
|
618 |
|
includes/modules/single-meta.php
CHANGED
@@ -62,6 +62,12 @@ class acfe_single_meta{
|
|
62 |
if(!$validate)
|
63 |
return $value;
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
// Get store
|
66 |
$store = acf_get_store('acfe/meta');
|
67 |
|
@@ -75,12 +81,12 @@ class acfe_single_meta{
|
|
75 |
}else{
|
76 |
|
77 |
// Submitting acf/save_post
|
78 |
-
|
79 |
-
if(acf_maybe_get_POST('acf')){
|
80 |
|
|
|
81 |
$acf = array();
|
82 |
|
83 |
-
// Single update
|
84 |
}else{
|
85 |
|
86 |
// Get ACF meta
|
@@ -96,8 +102,12 @@ class acfe_single_meta{
|
|
96 |
$acf['_' . $field['name']] = $field['key'];
|
97 |
$acf[$field['name']] = $value;
|
98 |
|
99 |
-
// Save to ACF meta
|
100 |
-
|
|
|
|
|
|
|
|
|
101 |
|
102 |
// Set Store: ACF meta
|
103 |
$store->set("$post_id:acf", $acf);
|
@@ -265,36 +275,46 @@ class acfe_single_meta{
|
|
265 |
*/
|
266 |
function save_post($post_id = 0){
|
267 |
|
268 |
-
|
|
|
|
|
|
|
269 |
return;
|
270 |
|
271 |
-
//
|
272 |
-
|
273 |
|
274 |
-
//
|
275 |
-
if($
|
276 |
return;
|
277 |
|
278 |
-
|
279 |
-
|
280 |
-
return;
|
281 |
|
282 |
-
|
283 |
-
|
284 |
-
return;
|
285 |
|
286 |
-
|
287 |
|
288 |
-
|
289 |
-
if(!isset($meta["_$key"]))
|
290 |
-
continue;
|
291 |
|
292 |
-
if(
|
293 |
-
|
294 |
-
|
295 |
-
acf_delete_metadata($post_id, $key);
|
296 |
-
acf_delete_metadata($post_id, $key, true);
|
297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
}
|
299 |
|
300 |
}
|
62 |
if(!$validate)
|
63 |
return $value;
|
64 |
|
65 |
+
$is_save_post = false;
|
66 |
+
|
67 |
+
// Submitting acf/save_post
|
68 |
+
if(acf_maybe_get_POST('acf'))
|
69 |
+
$is_save_post = true;
|
70 |
+
|
71 |
// Get store
|
72 |
$store = acf_get_store('acfe/meta');
|
73 |
|
81 |
}else{
|
82 |
|
83 |
// Submitting acf/save_post
|
84 |
+
if($is_save_post){
|
|
|
85 |
|
86 |
+
// Resetting values to empty
|
87 |
$acf = array();
|
88 |
|
89 |
+
// Single field update
|
90 |
}else{
|
91 |
|
92 |
// Get ACF meta
|
102 |
$acf['_' . $field['name']] = $field['key'];
|
103 |
$acf[$field['name']] = $value;
|
104 |
|
105 |
+
// Single field update: Save to ACF meta
|
106 |
+
if(!$is_save_post){
|
107 |
+
|
108 |
+
acf_update_metadata($post_id, 'acf', $acf);
|
109 |
+
|
110 |
+
}
|
111 |
|
112 |
// Set Store: ACF meta
|
113 |
$store->set("$post_id:acf", $acf);
|
275 |
*/
|
276 |
function save_post($post_id = 0){
|
277 |
|
278 |
+
// Validate Post ID
|
279 |
+
$validate = $this->validate_post_id($post_id);
|
280 |
+
|
281 |
+
if(!$validate)
|
282 |
return;
|
283 |
|
284 |
+
// Check store.
|
285 |
+
$store = acf_get_store('acfe/meta');
|
286 |
|
287 |
+
// Store found
|
288 |
+
if(!$store->has("$post_id:acf"))
|
289 |
return;
|
290 |
|
291 |
+
// Get Store: ACF meta
|
292 |
+
$acf = $store->get("$post_id:acf");
|
|
|
293 |
|
294 |
+
// Save to ACF meta
|
295 |
+
acf_update_metadata($post_id, 'acf', $acf);
|
|
|
296 |
|
297 |
+
if(acf_maybe_get_POST('acfe_clean_meta')){
|
298 |
|
299 |
+
$meta = acf_get_meta($post_id);
|
|
|
|
|
300 |
|
301 |
+
if(empty($meta))
|
302 |
+
return;
|
|
|
|
|
|
|
303 |
|
304 |
+
foreach($meta as $key => $value){
|
305 |
+
|
306 |
+
// bail if reference key does not exist
|
307 |
+
if(!isset($meta["_$key"]))
|
308 |
+
continue;
|
309 |
+
|
310 |
+
if(isset($acf[$key]))
|
311 |
+
continue;
|
312 |
+
|
313 |
+
acf_delete_metadata($post_id, $key);
|
314 |
+
acf_delete_metadata($post_id, $key, true);
|
315 |
+
|
316 |
+
}
|
317 |
+
|
318 |
}
|
319 |
|
320 |
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: acf, custom fields, meta, admin, fields, form, repeater, content
|
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 0.8.4.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -94,6 +94,9 @@ Display raw field group data in a modal to check your configuration & settings
|
|
94 |
* **Custom key**
|
95 |
Set custom field group key. ie: `group_custom_name`
|
96 |
|
|
|
|
|
|
|
97 |
* **Advanced settings**
|
98 |
Enable advanced fields settings & validation based on screen (administration/front-end). See fields advanced settings/validation
|
99 |
|
@@ -168,13 +171,13 @@ Display raw field data in a modal to check your configuration & settings
|
|
168 |
= ACF: Fields =
|
169 |
|
170 |
* **Field Clone: Edit in modal**
|
171 |
-
Allow users to edit clone fields in a modal
|
172 |
|
173 |
* **Field File: Uploader type**
|
174 |
Choose the uploader type: Basic or native WP uploader
|
175 |
|
176 |
* **Field Group: Edit in modal**
|
177 |
-
Allow users to edit group fields in a modal
|
178 |
|
179 |
* **Field Image: Use as Featured Thumbnail**
|
180 |
Choose if an image field should be considered as post featured thumbnail
|
@@ -206,7 +209,7 @@ Switch font family to monospace and allow tab indent
|
|
206 |
Display a modern Link Selection in a modal. Post selection can be filtered via post types & taxonomies terms. Add custom fields using `filter('acfe/fields/advanced_link/fields', $fields, $field, $link)`
|
207 |
|
208 |
* **New Field: Button**
|
209 |
-
Display a custom submit or button. Built-in ajax call
|
210 |
|
211 |
* **New Field: Code Editor**
|
212 |
Edit code using the native WP Core Codemirror library
|
@@ -289,7 +292,7 @@ Display all ACF Extended settings in one page.
|
|
289 |
|
290 |
= ACF: Dev Mode =
|
291 |
|
292 |
-
View all custom Posts, Terms &
|
293 |
|
294 |
* Print Arrays & Json values
|
295 |
* ACF fields meta are grouped together
|
@@ -331,12 +334,14 @@ Manage ACF Block Types from ACF > Block Types.
|
|
331 |
* Modal Selection Title: Change the layout modal title
|
332 |
* Modal Selection Columns: Change the layout modal columns grid. 1, 2, 3, 4, 5 or 6 columns available
|
333 |
* Modal Selection Categories: Add category for each layout in the layout modal
|
|
|
334 |
* Layouts State: Force layouts to be collapsed or opened by default
|
335 |
* Layouts Collapse: Remove collapse action
|
|
|
|
|
|
|
336 |
* Button Label: Supports Dashicons icons elments `<span>`
|
337 |
* One Click: the 'Add row' button will add a layout without the selection modal if there is only one layout available in the flexible content
|
338 |
-
* Lock Flexible Content: Disable sortable layouts using `filter('acfe/flexible/lock/name=my_flexible', true, $field)`
|
339 |
-
* Remove Actions Buttons: Remove the action buttons using `filter('acfe/flexible/remove_actions/name=my_flexible', true, $field)`
|
340 |
* Asynchronous Layouts: Add layouts using Ajax method. This setting increase performance on complex Flexible Content
|
341 |
* Disable Legacy Layout Title Ajax: Disable the native ACF Layout Title Ajax call on `acf/fields/flexible_content/layout_title`.
|
342 |
|
@@ -678,6 +683,40 @@ function my_acfe_modules(){
|
|
678 |
|
679 |
== Changelog ==
|
680 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
681 |
= 0.8.4.1 =
|
682 |
* General: Fixed loading sequence when `get_field` was called directly in the functions file
|
683 |
* Field: Flexible Content - Fixed Dynamic Preview overlay z-index
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 0.8.4.5
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
94 |
* **Custom key**
|
95 |
Set custom field group key. ie: `group_custom_name`
|
96 |
|
97 |
+
* **Hide on Screen: Block Editor**
|
98 |
+
Choose to disable Block Editor (Gutenberg) on the field group location
|
99 |
+
|
100 |
* **Advanced settings**
|
101 |
Enable advanced fields settings & validation based on screen (administration/front-end). See fields advanced settings/validation
|
102 |
|
171 |
= ACF: Fields =
|
172 |
|
173 |
* **Field Clone: Edit in modal**
|
174 |
+
Allow users to edit clone fields in a modal. Choose the edit button text, display close button and the modal size
|
175 |
|
176 |
* **Field File: Uploader type**
|
177 |
Choose the uploader type: Basic or native WP uploader
|
178 |
|
179 |
* **Field Group: Edit in modal**
|
180 |
+
Allow users to edit group fields in a modal Choose the edit button text, display close button and the modal size
|
181 |
|
182 |
* **Field Image: Use as Featured Thumbnail**
|
183 |
Choose if an image field should be considered as post featured thumbnail
|
209 |
Display a modern Link Selection in a modal. Post selection can be filtered via post types & taxonomies terms. Add custom fields using `filter('acfe/fields/advanced_link/fields', $fields, $field, $link)`
|
210 |
|
211 |
* **New Field: Button**
|
212 |
+
Display a custom submit or button. Built-in ajax call setting. Usage example available in the field administration
|
213 |
|
214 |
* **New Field: Code Editor**
|
215 |
Edit code using the native WP Core Codemirror library
|
292 |
|
293 |
= ACF: Dev Mode =
|
294 |
|
295 |
+
View all custom Posts, Terms, Users & Options meta in a readable format
|
296 |
|
297 |
* Print Arrays & Json values
|
298 |
* ACF fields meta are grouped together
|
334 |
* Modal Selection Title: Change the layout modal title
|
335 |
* Modal Selection Columns: Change the layout modal columns grid. 1, 2, 3, 4, 5 or 6 columns available
|
336 |
* Modal Selection Categories: Add category for each layout in the layout modal
|
337 |
+
* Modal Settings: Clone field groups and display them as a layout settings modal
|
338 |
* Layouts State: Force layouts to be collapsed or opened by default
|
339 |
* Layouts Collapse: Remove collapse action
|
340 |
+
* Layouts: Hide "Add Layout" buttons
|
341 |
+
* Layouts: Hide "Remove Layout" buttons. Can also be done using `filter('acfe/flexible/remove_actions/name=my_flexible', true, $field)`
|
342 |
+
* Lock Layouts: Disable sortable Layouts. Can also be done using `filter('acfe/flexible/lock/name=my_flexible', true, $field)`
|
343 |
* Button Label: Supports Dashicons icons elments `<span>`
|
344 |
* One Click: the 'Add row' button will add a layout without the selection modal if there is only one layout available in the flexible content
|
|
|
|
|
345 |
* Asynchronous Layouts: Add layouts using Ajax method. This setting increase performance on complex Flexible Content
|
346 |
* Disable Legacy Layout Title Ajax: Disable the native ACF Layout Title Ajax call on `acf/fields/flexible_content/layout_title`.
|
347 |
|
683 |
|
684 |
== Changelog ==
|
685 |
|
686 |
+
= 0.8.4.5 =
|
687 |
+
* Field Group: Hide on Screen - Added "Block Editor" (Gutenberg) setting, allowing administrator to disable the block editor on field group location
|
688 |
+
* Field Group: Third Party - Fixed Export/Sync Clones fields being processed during the action
|
689 |
+
* Field Group: Postbox Seamless CSS class are now added in PHP, which remove the blink during admin page load caused by the class being added in JS
|
690 |
+
* Field Group: Raw Data button now also display the WP_Post object
|
691 |
+
* Field: Button - Before/After HTML settings are now using code editor
|
692 |
+
* Field: Button - Ajax call - Added nominative hooks allowing to target specific field. Hook is now easier. Instructions have been updated
|
693 |
+
* Field: Flexible Content - Added "Advanced Flexible Content" setting (ON/OFF). All advanced settings are now hidden by default and depend on that setting to be shown. (Retro compatibility: if any advanced setting has been saved before, this setting will be set to ON)
|
694 |
+
* Field: Flexible Content - Added "Clone" button as a setting (Not enabled by default in all flexible content anymore)
|
695 |
+
* Field: Flexible Content - Added "Hide: Add Layout Button" setting
|
696 |
+
* Field: Flexible Content - Added "Hide: Remove Layout Button" setting
|
697 |
+
* Field: Flexible Content - Added "Lock Flexible Content" (sortable) setting
|
698 |
+
* Field: Flexible Content - Flexible Content can now be completely locked and all actions removed from the field settings
|
699 |
+
* Field: Flexible Content - Layout Settings modal now allow multiple clones
|
700 |
+
* Field: Flexible Content - Layout Settings modal size can now be selected for each layout (small/medium/large/extra large/full)
|
701 |
+
* Field: Flexible Content - Fixed "Force State: Open" not working correctly in some specific cases
|
702 |
+
* Field: Flexible Content - Fixed Modal Selection z-index problem on attachment screen
|
703 |
+
* Field: Flexible Content - Fixed Modal Edition z-index problem with button group (when already inside a modal)
|
704 |
+
* Field: Flexible Content - Fixed a bug causing duplicated "Layout Setting" & "Layout Title Edition" fields when export/re-importing a field group with flexible content that had this settings
|
705 |
+
* Field: Taxonomy Terms - Fixed a PHP notice when "Load Terms" was enabled with "select" as field type
|
706 |
+
* Field: Group/Clone - Seamless style CSS fixed in term view
|
707 |
+
* Field: Color Picker - Added position relative property when the field is used inside a modal
|
708 |
+
* Field: Hidden - Added global CSS style
|
709 |
+
* Module: Single Meta Save - Improved save process performance (it's now even faster!)
|
710 |
+
* Module: Dynamic Forms - Added `{query_var:var}` template tag in E-mail action, Post Load source, Post Target, Term Load source, Term Target & User Load source, Redirection & Updated Message fields. This will allow user to retrieve a specific `query_var` and use it dynamically
|
711 |
+
* Module: Dynamic Forms - `{query_var:var}` template tag also allow to specific key if the value is an array, using the following tag: `{query_var:var:key}`
|
712 |
+
* Module: Dynamic Forms - New "Query var" settings on Post, Terms, Users & E-mail actions that generate a custom query var based on the "Action name" after completing the action. For example: Post Action with Action name "my-action" will generate a `query_var` named `my-action` and as value the post data (array) that has been created/updated. This `query_var` can be accessed using `get_query_var('my-action');` or the template tag `{query_var:my-action:ID}` (Post ID), `{query_var:my-action:post_title}` (Post Title), `{query_var:my-action:permalink}` (Post Permalink), `{query_var:my-action:admin_url}` (Post Admin URL)
|
713 |
+
* Module: Dynamic Forms - Fixed shortcode not working correctly when using Form ID instead of Form name
|
714 |
+
* Module: Dynamic Forms - Actions UI Layouts can now be collapsed
|
715 |
+
* Module: Dev Mode - Added Meta Overview for Options Page
|
716 |
+
* Module: Options Page - Child Options page are now correctly displayed as child in the Options Page UI
|
717 |
+
* General: Modal - Added localization for the "Close" button
|
718 |
+
* General: Modal - Added Small/Medium/Large/Extra Large/Full sizes
|
719 |
+
|
720 |
= 0.8.4.1 =
|
721 |
* General: Fixed loading sequence when `get_field` was called directly in the functions file
|
722 |
* Field: Flexible Content - Fixed Dynamic Preview overlay z-index
|