Advanced Custom Fields: Extended - Version 0.7.8

Version Description

  • Field: Flexible Content - Removed 'Layouts Thumbnail as Preview' setting. You should now use 'Layouts: Dynamic Preview', and
  • Field: Flexible Content - Added 'Layouts: Dynamic Preview' ('Layouts: Render' setting must be turned ON)
  • Field: Flexible Content - Reworked layouts settings order (better readability)
  • Field: Flexible Content - Modal Edition title now removes eventual extra HTML tags (thanks @Thomas D.)
  • Field: Flexible Content - Modal Edition CSS has been fixed on Gutenberg Editor view (thanks @Val)
  • Field: Flexible Content - Fixed 'Empty Message' placeholder setting using wrong __() function (thanks @illiminal)
  • Field: Flexible Content - Removed query vars from get_flexible(). Global variables $layout & $field can be used in the template to retrieve current settings
  • Field: Flexible Content - Added global variable $is_preview which is true when the template file is called as a layout preview
  • Field: Flexible Content - get_flexible() now uses wp_enqueue_style() & wp_enqueue_script() when rendering on front-end
  • Field: Image - 'No image selected' text has been removed
  • Module: Dynamic Post Types/Taxonomies - Fixed 'index key not found' PHP warning (thanks @Val)
  • Module: Dynamic Post Types/Taxonomies/Options & Block Types - Added edit_posts capabilities matching the ACF capability setting
  • Tools: Dynamic Post Type Import - Fixed 'capabilities key not found' PHP warning during import process (thanks @Val)
  • General: Improved Metaboxes CSS on Gutenberg Editor views
  • General: Reworked JS enqueue. Flexible Content JS is now excluded from ACF Field Groups views
Download this release

Release Info

Developer hwk-fr
Plugin Icon 128x128 Advanced Custom Fields: Extended
Version 0.7.8
Comparing to
See all releases

Code changes from version 0.7.5.5 to 0.7.8

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.7.5.5
6
  * Author: ACF Extended
7
  * Author URI: https://www.acf-extended.com
8
  * Text Domain: acfe
@@ -65,6 +65,7 @@ function acfe_load(){
65
  require_once(ACFE_PATH . 'includes/fields-settings/bidirectional.php');
66
  require_once(ACFE_PATH . 'includes/fields-settings/data.php');
67
  require_once(ACFE_PATH . 'includes/fields-settings/flexible-content.php');
 
68
  require_once(ACFE_PATH . 'includes/fields-settings/permissions.php');
69
  require_once(ACFE_PATH . 'includes/fields-settings/thumbnail.php');
70
  require_once(ACFE_PATH . 'includes/fields-settings/update.php');
2
  /**
3
  * Plugin Name: Advanced Custom Fields: Extended
4
  * Description: Enhancement Suite which improves Advanced Custom Fields administration
5
+ * Version: 0.7.8
6
  * Author: ACF Extended
7
  * Author URI: https://www.acf-extended.com
8
  * Text Domain: acfe
65
  require_once(ACFE_PATH . 'includes/fields-settings/bidirectional.php');
66
  require_once(ACFE_PATH . 'includes/fields-settings/data.php');
67
  require_once(ACFE_PATH . 'includes/fields-settings/flexible-content.php');
68
+ require_once(ACFE_PATH . 'includes/fields-settings/image.php');
69
  require_once(ACFE_PATH . 'includes/fields-settings/permissions.php');
70
  require_once(ACFE_PATH . 'includes/fields-settings/thumbnail.php');
71
  require_once(ACFE_PATH . 'includes/fields-settings/update.php');
assets/acf-extended-fc-modal-edit.js CHANGED
@@ -15,17 +15,27 @@
15
  model.events['click [data-action="acfe-flexible-modal-edit"]'] = 'acfeModalEdit';
16
  model.acfeModalEdit = function(e, $el){
17
 
 
 
18
  // Layout
19
  var $layout = $el.closest('.layout');
20
 
21
  // Modal data
22
  var $modal = $layout.find('> .acfe-modal');
23
- var $title = $layout.find('> .acf-fc-layout-handle').html();
 
 
 
24
 
25
  // Open modal
26
  acfe.modal.open($modal, {
27
- title: $title,
28
- footer: 'Close'
 
 
 
 
 
29
  });
30
 
31
  }
@@ -46,6 +56,25 @@
46
 
47
  });
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  acf.addAction('acfe/flexible/layouts', function($layout, flexible){
50
 
51
  if(!flexible.has('acfeFlexibleModalEdition'))
15
  model.events['click [data-action="acfe-flexible-modal-edit"]'] = 'acfeModalEdit';
16
  model.acfeModalEdit = function(e, $el){
17
 
18
+ var flexible = this;
19
+
20
  // Layout
21
  var $layout = $el.closest('.layout');
22
 
23
  // Modal data
24
  var $modal = $layout.find('> .acfe-modal');
25
+ var $handle = $layout.find('> .acf-fc-layout-handle');
26
+
27
+ var $layout_order = $handle.find('> .acf-fc-layout-order').outerHTML();
28
+ var $layout_title = $handle.find('> .acfe-layout-title').text();
29
 
30
  // Open modal
31
  acfe.modal.open($modal, {
32
+ title: $layout_order + ' ' + $layout_title,
33
+ footer: 'Close',
34
+ onClose: function(){
35
+
36
+ flexible.closeLayout($layout);
37
+
38
+ }
39
  });
40
 
41
  }
56
 
57
  });
58
 
59
+ acf.addAction('hide', function($layout, type){
60
+
61
+ if(type != 'collapse' || !$layout.is('.layout'))
62
+ return;
63
+
64
+ // Get Flexible
65
+ var flexible = acf.getInstance($layout.closest('.acf-field-flexible-content'));
66
+
67
+ if(!flexible.has('acfeFlexibleModalEdition'))
68
+ return;
69
+
70
+ // Wrap content
71
+ $layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acfe-modal"><div class="acfe-modal-wrapper"><div class="acfe-modal-content"></div></div></div>');
72
+
73
+ // Placeholder
74
+ $layout.find('> .acfe-flexible-collapsed-placeholder').attr('data-action', 'acfe-flexible-modal-edit');
75
+
76
+ });
77
+
78
  acf.addAction('acfe/flexible/layouts', function($layout, flexible){
79
 
80
  if(!flexible.has('acfeFlexibleModalEdition'))
assets/acf-extended-fc.css CHANGED
@@ -51,31 +51,39 @@
51
  box-shadow: none;
52
  }
53
 
54
- .layout > .acfe-flexible-collapsed-placeholder > .placeholder{
55
- padding:40px 0;
 
56
  }
57
 
58
- .layout > .acfe-flexible-collapsed-placeholder button{
 
 
 
 
 
 
 
 
59
  border-radius:100px;
60
  box-shadow:none;
61
  background:#fff;
62
  width: 30px;
63
  height: 30px;
64
  padding:0;
 
65
  }
66
 
67
- .layout > .acfe-flexible-collapsed-placeholder:hover button{
68
- background: #fafafa;
69
- border-color: #999;
70
- color: #23282d;
71
  }
72
 
73
- .layout > .acfe-flexible-collapsed-placeholder button:focus{
74
  border-color: #cccccc;
75
  box-shadow: none;
76
  }
77
 
78
- .layout > .acfe-flexible-collapsed-placeholder button span{
79
  width: 30px;
80
  height: 30px;
81
  vertical-align:middle;
@@ -83,25 +91,39 @@
83
  font-size:18px;
84
  }
85
 
86
- .layout > .acfe-flexible-collapsed-placeholder > button{
87
- z-index:1;
 
 
 
 
 
 
 
88
  display:none;
89
- position:absolute;
90
- top:50%;
91
- left:50%;
92
- transform:translate(-50%, -50%);
93
  }
94
 
95
- .layout > .acfe-flexible-collapsed-placeholder:hover > button{
96
  display:block;
97
  }
98
 
99
- .layout > .acfe-flexible-collapsed-placeholder > button:active{
 
 
 
 
 
 
 
 
 
 
100
  transform:translate(-50%, -50%);
 
101
  }
102
 
103
  .layout > .acfe-flexible-collapsed-placeholder .acfe-flexible-collapsed-overlay{
104
- z-index:0;
105
  position:absolute;
106
  width:100%;
107
  height:100%;
@@ -116,16 +138,6 @@
116
  background-color:rgba(255,255,255,0.7);
117
  }
118
 
119
- /*
120
- * Flexible Layout: Preview
121
- */
122
- .layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview img{
123
- max-width:100%;
124
- height:auto;
125
- margin:auto;
126
- display:block;
127
- }
128
-
129
  /*
130
  * Flexible Layout Collapsed
131
  */
@@ -224,35 +236,4 @@
224
 
225
  .acf-field.acf-field-flexible-content[data-acfe-flexible-hide-empty-message="1"] > .acf-input > .acf-flexible-content.-empty > .values{
226
  margin-bottom:0;
227
- }
228
-
229
- /*
230
- * Admin CSS
231
- *
232
- */
233
- .acf-field-acfe-flexible-modal > .acf-input > .acf-fields{
234
- border:0;
235
- }
236
-
237
- .acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-enabled{
238
- padding:0;
239
- }
240
-
241
- .acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-enabled .acf-label{
242
- display:none;
243
- }
244
-
245
- .acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-title,
246
- .acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-col,
247
- .acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-categories{
248
- padding-bottom:0;
249
- padding-left:0;
250
- border-top:0;
251
- border-left:0 !important;
252
- min-height:55px;
253
- }
254
-
255
- .acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_thumbnail],
256
- .acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_category]{
257
- margin:0;
258
  }
51
  box-shadow: none;
52
  }
53
 
54
+ .layout > .acfe-flexible-collapsed-placeholder > .acfe-flexible-placeholder{
55
+ height:110px;
56
+ overflow:hidden;
57
  }
58
 
59
+ .layout > .acfe-flexible-collapsed-placeholder > button{
60
+ z-index:2;
61
+ position:absolute;
62
+ top:50%;
63
+ left:50%;
64
+ transform:translate(-50%, -50%);
65
+ background: #fafafa;
66
+ border-color: #999;
67
+ color: #23282d;
68
  border-radius:100px;
69
  box-shadow:none;
70
  background:#fff;
71
  width: 30px;
72
  height: 30px;
73
  padding:0;
74
+ display:block;
75
  }
76
 
77
+ .layout > .acfe-flexible-collapsed-placeholder > button:active{
78
+ transform:translate(-50%, -50%);
 
 
79
  }
80
 
81
+ .layout > .acfe-flexible-collapsed-placeholder > button:focus{
82
  border-color: #cccccc;
83
  box-shadow: none;
84
  }
85
 
86
+ .layout > .acfe-flexible-collapsed-placeholder > button span{
87
  width: 30px;
88
  height: 30px;
89
  vertical-align:middle;
91
  font-size:18px;
92
  }
93
 
94
+ .layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview{
95
+ background:none;
96
+ }
97
+
98
+ .layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview > .acfe-flexible-placeholder{
99
+ height:auto;
100
+ }
101
+
102
+ .layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview > button{
103
  display:none;
 
 
 
 
104
  }
105
 
106
+ .layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview:hover > button{
107
  display:block;
108
  }
109
 
110
+ .layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview.acfe-is-loading{
111
+ background:#fafafa;
112
+ height:110px;
113
+ }
114
+
115
+ .layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview.acfe-is-loading > .acfe-flexible-placeholder > .spinner{
116
+ visibility:visible;
117
+ float:none;
118
+ position:absolute;
119
+ top:50%;
120
+ left:50%;
121
  transform:translate(-50%, -50%);
122
+ margin:0;
123
  }
124
 
125
  .layout > .acfe-flexible-collapsed-placeholder .acfe-flexible-collapsed-overlay{
126
+ z-index:1;
127
  position:absolute;
128
  width:100%;
129
  height:100%;
138
  background-color:rgba(255,255,255,0.7);
139
  }
140
 
 
 
 
 
 
 
 
 
 
 
141
  /*
142
  * Flexible Layout Collapsed
143
  */
236
 
237
  .acf-field.acf-field-flexible-content[data-acfe-flexible-hide-empty-message="1"] > .acf-input > .acf-flexible-content.-empty > .values{
238
  margin-bottom:0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  }
assets/acf-extended-fc.js CHANGED
@@ -163,19 +163,18 @@
163
  // Placeholder
164
  var $placeholder = $('' +
165
  '<div class="acfe-flexible-collapsed-placeholder" title="Edit layout">' +
166
- ' <div class="placeholder">' +
167
  ' <button class="button" onclick="return false;">' +
168
  ' <span class="dashicons dashicons-edit"></span>' +
169
  ' </button>' +
170
- ' </div>' +
 
171
  '</div>'
172
- );
173
 
174
- if(!flexible.has('acfeFlexiblePreview')){
175
 
176
- var $placeholder = $placeholder.insertAfter($controls);
177
 
178
- /*
179
  // vars
180
  var $input = $layout.children('input');
181
  var prefix = $input.attr('name').replace('[acf_fc_layout]', '');
@@ -186,7 +185,7 @@
186
  field_key: flexible.get('key'),
187
  i: $layout.index(),
188
  layout: $layout.data('layout'),
189
- value: acf.serialize( $layout, prefix )
190
  };
191
 
192
  // ajax
@@ -195,40 +194,26 @@
195
  data: acf.prepareForAjax(ajaxData),
196
  dataType: 'html',
197
  type: 'post',
198
- success: function(html){
199
- if(html){
200
- $placeholder.find('> .placeholder').replaceWith(html);
201
- }
202
- }
 
 
 
 
 
 
 
 
 
 
 
203
  });
204
- */
205
-
206
- return;
207
-
208
- }
209
-
210
- // Get Previews
211
- var $previews = flexible.get('acfeFlexiblePreview');
212
-
213
- // Check Preview Exists
214
- if(!acf.isset($previews, $name)){
215
-
216
- $controls.after($placeholder);
217
-
218
- return;
219
 
220
  }
221
 
222
- $controls.after('' +
223
- '<div class="acfe-flexible-collapsed-placeholder acfe-flexible-collapsed-preview" title="Edit layout">' +
224
- ' <button class="button" onclick="return false;">' +
225
- ' <span class="dashicons dashicons-edit"></span>' +
226
- ' </button>' +
227
- ' <div class="acfe-flexible-collapsed-overlay"></div>' +
228
- ' <img src="' + $previews[$name] + '" />' +
229
- '</div>'
230
- );
231
-
232
  });
233
 
234
  /*
163
  // Placeholder
164
  var $placeholder = $('' +
165
  '<div class="acfe-flexible-collapsed-placeholder" title="Edit layout">' +
 
166
  ' <button class="button" onclick="return false;">' +
167
  ' <span class="dashicons dashicons-edit"></span>' +
168
  ' </button>' +
169
+ ' <div class="acfe-flexible-collapsed-overlay"></div>' +
170
+ ' <div class="acfe-flexible-placeholder"></div>' +
171
  '</div>'
172
+ ).insertAfter($controls);
173
 
174
+ if(flexible.has('acfeFlexiblePreview')){
175
 
176
+ $placeholder.addClass('acfe-flexible-collapsed-preview acfe-is-loading').find('> .acfe-flexible-placeholder').html('<span class="spinner"></span>')
177
 
 
178
  // vars
179
  var $input = $layout.children('input');
180
  var prefix = $input.attr('name').replace('[acf_fc_layout]', '');
185
  field_key: flexible.get('key'),
186
  i: $layout.index(),
187
  layout: $layout.data('layout'),
188
+ value: acf.serialize($layout, prefix)
189
  };
190
 
191
  // ajax
194
  data: acf.prepareForAjax(ajaxData),
195
  dataType: 'html',
196
  type: 'post',
197
+ success: function(response){
198
+ if(response){
199
+
200
+ $placeholder.find('> .acfe-flexible-placeholder').html(response);
201
+
202
+ }else{
203
+
204
+ $placeholder.removeClass('acfe-flexible-collapsed-preview');
205
+
206
+ }
207
+ },
208
+ complete: function(){
209
+
210
+ $placeholder.removeClass('acfe-is-loading').find('> .acfe-flexible-placeholder > .spinner').remove();
211
+
212
+ }
213
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
 
215
  }
216
 
 
 
 
 
 
 
 
 
 
 
217
  });
218
 
219
  /*
assets/acf-extended-fg.css CHANGED
@@ -93,4 +93,48 @@ td.acf-field-group-category a{
93
  .column-acfe-autosync-json{
94
  width:65px;
95
  text-align:center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
93
  .column-acfe-autosync-json{
94
  width:65px;
95
  text-align:center;
96
+ }
97
+
98
+ .acf-field-image[data-name="acfe_flexible_thumbnail"] > .acf-input > .acf-image-uploader.has-value > .show-if-value.image-wrap{
99
+ max-width:85px !important;
100
+ }
101
+
102
+ /*
103
+ * ACFE: Flexible Content
104
+ *
105
+ */
106
+ .acf-field-acfe-flexible-modal > .acf-input > .acf-fields{
107
+ border:0;
108
+ }
109
+
110
+ .acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-enabled{
111
+ padding:0;
112
+ }
113
+
114
+ .acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-enabled .acf-label{
115
+ display:none;
116
+ }
117
+
118
+ .acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-title,
119
+ .acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-col,
120
+ .acf-field-acfe-flexible-modal > .acf-input > .acf-fields .acf-field-acfe-flexible-modal-categories{
121
+ padding-bottom:0;
122
+ padding-left:0;
123
+ border-top:0;
124
+ border-left:0 !important;
125
+ min-height:55px;
126
+ }
127
+
128
+ .acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings_label],
129
+ .acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_thumbnail],
130
+ .acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_category]{
131
+ margin:0;
132
+ }
133
+
134
+ .acf-field-setting-fc_layout > .acf-input > .acf-fc-meta .acf-field[data-name=acfe_flexible_settings_label] > .acf-input{
135
+ margin:0;
136
+ }
137
+
138
+ .acf-field-setting-fc_layout > .acf-input > .acf-fc-meta > .acf-fc-meta-label:first-of-type{
139
+ margin:0;
140
  }
assets/acf-extended-modal.css CHANGED
@@ -384,4 +384,67 @@ body.acfe-modal-opened{
384
 
385
  .acfe-modal.-open .acfe-modal-footer > button{
386
  vertical-align: baseline;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
  }
384
 
385
  .acfe-modal.-open .acfe-modal-footer > button{
386
  vertical-align: baseline;
387
+ }
388
+
389
+ /*
390
+ * ACFE Modal Gutenberg Fix
391
+ */
392
+ body.block-editor-page .edit-post-layout .acfe-modal.-open{
393
+ -webkit-box-pack: start;
394
+ -ms-flex-pack: start;
395
+ justify-content: start;
396
+ -webkit-box-align: start;
397
+ -ms-flex-align: start;
398
+ align-items: start;
399
+ }
400
+
401
+ body.block-editor-page .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper{
402
+ margin-top: 88px;
403
+ height: 100%;
404
+ width: 100%;
405
+ max-height: calc(100vh - 88px);
406
+ }
407
+
408
+ @media only screen and (max-width: 1080px) {
409
+ body.block-editor-page .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper{
410
+ margin-top: 125px;
411
+ }
412
+ }
413
+
414
+ body.block-editor-page .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper{
415
+ max-width: calc(100vw - 160px);
416
+ margin-left: 160px;
417
+ }
418
+
419
+ body.block-editor-page .edit-post-layout.is-sidebar-opened .acfe-modal.-open > .acfe-modal-wrapper{
420
+ max-width: calc(100vw - 440px);
421
+ }
422
+
423
+
424
+ body.block-editor-page.folded .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper{
425
+ max-width: calc(100vw - 36px);
426
+ margin-left:36px;
427
+ }
428
+
429
+ @media only screen and (max-width: 960px) {
430
+ body.block-editor-page.auto-fold .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper{
431
+ max-width: calc(100vw - 36px);
432
+ margin-left:36px;
433
+ }
434
+ }
435
+
436
+ @media only screen and (max-width: 782px) {
437
+ body.block-editor-page.auto-fold .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper{
438
+ max-width: 100vw;
439
+ margin-left:0;
440
+ margin-top: 100px;
441
+ }
442
+ }
443
+
444
+ body.block-editor-page.folded .edit-post-layout.is-sidebar-opened .acfe-modal.-open > .acfe-modal-wrapper{
445
+ max-width: calc(100vw - 316px);
446
+ }
447
+
448
+ body.block-editor-page .acfe-modal-overlay{
449
+ display:none;
450
  }
assets/acf-extended.css CHANGED
@@ -209,8 +209,8 @@ body.post-type-acfe-dbt #minor-publishing{
209
  margin-bottom: -7px;
210
  }
211
 
212
- .acf-repeater.-row > table *,
213
- .acf-repeater.-block > table *{
214
  border-collapse: collapse;
215
  border-spacing: 0;
216
  }
@@ -265,16 +265,23 @@ body.post-type-acfe-dbt #minor-publishing{
265
  /*
266
  * Gutenberg: Fix metaboxes
267
  */
268
- .edit-post-layout__metaboxes:not(:empty) .edit-post-meta-boxes-area {
269
- margin: auto 10px;
270
  }
271
 
272
  .edit-post-layout__metaboxes:not(:empty) {
273
  background:#f3f4f5;
274
  }
275
 
276
- .edit-post-layout__metaboxes .edit-post-meta-boxes-area .postbox {
277
- margin-bottom: 10px;
 
 
 
 
 
 
 
278
  }
279
 
280
  /*
209
  margin-bottom: -7px;
210
  }
211
 
212
+ .acf-repeater.-row > table > *,
213
+ .acf-repeater.-block > table > *{
214
  border-collapse: collapse;
215
  border-spacing: 0;
216
  }
265
  /*
266
  * Gutenberg: Fix metaboxes
267
  */
268
+ .edit-post-layout__metaboxes:not(:empty) .edit-post-meta-boxes-area{
269
+ margin:10px 10px 0;
270
  }
271
 
272
  .edit-post-layout__metaboxes:not(:empty) {
273
  background:#f3f4f5;
274
  }
275
 
276
+ .edit-post-layout__metaboxes .edit-post-meta-boxes-area .postbox{
277
+ margin-bottom:10px;
278
+ }
279
+
280
+ /* Firefox fix only */
281
+ @supports (-moz-appearance:meterbar){
282
+ .edit-post-layout__metaboxes .postbox{
283
+ box-shadow:0 1px 1px 1px rgba(0,0,0,.04);
284
+ }
285
  }
286
 
287
  /*
assets/acf-extended.js CHANGED
@@ -16,7 +16,8 @@
16
  title: '',
17
  footer: false,
18
  size: false,
19
- destroy: false
 
20
  });
21
 
22
  $target.addClass('-open');
@@ -27,14 +28,6 @@
27
 
28
  }
29
 
30
- var destroy;
31
-
32
- if(args.destroy){
33
-
34
- destroy = true;
35
-
36
- }
37
-
38
  if(!$target.find('> .acfe-modal-wrapper').length){
39
 
40
  $target.wrapInner('<div class="acfe-modal-wrapper" />');
@@ -51,7 +44,7 @@
51
 
52
  $target.find('.acfe-modal-title > .close').click(function(e){
53
  e.preventDefault();
54
- acfe.modal.close(destroy);
55
  });
56
 
57
  if(args.footer){
@@ -60,7 +53,7 @@
60
 
61
  $target.find('.acfe-modal-footer > button').click(function(e){
62
  e.preventDefault();
63
- acfe.modal.close(destroy);
64
  });
65
 
66
  }
@@ -72,7 +65,7 @@
72
  if(!$body.hasClass('acfe-modal-opened')){
73
 
74
  var overlay = $('<div class="acfe-modal-overlay" />').click(function(){
75
- acfe.modal.close(destroy);
76
  });
77
 
78
  $body.addClass('acfe-modal-opened').append(overlay);
@@ -86,7 +79,7 @@
86
  },
87
 
88
  // Close
89
- close: function(destroy){
90
 
91
  var $target = acfe.modal.modals.pop();
92
 
@@ -97,7 +90,7 @@
97
 
98
  $target.removeClass('-open -small -full');
99
 
100
- if(destroy){
101
 
102
  $target.remove();
103
 
@@ -111,6 +104,8 @@
111
  }
112
 
113
  acfe.modal.multiple();
 
 
114
 
115
  },
116
 
@@ -130,6 +125,15 @@
130
 
131
  });
132
 
 
 
 
 
 
 
 
 
 
133
  }
134
 
135
  };
16
  title: '',
17
  footer: false,
18
  size: false,
19
+ destroy: false,
20
+ onClose: false,
21
  });
22
 
23
  $target.addClass('-open');
28
 
29
  }
30
 
 
 
 
 
 
 
 
 
31
  if(!$target.find('> .acfe-modal-wrapper').length){
32
 
33
  $target.wrapInner('<div class="acfe-modal-wrapper" />');
44
 
45
  $target.find('.acfe-modal-title > .close').click(function(e){
46
  e.preventDefault();
47
+ acfe.modal.close(args);
48
  });
49
 
50
  if(args.footer){
53
 
54
  $target.find('.acfe-modal-footer > button').click(function(e){
55
  e.preventDefault();
56
+ acfe.modal.close(args);
57
  });
58
 
59
  }
65
  if(!$body.hasClass('acfe-modal-opened')){
66
 
67
  var overlay = $('<div class="acfe-modal-overlay" />').click(function(){
68
+ acfe.modal.close(args);
69
  });
70
 
71
  $body.addClass('acfe-modal-opened').append(overlay);
79
  },
80
 
81
  // Close
82
+ close: function(args){
83
 
84
  var $target = acfe.modal.modals.pop();
85
 
90
 
91
  $target.removeClass('-open -small -full');
92
 
93
+ if(args.destroy){
94
 
95
  $target.remove();
96
 
104
  }
105
 
106
  acfe.modal.multiple();
107
+
108
+ acfe.modal.onClose($target, args);
109
 
110
  },
111
 
125
 
126
  });
127
 
128
+ },
129
+
130
+ onClose: function($target, args){
131
+
132
+ if(!args.onClose || !(args.onClose instanceof Function))
133
+ return;
134
+
135
+ args.onClose($target);
136
+
137
  }
138
 
139
  };
includes/admin/tools/dpt-import.php CHANGED
@@ -136,9 +136,11 @@ class ACFE_Admin_Tool_Import_DPT extends ACF_Admin_Tool{
136
 
137
  // Capability
138
  update_field('capability_type', acf_encode_choices($args['capability_type'], false), $post_id);
139
- update_field('capabilities', acf_encode_choices($args['capabilities'], false), $post_id);
140
  update_field('map_meta_cap', $args['map_meta_cap'], $post_id);
141
 
 
 
 
142
  // Archive
143
  update_field('acfe_dpt_archive_template', $args['acfe_archive_template'], $post_id);
144
  update_field('acfe_dpt_archive_posts_per_page', $args['acfe_archive_ppp'], $post_id);
136
 
137
  // Capability
138
  update_field('capability_type', acf_encode_choices($args['capability_type'], false), $post_id);
 
139
  update_field('map_meta_cap', $args['map_meta_cap'], $post_id);
140
 
141
+ if(isset($args['capabilities']))
142
+ update_field('capabilities', acf_encode_choices($args['capabilities'], false), $post_id);
143
+
144
  // Archive
145
  update_field('acfe_dpt_archive_template', $args['acfe_archive_template'], $post_id);
146
  update_field('acfe_dpt_archive_posts_per_page', $args['acfe_archive_ppp'], $post_id);
includes/core/enqueue.php CHANGED
@@ -33,8 +33,16 @@ function acfe_enqueue_admin(){
33
  add_action('acf/input/admin_enqueue_scripts', 'acfe_enqueue_fields');
34
  function acfe_enqueue_fields(){
35
 
 
36
  wp_enqueue_script('acf-extended-fields', plugins_url('assets/acf-extended-fields.js', ACFE_FILE), array('jquery'), null);
37
 
 
 
 
 
 
 
 
38
  wp_enqueue_style('acf-extended-fc', plugins_url('assets/acf-extended-fc.css', ACFE_FILE), false, null);
39
  wp_enqueue_script('acf-extended-fc', plugins_url('assets/acf-extended-fc.js', ACFE_FILE), array('jquery'), null);
40
 
@@ -42,9 +50,6 @@ function acfe_enqueue_fields(){
42
  wp_enqueue_style('acf-extended-fc-control', plugins_url('assets/acf-extended-fc-control.css', ACFE_FILE), false, null);
43
  wp_enqueue_script('acf-extended-fc-control', plugins_url('assets/acf-extended-fc-control.js', ACFE_FILE), array('jquery'), null);
44
 
45
- // ACF Extended: Modal
46
- wp_enqueue_style('acf-extended-modal', plugins_url('assets/acf-extended-modal.css', ACFE_FILE), false, null);
47
-
48
  // ACF Extended: Flexible Content Modal Select
49
  wp_enqueue_style('acf-extended-fc-modal-select', plugins_url('assets/acf-extended-fc-modal-select.css', ACFE_FILE), false, null);
50
  wp_enqueue_script('acf-extended-fc-modal-select', plugins_url('assets/acf-extended-fc-modal-select.js', ACFE_FILE), array('jquery'), null);
33
  add_action('acf/input/admin_enqueue_scripts', 'acfe_enqueue_fields');
34
  function acfe_enqueue_fields(){
35
 
36
+ // ACF Extended: Fields
37
  wp_enqueue_script('acf-extended-fields', plugins_url('assets/acf-extended-fields.js', ACFE_FILE), array('jquery'), null);
38
 
39
+ // ACF Extended: Modal
40
+ wp_enqueue_style('acf-extended-modal', plugins_url('assets/acf-extended-modal.css', ACFE_FILE), false, null);
41
+
42
+ // Do not enqueue on ACF Field Groups views
43
+ if(acf_is_screen(array('edit-acf-field-group', 'acf-field-group')))
44
+ return;
45
+
46
  wp_enqueue_style('acf-extended-fc', plugins_url('assets/acf-extended-fc.css', ACFE_FILE), false, null);
47
  wp_enqueue_script('acf-extended-fc', plugins_url('assets/acf-extended-fc.js', ACFE_FILE), array('jquery'), null);
48
 
50
  wp_enqueue_style('acf-extended-fc-control', plugins_url('assets/acf-extended-fc-control.css', ACFE_FILE), false, null);
51
  wp_enqueue_script('acf-extended-fc-control', plugins_url('assets/acf-extended-fc-control.js', ACFE_FILE), array('jquery'), null);
52
 
 
 
 
53
  // ACF Extended: Flexible Content Modal Select
54
  wp_enqueue_style('acf-extended-fc-modal-select', plugins_url('assets/acf-extended-fc-modal-select.css', ACFE_FILE), false, null);
55
  wp_enqueue_script('acf-extended-fc-modal-select', plugins_url('assets/acf-extended-fc-modal-select.js', ACFE_FILE), array('jquery'), null);
includes/core/helpers.php CHANGED
@@ -17,68 +17,15 @@ function get_flexible($selector, $post_id = false){
17
  $field = acf_get_field($selector);
18
  $flexible = acf_get_field_type('flexible_content');
19
 
20
- // Query Var
21
- set_query_var('acf_flexible_field', $field);
22
-
23
- // Enqueue
24
- $acfe_flexible_enqueue_styles = array();
25
- $acfe_flexible_enqueue_scripts = array();
26
-
27
  ob_start();
28
 
29
- while(have_rows($selector)): the_row();
30
-
31
- $layout = $flexible->get_layout(get_row_layout(), $field);
32
 
33
- set_query_var('acf_flexible_layout', $layout);
 
 
34
 
35
- // Add HTML Comment
36
- echo "\n" . '<!-- ' . $layout['label'] . ' -->' . "\n";
37
-
38
- // Render: Style
39
- if(isset($layout['acfe_flexible_render_style']) && !empty($layout['acfe_flexible_render_style'])){
40
-
41
- // Style exists
42
- if(file_exists(ACFE_THEME_PATH . '/' . $layout['acfe_flexible_render_style'])){
43
-
44
- // Already enqueued
45
- if(!in_array($layout['acfe_flexible_render_style'], $acfe_flexible_enqueue_styles)){
46
-
47
- $acfe_flexible_enqueue_styles[] = $layout['acfe_flexible_render_style'];
48
-
49
- echo '<link rel="stylesheet" href="' . ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_style'] . '" type="text/css">' . "\n";
50
-
51
- }
52
-
53
- }
54
-
55
- }
56
-
57
- // Render: Script
58
- if(isset($layout['acfe_flexible_render_script']) && !empty($layout['acfe_flexible_render_script'])){
59
-
60
- // Script exists
61
- if(file_exists(ACFE_THEME_PATH . '/' . $layout['acfe_flexible_render_script'])){
62
-
63
- // Already enqueued
64
- if(!in_array($layout['acfe_flexible_render_script'], $acfe_flexible_enqueue_scripts)){
65
-
66
- $acfe_flexible_enqueue_scripts[] = $layout['acfe_flexible_render_script'];
67
-
68
- echo '<script src="' . ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_script'] . '"></script>' . "\n";
69
-
70
- }
71
-
72
- }
73
-
74
- }
75
-
76
- // Render: Template
77
- if(isset($layout['acfe_flexible_render_template']) && !empty($layout['acfe_flexible_render_template'])){
78
-
79
- locate_template(array($layout['acfe_flexible_render_template']), true, false);
80
-
81
- }
82
 
83
  endwhile;
84
 
@@ -114,6 +61,111 @@ function has_flexible($selector, $post_id = false){
114
 
115
  }
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  /**
118
  * Get Field Group from Field
119
  */
@@ -196,4 +248,24 @@ function acfe_folder_exists($folder){
196
 
197
  return true;
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  }
17
  $field = acf_get_field($selector);
18
  $flexible = acf_get_field_type('flexible_content');
19
 
 
 
 
 
 
 
 
20
  ob_start();
21
 
22
+ while(have_rows($selector, $post_id)): the_row();
 
 
23
 
24
+ // vars
25
+ $layout_name = get_row_layout();
26
+ $layout = $flexible->get_layout($layout_name, $field);
27
 
28
+ acfe_flexible_render_layout($layout, $field);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  endwhile;
31
 
61
 
62
  }
63
 
64
+ /**
65
+ * ACFE Flexible: Render Layout
66
+ */
67
+ function acfe_flexible_render_layout($layout, $field){
68
+
69
+ // Is preview
70
+ $is_preview = false;
71
+ if(wp_doing_ajax())
72
+ $is_preview = true;
73
+
74
+ // handle
75
+ $handle = acf_slugify($field['name']) . '-layout-' . acf_slugify($layout['name']);
76
+
77
+ // render
78
+ $render = array(
79
+ 'style' => false,
80
+ 'script' => false,
81
+ 'template' => false,
82
+ );
83
+
84
+ if(!$is_preview){
85
+
86
+ // Add HTML Comment
87
+ echo "\n" . '<!-- ' . $layout['label'] . ' -->' . "\n";
88
+
89
+ }
90
+
91
+ // Render: Style
92
+ if(isset($layout['acfe_flexible_render_style']) && !empty($layout['acfe_flexible_render_style'])){
93
+
94
+ if(file_exists(ACFE_THEME_PATH . '/' . $layout['acfe_flexible_render_style'])){
95
+
96
+ if(!$is_preview){
97
+
98
+ wp_enqueue_style($handle, ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_style'], array(), false, 'all');
99
+
100
+ }else{
101
+
102
+ $render['style'] = '<link rel="stylesheet" href="' . ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_style'] . '" type="text/css" media="all">';
103
+
104
+ }
105
+
106
+ }
107
+
108
+ }
109
+
110
+ // Render: Script
111
+ if(isset($layout['acfe_flexible_render_script']) && !empty($layout['acfe_flexible_render_script'])){
112
+
113
+ if(file_exists(ACFE_THEME_PATH . '/' . $layout['acfe_flexible_render_script'])){
114
+
115
+ if(!$is_preview){
116
+
117
+ wp_enqueue_script($handle, ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_script'], array(), false, true);
118
+
119
+ }else{
120
+
121
+ $render['script'] = '<script type="text/javascript" src="' . ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_script'] . '"></script>';
122
+
123
+ }
124
+
125
+ }
126
+
127
+ }
128
+
129
+ // Render: Template
130
+ if(isset($layout['acfe_flexible_render_template']) && !empty($layout['acfe_flexible_render_template'])){
131
+
132
+ $acfe_flexible_render_template = ACFE_THEME_PATH . '/' . $layout['acfe_flexible_render_template'];
133
+ $path = false;
134
+
135
+ // File exists
136
+ if(file_exists($acfe_flexible_render_template)){
137
+
138
+ $path = $acfe_flexible_render_template;
139
+
140
+ // Locate Template
141
+ }else{
142
+
143
+ $path = locate_template(array($acfe_flexible_render_template));
144
+
145
+ }
146
+
147
+ // Include
148
+ if(file_exists($path)){
149
+
150
+ if(!$is_preview){
151
+
152
+ include($path);
153
+
154
+ }else{
155
+
156
+ $render['template'] = $path;
157
+
158
+ }
159
+
160
+ }
161
+
162
+ }
163
+
164
+ if($is_preview)
165
+ return $render;
166
+
167
+ }
168
+
169
  /**
170
  * Get Field Group from Field
171
  */
248
 
249
  return true;
250
 
251
+ }
252
+
253
+ /**
254
+ * Array Keys Recursive
255
+ */
256
+ function acfe_array_keys_r($array){
257
+
258
+ $keys = array_keys($array);
259
+
260
+ foreach($array as $i){
261
+
262
+ if(!is_array($i))
263
+ continue;
264
+
265
+ $keys = array_merge($keys, acfe_array_keys_r($i));
266
+
267
+ }
268
+
269
+ return $keys;
270
+
271
  }
includes/fields-settings/flexible-content.php CHANGED
@@ -53,7 +53,7 @@ function acfe_flexible_settings($field){
53
  'key' => 'acfe_flexible_empty_message',
54
  'instructions' => __('Text displayed when the flexible field is empty'),
55
  'type' => 'text',
56
- 'placeholder' => _('Click the "Add Row" button below to start creating your layout'),
57
  'conditional_logic' => array(
58
  array(
59
  array(
@@ -75,7 +75,21 @@ function acfe_flexible_settings($field){
75
  'label' => __('Layouts Thumbnails'),
76
  'name' => 'acfe_flexible_layouts_thumbnails',
77
  'key' => 'acfe_flexible_layouts_thumbnails',
78
- 'instructions' => __('Display thumbnails for each layout. You need to save the field group to display it'),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  'type' => 'true_false',
80
  'message' => '',
81
  'default_value' => false,
@@ -86,10 +100,10 @@ function acfe_flexible_settings($field){
86
 
87
  // Layouts preview
88
  acf_render_field_setting($field, array(
89
- 'label' => __('Layouts Thumbnails as Preview'),
90
  'name' => 'acfe_flexible_layouts_previews',
91
  'key' => 'acfe_flexible_layouts_previews',
92
- 'instructions' => __('Use thumbnails as preview in the post administration screen'),
93
  'type' => 'true_false',
94
  'message' => '',
95
  'default_value' => false,
@@ -99,7 +113,7 @@ function acfe_flexible_settings($field){
99
  'conditional_logic' => array(
100
  array(
101
  array(
102
- 'field' => 'acfe_flexible_layouts_thumbnails',
103
  'operator' => '==',
104
  'value' => '1',
105
  )
@@ -107,20 +121,6 @@ function acfe_flexible_settings($field){
107
  )
108
  ), true);
109
 
110
- // Layouts render
111
- acf_render_field_setting($field, array(
112
- 'label' => __('Layouts Render'),
113
- 'name' => 'acfe_flexible_layouts_templates',
114
- 'key' => 'acfe_flexible_layouts_templates',
115
- 'instructions' => __('Display PHP template, style & javascript layouts settings. You need to save the field group to display them'),
116
- 'type' => 'true_false',
117
- 'message' => '',
118
- 'default_value' => false,
119
- 'ui' => true,
120
- 'ui_on_text' => '',
121
- 'ui_off_text' => '',
122
- ), true);
123
-
124
  // Modal: Edition
125
  acf_render_field_setting($field, array(
126
  'label' => __('Modal: Edition'),
@@ -168,7 +168,7 @@ function acfe_flexible_settings($field){
168
  'name' => 'acfe_flexible_modal_title',
169
  'key' => 'acfe_flexible_modal_title',
170
  'type' => 'text',
171
- 'prepend' => __('Title'),
172
  'placeholder' => 'Add Row',
173
  'instructions' => false,
174
  'required' => false,
@@ -270,152 +270,193 @@ function acfe_flexible_settings($field){
270
 
271
  }
272
 
273
- add_action('acf/render_field', 'acfe_flexible_layouts_settings', 0);
274
- function acfe_flexible_layouts_settings($field){
275
 
276
  if($field['_name'] != 'label' || stripos($field['name'], 'layout_') === false)
277
  return;
278
 
279
- $layout_prefix = $field['prefix'];
280
 
281
- preg_replace_callback('/\[(.*?)\]/', function($m) use (&$arr){
282
- $arr[] = explode(',',preg_replace('/([\w]+)/', "$1", $m[1]));
283
- }, $layout_prefix);
 
 
284
 
285
- $layout_key = $arr[2][0];
286
- $field_flexible_id = $arr[0][0];
287
 
288
- $field_flexible = acf_get_field($field_flexible_id);
 
 
 
289
 
290
- $layout = $field_flexible['layouts'][$layout_key];
 
291
 
292
- $echo = false;
 
 
 
 
 
 
 
 
 
293
 
294
  $is_flexible_layouts_thumbnails = isset($field_flexible['acfe_flexible_layouts_thumbnails']) && !empty($field_flexible['acfe_flexible_layouts_thumbnails']);
295
  $is_flexible_layouts_templates = isset($field_flexible['acfe_flexible_layouts_templates']) && !empty($field_flexible['acfe_flexible_layouts_templates']);
296
  $is_flexible_modal_enabled = isset($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_enabled']) && !empty($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_enabled']);
297
  $is_flexible_modal_categories = isset($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_categories']) && !empty($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_categories']);
298
 
299
- if($is_flexible_layouts_thumbnails || $is_flexible_layouts_templates || ($is_flexible_modal_enabled && $is_flexible_modal_categories)){
300
-
301
- $echo = true;
302
 
303
- ?>
304
- </li>
305
- <?php
306
-
307
- }
308
 
309
- // Thumbnail
310
- if($is_flexible_layouts_thumbnails){
311
-
312
- $acfe_flexible_thumbnail = isset($layout['acfe_flexible_thumbnail']) ? $layout['acfe_flexible_thumbnail'] : '';
313
-
314
- echo '<li>';
315
-
316
- echo '<div class="acf-label"><label>' . __('Thumbnail') . '</label></div>';
317
-
318
- acf_render_field_wrap(array(
319
- 'label' => false,
320
- 'name' => 'acfe_flexible_thumbnail',
321
- 'type' => 'image',
322
- 'class' => '',
323
- 'prefix' => $layout_prefix,
324
- 'value' => $acfe_flexible_thumbnail,
325
- 'return_format' => 'array',
326
- 'preview_size' => 'thumbnail',
327
- 'library' => 'all',
328
- ));
329
-
330
- echo '</li>';
 
 
 
 
331
 
332
  }
333
 
334
  // Template
335
  if($is_flexible_layouts_templates){
336
-
337
- $acfe_flexible_render_template = isset($layout['acfe_flexible_render_template']) ? $layout['acfe_flexible_render_template'] : '';
338
-
339
- echo '<li>';
340
 
341
- echo '<div class="acf-label"><label>Render</label></div>';
342
-
343
- acf_render_field(array(
344
- 'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
345
- 'name' => 'acfe_flexible_render_template',
346
- 'type' => 'text',
347
- 'class' => 'acf-fc-meta-name',
348
- 'prefix' => $layout_prefix,
349
- 'value' => $acfe_flexible_render_template,
350
- 'placeholder' => 'template.php'
351
- ));
352
 
353
- echo '</li>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
 
355
  $acfe_flexible_render_style = isset($layout['acfe_flexible_render_style']) ? $layout['acfe_flexible_render_style'] : '';
356
 
357
- echo '<li>';
358
-
359
- acf_render_field(array(
360
- 'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
361
- 'name' => 'acfe_flexible_render_style',
362
- 'type' => 'text',
363
- 'class' => 'acf-fc-meta-name',
364
- 'prefix' => $layout_prefix,
365
- 'value' => $acfe_flexible_render_style,
366
- 'placeholder' => 'style.css'
367
- ));
368
-
369
- echo '</li>';
 
 
 
 
 
 
 
 
 
370
 
371
  $acfe_flexible_render_script = isset($layout['acfe_flexible_render_script']) ? $layout['acfe_flexible_render_script'] : '';
372
-
373
- echo '<li>';
374
-
375
- acf_render_field(array(
376
- 'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
377
- 'name' => 'acfe_flexible_render_script',
378
- 'type' => 'text',
379
- 'class' => 'acf-fc-meta-name',
380
- 'prefix' => $layout_prefix,
381
- 'value' => $acfe_flexible_render_script,
382
- 'placeholder' => 'script.js'
383
- ));
384
-
385
- echo '</li>';
 
 
 
 
 
 
 
 
 
386
 
387
  }
388
 
389
- // Category
390
- if($is_flexible_modal_enabled && $is_flexible_modal_categories){
391
-
392
- $acfe_flexible_category = isset($layout['acfe_flexible_category']) ? $layout['acfe_flexible_category'] : '';
393
-
394
- echo '<li>';
395
-
396
- echo '<div class="acf-label"><label>Modal Category</label></div>';
397
 
398
- acf_render_field(array(
399
- 'prepend' => __('Category'),
400
- 'name' => 'acfe_flexible_category',
401
- 'type' => 'text',
402
- 'class' => 'acf-fc-meta-name',
403
- 'prefix' => $layout_prefix,
404
- 'value' => $acfe_flexible_category,
405
- ));
406
 
407
- echo '</li>';
408
-
409
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
 
411
- if($echo){
412
- ?>
413
- <li class="acf-fc-meta-label">
414
- <div class="acf-label"><label>Settings</label></div>
415
- <?php
416
  }
417
 
418
-
419
  }
420
 
421
  add_filter('acf/field_wrapper_attributes', 'acfe_flexible_wrapper', 10, 2);
@@ -482,36 +523,9 @@ function acfe_flexible_wrapper($wrapper, $field){
482
  $thumbnails = array();
483
 
484
  // Layouts Previews
485
- if(isset($field['acfe_flexible_layouts_thumbnails']) && !empty($field['acfe_flexible_layouts_thumbnails']) && isset($field['acfe_flexible_layouts_previews']) && !empty($field['acfe_flexible_layouts_previews'])){
486
-
487
- $thumbnails = array();
488
-
489
- if(isset($field['layouts']) && !empty($field['layouts'])){
490
-
491
- foreach($field['layouts'] as $layout){
492
-
493
- if(!isset($layout['acfe_flexible_thumbnail']) || empty($layout['acfe_flexible_thumbnail']))
494
- continue;
495
-
496
- // Thumbnail exists
497
- if($thumbnail_src = wp_get_attachment_url($layout['acfe_flexible_thumbnail'])){
498
-
499
- $thumbnails[$layout['name']] = $thumbnail_src;
500
-
501
- }
502
-
503
- }
504
-
505
- }
506
-
507
- }
508
-
509
- $thumbnails = apply_filters("acfe/flexible/previews/name={$field['_name']}", $thumbnails, $field);
510
- $thumbnails = apply_filters("acfe/flexible/previews/key={$field['key']}", $thumbnails, $field);
511
-
512
- if(is_array($thumbnails) && !empty($thumbnails)){
513
 
514
- $wrapper['data-acfe-flexible-preview'] = json_encode($thumbnails);
515
 
516
  }
517
 
@@ -579,7 +593,7 @@ function acfe_flexible_layout_title($field){
579
 
580
  }
581
 
582
- $layout['label'] = $thumbnail . '<span '.$category.'>' . $layout['label'] . '</span>';
583
 
584
  }
585
 
@@ -591,9 +605,9 @@ add_filter('acf/fields/flexible_content/layout_title', 'acfe_flexible_layout_tit
591
  function acfe_flexible_layout_title_remove($title, $field, $layout, $i){
592
 
593
  // Remove thumbnail
594
- $title = preg_replace('/<\/?div[^>]*\>/i', '', $title);
595
 
596
- return $title;
597
 
598
  }
599
 
@@ -601,7 +615,7 @@ add_action('wp_ajax_acfe/flexible/layout_preview', 'acfe_flexible_layout_preview
601
  function acfe_flexible_layout_preview(){
602
 
603
  // Options
604
- $options = acf_parse_args( $_POST, array(
605
  'post_id' => 0,
606
  'i' => 0,
607
  'field_key' => '',
@@ -619,12 +633,48 @@ function acfe_flexible_layout_preview(){
619
  $flexible = acf_get_field_type('flexible_content');
620
 
621
  // Vars
622
- $layout = $flexible->get_layout($options['layout'], $field );
623
  if(!$layout)
624
  die;
625
 
626
- // Do action
627
- do_action('acfe/flexible/layout_preview', $field, $layout, $options['i'], $options['value']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
628
 
629
  die;
630
 
53
  'key' => 'acfe_flexible_empty_message',
54
  'instructions' => __('Text displayed when the flexible field is empty'),
55
  'type' => 'text',
56
+ 'placeholder' => __('Click the "Add Row" button below to start creating your layout'),
57
  'conditional_logic' => array(
58
  array(
59
  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
+ ), true);
86
+
87
+ // Layouts render
88
+ acf_render_field_setting($field, array(
89
+ 'label' => __('Layouts Render'),
90
+ 'name' => 'acfe_flexible_layouts_templates',
91
+ 'key' => 'acfe_flexible_layouts_templates',
92
+ 'instructions' => __('Set template, style & javascript files for each layouts.. You must save the field group to apply this setting'),
93
  'type' => 'true_false',
94
  'message' => '',
95
  'default_value' => false,
100
 
101
  // Layouts preview
102
  acf_render_field_setting($field, array(
103
+ 'label' => __('Layouts Dynamic Preview'),
104
  'name' => 'acfe_flexible_layouts_previews',
105
  'key' => 'acfe_flexible_layouts_previews',
106
+ 'instructions' => __('Use layouts render settings to display a dynamic preview in the post administration'),
107
  'type' => 'true_false',
108
  'message' => '',
109
  'default_value' => false,
113
  'conditional_logic' => array(
114
  array(
115
  array(
116
+ 'field' => 'acfe_flexible_layouts_templates',
117
  'operator' => '==',
118
  'value' => '1',
119
  )
121
  )
122
  ), true);
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  // Modal: Edition
125
  acf_render_field_setting($field, array(
126
  'label' => __('Modal: Edition'),
168
  'name' => 'acfe_flexible_modal_title',
169
  'key' => 'acfe_flexible_modal_title',
170
  'type' => 'text',
171
+ 'prepend' => __('Modal Title'),
172
  'placeholder' => 'Add Row',
173
  'instructions' => false,
174
  'required' => false,
270
 
271
  }
272
 
273
+ add_action('acf/render_field', 'acfe_flexible_layouts_settings_before', 0);
274
+ function acfe_flexible_layouts_settings_before($field){
275
 
276
  if($field['_name'] != 'label' || stripos($field['name'], 'layout_') === false)
277
  return;
278
 
279
+ echo '</li>';
280
 
281
+ acf_render_field_wrap(array(
282
+ 'label' => __('Settings'),
283
+ 'type' => 'hidden',
284
+ 'name' => 'acfe_flexible_settings_label'
285
+ ), 'ul');
286
 
287
+ echo '<li>';
 
288
 
289
+ }
290
+
291
+ add_action('acf/render_field', 'acfe_flexible_layouts_settings', 10);
292
+ function acfe_flexible_layouts_settings($field){
293
 
294
+ if($field['_name'] != 'max' || stripos($field['name'], 'layout_') === false)
295
+ return;
296
 
297
+ $layout_prefix = $field['prefix'];
298
+
299
+ parse_str($layout_prefix, $output);
300
+ $keys = acfe_array_keys_r($output);
301
+
302
+ $_field_id = $keys[1];
303
+ $_layout_key = $keys[3];
304
+
305
+ $field_flexible = acf_get_field($_field_id);
306
+ $layout = $field_flexible['layouts'][$_layout_key];
307
 
308
  $is_flexible_layouts_thumbnails = isset($field_flexible['acfe_flexible_layouts_thumbnails']) && !empty($field_flexible['acfe_flexible_layouts_thumbnails']);
309
  $is_flexible_layouts_templates = isset($field_flexible['acfe_flexible_layouts_templates']) && !empty($field_flexible['acfe_flexible_layouts_templates']);
310
  $is_flexible_modal_enabled = isset($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_enabled']) && !empty($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_enabled']);
311
  $is_flexible_modal_categories = isset($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_categories']) && !empty($field_flexible['acfe_flexible_modal']['acfe_flexible_modal_categories']);
312
 
313
+ // Category
314
+ if($is_flexible_modal_enabled && $is_flexible_modal_categories){
 
315
 
316
+ $acfe_flexible_category = isset($layout['acfe_flexible_category']) ? $layout['acfe_flexible_category'] : '';
 
 
 
 
317
 
318
+ acf_render_field_wrap(array(
319
+ 'prepend' => __('Category'),
320
+ 'name' => 'acfe_flexible_category',
321
+ 'type' => 'text',
322
+ 'class' => 'acf-fc-meta-name',
323
+ 'prefix' => $layout_prefix,
324
+ 'value' => $acfe_flexible_category,
325
+
326
+ /*
327
+ 'conditional_logic' => array(
328
+ array(
329
+ array(
330
+ 'field' => 'acfe_flexible_modal_enabled',
331
+ 'operator' => '==',
332
+ 'value' => '1',
333
+ ),
334
+ array(
335
+ 'field' => 'acfe_flexible_modal_categories',
336
+ 'operator' => '==',
337
+ 'value' => '1',
338
+ )
339
+ )
340
+ )
341
+ */
342
+
343
+ ), 'ul');
344
 
345
  }
346
 
347
  // Template
348
  if($is_flexible_layouts_templates){
 
 
 
 
349
 
350
+ $acfe_flexible_render_template = isset($layout['acfe_flexible_render_template']) ? $layout['acfe_flexible_render_template'] : '';
 
 
 
 
 
 
 
 
 
 
351
 
352
+ acf_render_field_wrap(array(
353
+ 'label' => __('Render'),
354
+ 'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
355
+ 'name' => 'acfe_flexible_render_template',
356
+ 'type' => 'text',
357
+ 'class' => 'acf-fc-meta-name',
358
+ 'prefix' => $layout_prefix,
359
+ 'value' => $acfe_flexible_render_template,
360
+ 'placeholder' => 'template.php',
361
+
362
+ /*
363
+ 'conditional_logic' => array(
364
+ array(
365
+ array(
366
+ 'field' => 'acfe_flexible_layouts_templates',
367
+ 'operator' => '==',
368
+ 'value' => '1',
369
+ )
370
+ )
371
+ )
372
+ */
373
+
374
+ ), 'ul');
375
 
376
  $acfe_flexible_render_style = isset($layout['acfe_flexible_render_style']) ? $layout['acfe_flexible_render_style'] : '';
377
 
378
+ acf_render_field_wrap(array(
379
+ 'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
380
+ 'name' => 'acfe_flexible_render_style',
381
+ 'type' => 'text',
382
+ 'class' => 'acf-fc-meta-name',
383
+ 'prefix' => $layout_prefix,
384
+ 'value' => $acfe_flexible_render_style,
385
+ 'placeholder' => 'style.css',
386
+
387
+ /*
388
+ 'conditional_logic' => array(
389
+ array(
390
+ array(
391
+ 'field' => 'acfe_flexible_layouts_templates',
392
+ 'operator' => '==',
393
+ 'value' => '1',
394
+ )
395
+ )
396
+ )
397
+ */
398
+
399
+ ), 'ul');
400
 
401
  $acfe_flexible_render_script = isset($layout['acfe_flexible_render_script']) ? $layout['acfe_flexible_render_script'] : '';
402
+
403
+ acf_render_field_wrap(array(
404
+ 'prepend' => str_replace(home_url(), '', ACFE_THEME_URL) . '/',
405
+ 'name' => 'acfe_flexible_render_script',
406
+ 'type' => 'text',
407
+ 'class' => 'acf-fc-meta-name',
408
+ 'prefix' => $layout_prefix,
409
+ 'value' => $acfe_flexible_render_script,
410
+ 'placeholder' => 'script.js',
411
+
412
+ /*
413
+ 'conditional_logic' => array(
414
+ array(
415
+ array(
416
+ 'field' => 'acfe_flexible_layouts_templates',
417
+ 'operator' => '==',
418
+ 'value' => '1',
419
+ )
420
+ )
421
+ )
422
+ */
423
+
424
+ ), 'ul');
425
 
426
  }
427
 
428
+ // Thumbnail
429
+ if($is_flexible_layouts_thumbnails){
 
 
 
 
 
 
430
 
431
+ $acfe_flexible_thumbnail = isset($layout['acfe_flexible_thumbnail']) ? $layout['acfe_flexible_thumbnail'] : '';
 
 
 
 
 
 
 
432
 
433
+ acf_render_field_wrap(array(
434
+ 'label' => __('Thumbnail'),
435
+ 'name' => 'acfe_flexible_thumbnail',
436
+ 'type' => 'image',
437
+ 'class' => '',
438
+ 'prefix' => $layout_prefix,
439
+ 'value' => $acfe_flexible_thumbnail,
440
+ 'return_format' => 'array',
441
+ 'preview_size' => 'thumbnail',
442
+ 'library' => 'all',
443
+
444
+ /*
445
+ 'conditional_logic' => array(
446
+ array(
447
+ array(
448
+ 'field' => 'acfe_flexible_layouts_thumbnails',
449
+ 'operator' => '==',
450
+ 'value' => '1',
451
+ )
452
+ )
453
+ )
454
+ */
455
+
456
+ ), 'ul');
457
 
 
 
 
 
 
458
  }
459
 
 
460
  }
461
 
462
  add_filter('acf/field_wrapper_attributes', 'acfe_flexible_wrapper', 10, 2);
523
  $thumbnails = array();
524
 
525
  // Layouts Previews
526
+ if(isset($field['acfe_flexible_layouts_templates']) && !empty($field['acfe_flexible_layouts_templates']) && isset($field['acfe_flexible_layouts_previews']) && !empty($field['acfe_flexible_layouts_previews'])){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
 
528
+ $wrapper['data-acfe-flexible-preview'] = 1;
529
 
530
  }
531
 
593
 
594
  }
595
 
596
+ $layout['label'] = $thumbnail . '<span '.$category.' class="acfe-layout-title">' . $layout['label'] . '</span>';
597
 
598
  }
599
 
605
  function acfe_flexible_layout_title_remove($title, $field, $layout, $i){
606
 
607
  // Remove thumbnail
608
+ $title = preg_replace('#<div class="acfe-flexible-layout-thumbnail(.*?)</div>#', '', $title);
609
 
610
+ return '<span class="acfe-layout-title">' . $title . '</span>';
611
 
612
  }
613
 
615
  function acfe_flexible_layout_preview(){
616
 
617
  // Options
618
+ $options = acf_parse_args($_POST, array(
619
  'post_id' => 0,
620
  'i' => 0,
621
  'field_key' => '',
633
  $flexible = acf_get_field_type('flexible_content');
634
 
635
  // Vars
636
+ $layout = $flexible->get_layout($options['layout'], $field);
637
  if(!$layout)
638
  die;
639
 
640
+ $get_field_object = get_field_object($options['field_key'], $options['post_id'], false, false);
641
+
642
+ $preview_key = 'preview_' . $options['field_key'];
643
+ $get_field_object['key'] = $preview_key;
644
+
645
+ acf_add_local_field($get_field_object);
646
+
647
+ add_filter('acf/load_value/key=' . $preview_key, function($value, $post_id, $field) use($options){
648
+
649
+ $value = array();
650
+ $value[0] = $options['value'];
651
+
652
+ return $value;
653
+
654
+ }, 10, 3);
655
+
656
+ $is_preview = true;
657
+
658
+ if(have_rows($preview_key)):
659
+ while(have_rows($preview_key)): the_row();
660
+
661
+ $render = acfe_flexible_render_layout($layout, $field);
662
+ if(empty($render['template']))
663
+ break;
664
+
665
+ // Style
666
+ if(!empty($render['style']))
667
+ echo $render['style'];
668
+
669
+ // Style
670
+ if(!empty($render['script']))
671
+ echo $render['script'];
672
+
673
+ // Template
674
+ include($render['template']);
675
+
676
+ endwhile;
677
+ endif;
678
 
679
  die;
680
 
includes/fields-settings/image.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ add_filter('gettext', 'acfe_field_image_text', 99, 3);
7
+ function acfe_field_image_text($translated_text, $text, $domain){
8
+
9
+ if($domain != 'acf')
10
+ return $translated_text;
11
+
12
+ if($text === 'No image selected')
13
+ return '';
14
+
15
+ return $translated_text;
16
+
17
+ }
includes/modules/dynamic-block-type.php CHANGED
@@ -40,6 +40,7 @@ function acfe_dbt_register(){
40
  'publicly_queryable' => false,
41
  'capabilities' => array(
42
  'publish_posts' => acf_get_setting('capability'),
 
43
  'edit_others_posts' => acf_get_setting('capability'),
44
  'delete_posts' => acf_get_setting('capability'),
45
  'delete_others_posts' => acf_get_setting('capability'),
40
  'publicly_queryable' => false,
41
  'capabilities' => array(
42
  'publish_posts' => acf_get_setting('capability'),
43
+ 'edit_posts' => acf_get_setting('capability'),
44
  'edit_others_posts' => acf_get_setting('capability'),
45
  'delete_posts' => acf_get_setting('capability'),
46
  'delete_others_posts' => acf_get_setting('capability'),
includes/modules/dynamic-options-page.php CHANGED
@@ -34,6 +34,7 @@ function acfe_dop_register(){
34
  'publicly_queryable' => false,
35
  'capabilities' => array(
36
  'publish_posts' => acf_get_setting('capability'),
 
37
  'edit_others_posts' => acf_get_setting('capability'),
38
  'delete_posts' => acf_get_setting('capability'),
39
  'delete_others_posts' => acf_get_setting('capability'),
34
  'publicly_queryable' => false,
35
  'capabilities' => array(
36
  'publish_posts' => acf_get_setting('capability'),
37
+ 'edit_posts' => acf_get_setting('capability'),
38
  'edit_others_posts' => acf_get_setting('capability'),
39
  'delete_posts' => acf_get_setting('capability'),
40
  'delete_others_posts' => acf_get_setting('capability'),
includes/modules/dynamic-post-type.php CHANGED
@@ -34,6 +34,7 @@ function acfe_dpt_register(){
34
  'publicly_queryable' => false,
35
  'capabilities' => array(
36
  'publish_posts' => acf_get_setting('capability'),
 
37
  'edit_others_posts' => acf_get_setting('capability'),
38
  'delete_posts' => acf_get_setting('capability'),
39
  'delete_others_posts' => acf_get_setting('capability'),
@@ -240,8 +241,7 @@ function acfe_dpt_filter_save($post_id){
240
  $register_args['capability_type'] = $capability_type[0];
241
 
242
  // Capabilities
243
- if(!empty($capabilities))
244
- $register_args['capabilities'] = $capabilities;
245
 
246
  // Map meta cap
247
  $register_args['map_meta_cap'] = null;
@@ -363,10 +363,10 @@ function acfe_dpt_filter_admin_list($query){
363
  $acfe_admin_orderby = (isset($post_type_obj->acfe_admin_orderby) && !empty($post_type_obj->acfe_admin_orderby));
364
  $acfe_admin_order = (isset($post_type_obj->acfe_admin_order) && !empty($post_type_obj->acfe_admin_order));
365
 
366
- if($acfe_admin_orderby && !$_REQUEST['orderby'])
367
  $query->set('orderby', $post_type_obj->acfe_admin_orderby);
368
 
369
- if($acfe_admin_order && !$_REQUEST['order'])
370
  $query->set('order', $post_type_obj->acfe_admin_order);
371
 
372
 
34
  'publicly_queryable' => false,
35
  'capabilities' => array(
36
  'publish_posts' => acf_get_setting('capability'),
37
+ 'edit_posts' => acf_get_setting('capability'),
38
  'edit_others_posts' => acf_get_setting('capability'),
39
  'delete_posts' => acf_get_setting('capability'),
40
  'delete_others_posts' => acf_get_setting('capability'),
241
  $register_args['capability_type'] = $capability_type[0];
242
 
243
  // Capabilities
244
+ $register_args['capabilities'] = $capabilities;
 
245
 
246
  // Map meta cap
247
  $register_args['map_meta_cap'] = null;
363
  $acfe_admin_orderby = (isset($post_type_obj->acfe_admin_orderby) && !empty($post_type_obj->acfe_admin_orderby));
364
  $acfe_admin_order = (isset($post_type_obj->acfe_admin_order) && !empty($post_type_obj->acfe_admin_order));
365
 
366
+ if($acfe_admin_orderby && (!isset($_REQUEST['orderby']) || empty($_REQUEST['orderby'])))
367
  $query->set('orderby', $post_type_obj->acfe_admin_orderby);
368
 
369
+ if($acfe_admin_order && (!isset($_REQUEST['order']) || empty($_REQUEST['order'])))
370
  $query->set('order', $post_type_obj->acfe_admin_order);
371
 
372
 
includes/modules/dynamic-taxonomy.php CHANGED
@@ -34,6 +34,7 @@ function acfe_dt_register(){
34
  'publicly_queryable' => false,
35
  'capabilities' => array(
36
  'publish_posts' => acf_get_setting('capability'),
 
37
  'edit_others_posts' => acf_get_setting('capability'),
38
  'delete_posts' => acf_get_setting('capability'),
39
  'delete_others_posts' => acf_get_setting('capability'),
@@ -335,10 +336,10 @@ function acfe_dt_filter_admin_list($args, $taxonomies){
335
  $acfe_admin_orderby = (isset($taxonomy_obj->acfe_admin_orderby) && !empty($taxonomy_obj->acfe_admin_orderby));
336
  $acfe_admin_order = (isset($taxonomy_obj->acfe_admin_order) && !empty($taxonomy_obj->acfe_admin_order));
337
 
338
- if($acfe_admin_orderby && !$_REQUEST['orderby'])
339
  $args['orderby'] = $taxonomy_obj->acfe_admin_orderby;
340
 
341
- if($acfe_admin_order && !$_REQUEST['order'])
342
  $args['order'] = $taxonomy_obj->acfe_admin_order;
343
 
344
  return $args;
34
  'publicly_queryable' => false,
35
  'capabilities' => array(
36
  'publish_posts' => acf_get_setting('capability'),
37
+ 'edit_posts' => acf_get_setting('capability'),
38
  'edit_others_posts' => acf_get_setting('capability'),
39
  'delete_posts' => acf_get_setting('capability'),
40
  'delete_others_posts' => acf_get_setting('capability'),
336
  $acfe_admin_orderby = (isset($taxonomy_obj->acfe_admin_orderby) && !empty($taxonomy_obj->acfe_admin_orderby));
337
  $acfe_admin_order = (isset($taxonomy_obj->acfe_admin_order) && !empty($taxonomy_obj->acfe_admin_order));
338
 
339
+ if($acfe_admin_orderby && (!isset($_REQUEST['orderby']) || empty($_REQUEST['orderby'])))
340
  $args['orderby'] = $taxonomy_obj->acfe_admin_orderby;
341
 
342
+ if($acfe_admin_order && (!isset($_REQUEST['order']) || empty($_REQUEST['order'])))
343
  $args['order'] = $taxonomy_obj->acfe_admin_order;
344
 
345
  return $args;
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.2
7
  Requires PHP: 5.6
8
- Stable tag: 0.7.5.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -188,8 +188,8 @@ Manage ACF Block Types from ACF > Block Types.
188
  * Hide Empty Message: Hide the native Flexible Content 'Empty' message
189
  * Empty Message: Change the native Flexible Content 'Click the Add Row button below...' message
190
  * Layouts Thumbnails: Add thumbnails for each layout in the layout selection
191
- * Layouts Previews: Use thumbnails as layout preview (replace the native collapsed status)
192
  * Layouts Render: Add `template.php`, `style.css` & `script.js` files settings for each layout. Those settings can be then accessed in the front-end ([More informations in the FAQ](#faq))
 
193
  * Modal Edition: Edit layouts in a modal
194
  * Modal Selection: Change the layout selection into a modal
195
  * Modal Selection Title: Change the layout modal title
@@ -266,32 +266,17 @@ Templates, styles & scripts settings are saved in each layouts. They can be acce
266
 
267
  The settings are saved in the following keys: `acfe_flexible_render_template`, `acfe_flexible_render_style` and `acfe_flexible_render_script`.
268
 
269
- ACF Extended has two functions which will automatically include those files: `get_flexible($selector, $post_id)` and `the_flexible($selector, $post_id)` (`$post_id` is optional).
270
 
271
- Usage example: `echo get_flexible('my_flexible');`.
272
 
273
- = How to override Flexible Content: Layouts Previews images? =
274
 
275
- It is possible to override the Layouts Previews images using the following filter: `filter('acfe/flexible/previews/name=$field_name', $thumbnails, $field)`.
276
 
277
- Usage example:
278
-
279
- `
280
- // My Flexible Content Field name is 'my_flexible'
281
- add_filter('acfe/flexible/previews/name=my_flexible', 'acf_override_layouts_previews', 10, 2);
282
- function acf_override_layouts_previews($thumbnails, $field){
283
-
284
- // My Layout name is 'columns'
285
- $thumbnails['columns'] = 'https://www.example.com/flexible-preview.jpg';
286
-
287
- return $thumbnails;
288
-
289
- }
290
- `
291
 
292
- Note: The field setting 'Layouts Previews' is optional. You can still use this filter without activating it.
293
-
294
- Note (2): The image container has a default background color set to: `#fafafa`. If you would like to use an another background color, you will have to add a CSS rule targeting the following class: `.acfe-flexible-collapsed-preview`.
295
 
296
  == Screenshots ==
297
 
@@ -308,6 +293,23 @@ Note (2): The image container has a default background color set to: `#fafafa`.
308
 
309
  == Changelog ==
310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  = 0.7.5.5 =
312
  * Field: Flexible Content - Completely revamped Flexible Content JavaScript for a more solid & optimized code
313
  * Field: Flexible Content - Automatically scroll to the layout position when adding a new layout
5
  Requires at least: 4.9
6
  Tested up to: 5.2
7
  Requires PHP: 5.6
8
+ Stable tag: 0.7.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
188
  * Hide Empty Message: Hide the native Flexible Content 'Empty' message
189
  * Empty Message: Change the native Flexible Content 'Click the Add Row button below...' message
190
  * Layouts Thumbnails: Add thumbnails for each layout in the layout selection
 
191
  * Layouts Render: Add `template.php`, `style.css` & `script.js` files settings for each layout. Those settings can be then accessed in the front-end ([More informations in the FAQ](#faq))
192
+ * Layouts Dynamic Preview: Edit & Preview Layouts on-the-fly from your WordPress administration, just like in Gutenberg (Layouts Render must be turned ON)
193
  * Modal Edition: Edit layouts in a modal
194
  * Modal Selection: Change the layout selection into a modal
195
  * Modal Selection Title: Change the layout modal title
266
 
267
  The settings are saved in the following keys: `acfe_flexible_render_template`, `acfe_flexible_render_style` and `acfe_flexible_render_script`.
268
 
269
+ ACF Extended has two functions which will automatically include those files: `echo get_flexible($selector, $post_id)` or `the_flexible($selector, $post_id)` (`$post_id` is optional).
270
 
271
+ Usage example: `the_flexible('my_flexible');`.
272
 
273
+ When using this function, you have access to the following global variables: `$layout`, `$field` & `$is_preview` (when Dynamic Preview setting is enabled).
274
 
275
+ [More informations are available on the official website](https://www.acf-extended.com/post/flexible-content-dynamic-layout-preview)
276
 
277
+ = How the Flexible Content: Dynamic Preview works? =
 
 
 
 
 
 
 
 
 
 
 
 
 
278
 
279
+ [More informations are available on the official website](https://www.acf-extended.com/post/flexible-content-dynamic-layout-preview)
 
 
280
 
281
  == Screenshots ==
282
 
293
 
294
  == Changelog ==
295
 
296
+ = 0.7.8 =
297
+ * Field: Flexible Content - Removed 'Layouts Thumbnail as Preview' setting. You should now use 'Layouts: Dynamic Preview', and
298
+ * Field: Flexible Content - Added 'Layouts: Dynamic Preview' ('Layouts: Render' setting must be turned ON)
299
+ * Field: Flexible Content - Reworked layouts settings order (better readability)
300
+ * Field: Flexible Content - Modal Edition title now removes eventual extra HTML tags (thanks @Thomas D.)
301
+ * Field: Flexible Content - Modal Edition CSS has been fixed on Gutenberg Editor view (thanks @Val)
302
+ * Field: Flexible Content - Fixed 'Empty Message' placeholder setting using wrong `__()` function (thanks @illiminal)
303
+ * Field: Flexible Content - Removed query vars from `get_flexible()`. Global variables `$layout` & `$field` can be used in the template to retrieve current settings
304
+ * Field: Flexible Content - Added global variable `$is_preview` which is true when the template file is called as a layout preview
305
+ * Field: Flexible Content - `get_flexible()` now uses `wp_enqueue_style()` & `wp_enqueue_script()` when rendering on front-end
306
+ * Field: Image - 'No image selected' text has been removed
307
+ * Module: Dynamic Post Types/Taxonomies - Fixed 'index key not found' PHP warning (thanks @Val)
308
+ * Module: Dynamic Post Types/Taxonomies/Options & Block Types - Added `edit_posts` capabilities matching the ACF capability setting
309
+ * Tools: Dynamic Post Type Import - Fixed 'capabilities key not found' PHP warning during import process (thanks @Val)
310
+ * General: Improved Metaboxes CSS on Gutenberg Editor views
311
+ * General: Reworked JS enqueue. Flexible Content JS is now excluded from ACF Field Groups views
312
+
313
  = 0.7.5.5 =
314
  * Field: Flexible Content - Completely revamped Flexible Content JavaScript for a more solid & optimized code
315
  * Field: Flexible Content - Automatically scroll to the layout position when adding a new layout