Version Description
- Field: Flexible Content - Completely revamped Flexible Content JavaScript for a more solid & optimized code
- Field: Flexible Content - Automatically scroll to the layout position when adding a new layout
- Field: Flexible Content - Automatically open layout edition modal when adding a new layout
- Field: Flexible Content - Added 'Close' (collapse) button at the bottom of layout when opened
- Field: Flexible Content - Fixed typo error in the 'Paste Layouts' prompt
- Field: Flexible Content - Added Flexbox CSS compatibility
- Field: Flexible Content - Better Multi Modal Handling (modal inside a modal inside a modal...)
- Field: Flexible Content - Better Field Validation Handling inside layouts
- Field: Flexible Content - Added
has_flexible($field_name, $post_id)
front-end function to check if rows exists - Field: Flexible Content Control - Automatically scroll to the new layout position when using 'Clone Layout'
- Field: Flexible Content Control - Fixed 'Clone Layout' when an already cloned layout had an 'Editor' field
- Field: Flexible Content Control - Fixed 'Clone Layout' unwanted icon when a layout had an 'Accordion' field
- Field: Advanced Validation/Update - The settings are now hidden on non-necessary fields (Clone, Flexible content, Tabs etc...)
- Module: Dynamic Options Pages - Now forces a unique slug to avoid duplication
- Module: Dynamic Post Types/Taxonomies/Options Pages & Block Types - Manual Json export has been removed from possible actions on the trashed status screen
- Module: Options - Fixed a CSS enqueue problem introduced in last patch
- Location: Post Type Archive & Taxonomy Archive options now use ACF multi-languages settings
- General: Removed jQuery UI & jQuery UI Dialog dependency (ACF Extended now uses its own lightweight modal system)
Download this release
Release Info
Developer | hwk-fr |
Plugin | Advanced Custom Fields: Extended |
Version | 0.7.5.5 |
Comparing to | |
See all releases |
Code changes from version 0.7.5 to 0.7.5.5
- acf-extended.php +1 -1
- assets/acf-extended-fc-control.js +321 -374
- assets/acf-extended-fc-modal-edit.css +3 -3
- assets/acf-extended-fc-modal-edit.js +48 -116
- assets/acf-extended-fc-modal-select.js +161 -137
- assets/acf-extended-fc.css +58 -36
- assets/acf-extended-fc.js +194 -106
- assets/acf-extended-fg.css +0 -36
- assets/acf-extended-modal.css +29 -9
- assets/acf-extended.css +42 -0
- assets/acf-extended.js +23 -1
- includes/admin/tools/dop-import.php +1 -0
- includes/core/enqueue.php +2 -8
- includes/core/helpers.php +13 -0
- includes/fields-settings/flexible-content.php +34 -1
- includes/fields-settings/update.php +16 -9
- includes/fields-settings/validation.php +16 -5
- includes/locations/post-type-archive.php +18 -1
- includes/locations/taxonomy-archive.php +18 -1
- includes/modules/dynamic-block-type.php +1 -1
- includes/modules/dynamic-options-page.php +86 -20
- includes/modules/dynamic-post-type.php +1 -1
- includes/modules/dynamic-taxonomy.php +1 -1
- readme.txt +25 -2
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
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
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
|
assets/acf-extended-fc-control.js
CHANGED
@@ -3,429 +3,310 @@
|
|
3 |
if(typeof acf === 'undefined')
|
4 |
return;
|
5 |
|
6 |
-
/*
|
7 |
-
*
|
8 |
*/
|
9 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
// set HTML
|
14 |
-
this.html(this.get('text'));
|
15 |
-
|
16 |
-
// add class
|
17 |
-
this.$el.addClass('acf-fc-popup');
|
18 |
-
|
19 |
-
}
|
20 |
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
*/
|
28 |
-
var $layouts = flexible.$layouts();
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
$layouts.each(function(){
|
33 |
-
|
34 |
-
var $layout = $(this);
|
35 |
-
|
36 |
-
var $controls = $layout.find('> .acf-fc-layout-controls');
|
37 |
-
|
38 |
-
// Remove potential duplicated buttons
|
39 |
-
$controls.find('> .acfe-flexible-icon').remove();
|
40 |
-
|
41 |
-
// Add Button: Copy
|
42 |
-
$controls.prepend('<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.attr('data-layout') + '"></a>');
|
43 |
-
|
44 |
-
// Add Button: Clone
|
45 |
-
$controls.prepend('<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.attr('data-layout') + '"></a>');
|
46 |
-
|
47 |
-
|
48 |
-
});
|
49 |
-
|
50 |
-
}
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
*/
|
55 |
-
var $clones = flexible.$clones();
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
$clones.each(function(){
|
60 |
-
|
61 |
-
var $layout = $(this);
|
62 |
-
|
63 |
-
var $controls = $layout.find('> .acf-fc-layout-controls');
|
64 |
-
|
65 |
-
// Remove potential duplicated buttons
|
66 |
-
$controls.find('> .acfe-flexible-icon').remove();
|
67 |
-
|
68 |
-
// Add Button: Copy
|
69 |
-
$controls.prepend('<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.attr('data-layout') + '"></a>');
|
70 |
-
|
71 |
-
// Add Button: Clone
|
72 |
-
$controls.prepend('<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.attr('data-layout') + '"></a>');
|
73 |
-
|
74 |
-
|
75 |
-
});
|
76 |
-
|
77 |
-
}
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
acfe_flexible_control_clean_layout($layout);
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
|
|
|
|
|
98 |
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
-
//
|
107 |
-
var $
|
108 |
|
109 |
-
//
|
110 |
-
$
|
111 |
-
|
112 |
-
$(this).attr('value', this.value);
|
113 |
-
|
114 |
-
});
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
$(this).html(this.value);
|
120 |
-
|
121 |
-
});
|
122 |
|
123 |
-
//
|
124 |
-
|
|
|
|
|
|
|
125 |
|
126 |
-
|
127 |
-
$(this).attr('checked', 'checked');
|
128 |
-
else
|
129 |
-
$(this).attr('checked', false);
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
// Fix Select value
|
134 |
-
$layout.find('option').each(function(){
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
140 |
|
141 |
});
|
142 |
|
143 |
-
//
|
144 |
-
|
145 |
-
|
146 |
-
// Get layout data
|
147 |
-
var layout_data = JSON.stringify($layout[0].outerHTML);
|
148 |
|
149 |
-
//
|
150 |
-
|
151 |
-
|
152 |
-
// Command: Copy
|
153 |
-
if(document.execCommand('copy')){
|
154 |
|
155 |
-
|
|
|
|
|
|
|
156 |
|
157 |
-
}
|
158 |
|
159 |
-
|
160 |
-
else{
|
161 |
-
|
162 |
-
prompt('Copy the following layout data to your clipboard', layout_data);
|
163 |
-
|
164 |
-
}
|
165 |
|
166 |
-
|
167 |
-
|
168 |
|
169 |
}
|
170 |
|
171 |
-
|
|
|
|
|
|
|
|
|
172 |
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
-
|
190 |
-
|
191 |
|
192 |
-
if(
|
193 |
-
|
194 |
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
-
//
|
199 |
-
|
200 |
-
|
201 |
-
var $this = $(this);
|
202 |
-
|
203 |
-
// Validate layout against available layouts
|
204 |
-
var get_clone_layout = flexible.$clone($this.attr('data-layout'));
|
205 |
|
206 |
-
//
|
207 |
-
|
208 |
-
return;
|
209 |
-
|
210 |
-
// Add validated layout
|
211 |
-
validated_layouts.push($this);
|
212 |
|
213 |
-
}
|
214 |
-
|
215 |
-
// Nothing to add
|
216 |
-
if(!validated_layouts.length)
|
217 |
-
return alert('No corresponding layouts found');
|
218 |
|
219 |
-
//
|
220 |
-
|
221 |
|
222 |
-
|
223 |
-
layout: $(this),
|
224 |
-
before: false
|
225 |
-
});
|
226 |
|
227 |
-
}
|
228 |
-
|
229 |
-
}catch(e){
|
230 |
-
|
231 |
-
alert('Invalid data');
|
232 |
-
|
233 |
-
}
|
234 |
-
|
235 |
-
}
|
236 |
-
|
237 |
-
/*
|
238 |
-
* Dropdown: Copy All layouts
|
239 |
-
*/
|
240 |
-
function acfe_flexible_control_button_copy(flexible){
|
241 |
-
|
242 |
-
// Get layouts
|
243 |
-
var $layouts = flexible.$layoutsWrap().clone();
|
244 |
-
|
245 |
-
// Fix attribute value different to DOM
|
246 |
-
$layouts.find('input').each(function(){
|
247 |
-
|
248 |
-
$(this).attr('value', this.value);
|
249 |
-
|
250 |
-
});
|
251 |
-
|
252 |
-
$layouts.find('textarea').each(function(){
|
253 |
-
|
254 |
-
$(this).html(this.value);
|
255 |
-
|
256 |
-
});
|
257 |
-
|
258 |
-
$layouts.find('input:radio,input:checkbox').each(function() {
|
259 |
-
|
260 |
-
if(this.checked)
|
261 |
-
$(this).attr('checked', 'checked');
|
262 |
-
else
|
263 |
-
$(this).attr('checked', false);
|
264 |
-
|
265 |
-
});
|
266 |
-
|
267 |
-
$layouts.find('option').each(function(){
|
268 |
-
if(this.selected)
|
269 |
-
$(this).attr('selected', 'selected');
|
270 |
-
else
|
271 |
-
$(this).attr('selected', false);
|
272 |
-
});
|
273 |
-
|
274 |
-
// Clean layout
|
275 |
-
acfe_flexible_control_clean_layout($layouts);
|
276 |
-
|
277 |
-
// Get layouts data
|
278 |
-
var layouts_data = JSON.stringify($layouts.html());
|
279 |
-
|
280 |
-
var input = '<input type="text" style="clip:rect(0,0,0,0); clip-path:rect(0,0,0,0); position: absolute;" class="acfe_button_copy_input" value="" />';
|
281 |
-
|
282 |
-
flexible.$el.append(input);
|
283 |
-
var $copy_layout_button = flexible.$el.find('.acfe_button_copy_input');
|
284 |
-
|
285 |
-
// Command: Copy select the input
|
286 |
-
$copy_layout_button.attr('value', layouts_data).select();
|
287 |
-
|
288 |
-
// Command: Copy
|
289 |
-
if(document.execCommand('copy')){
|
290 |
|
291 |
-
|
|
|
292 |
|
293 |
-
|
294 |
-
|
295 |
-
// Command: Copy not available. Display prompt
|
296 |
-
else{
|
297 |
|
298 |
-
|
299 |
-
|
300 |
-
}
|
301 |
-
|
302 |
-
$copy_layout_button.remove();
|
303 |
-
|
304 |
-
}
|
305 |
-
|
306 |
-
/*
|
307 |
-
* Dropdown HTML
|
308 |
-
*/
|
309 |
-
var dropdown_grey =
|
310 |
-
'<a href="#" class="button" style="padding-left:5px;padding-right:5px; margin-left:3px;" data-name="acfe-flexible-control-button">' +
|
311 |
-
' <span class="dashicons dashicons-arrow-down-alt2" style="vertical-align:text-top;width:auto;height:auto;font-size:13px;line-height:20px;"></span>' +
|
312 |
-
'</a>' +
|
313 |
-
|
314 |
-
'<script type="text-html" class="tmpl-acfe-flexible-control-popup">' +
|
315 |
-
' <ul>' +
|
316 |
-
' <li><a href="#" data-acfe-flexible-control-action="copy">Copy layouts</a></li>' +
|
317 |
-
' <li><a href="#" data-acfe-flexible-control-action="paste">Paste layouts</a></li>' +
|
318 |
-
' </ul>';
|
319 |
-
'</ul>';
|
320 |
-
|
321 |
-
var dropdown_blue =
|
322 |
-
'<a href="#" class="button button-primary" style="padding-left:5px;padding-right:5px; margin-left:3px;" data-name="acfe-flexible-control-button">' +
|
323 |
-
' <span class="dashicons dashicons-arrow-down-alt2" style="vertical-align:text-top;width:auto;height:auto;font-size:13px;line-height:20px;"></span>' +
|
324 |
-
'</a>' +
|
325 |
-
|
326 |
-
'<script type="text-html" class="tmpl-acfe-flexible-control-popup">' +
|
327 |
-
' <ul>' +
|
328 |
-
' <li><a href="#" data-acfe-flexible-control-action="copy">Copy layouts</a></li>' +
|
329 |
-
' <li><a href="#" data-acfe-flexible-control-action="paste">Paste layouts</a></li>' +
|
330 |
-
' </ul>';
|
331 |
-
'</ul>';
|
332 |
-
|
333 |
-
// Remove potential duplicated buttons
|
334 |
-
flexible.$el.find('> .acf-input > .acf-flexible-content > .acfe-flexible-stylised-button > .acf-actions > [data-name="acfe-flexible-control-button"]').remove();
|
335 |
-
flexible.$el.find('> .acf-input > .acf-flexible-content > .acf-actions > [data-name="acfe-flexible-control-button"]').remove();
|
336 |
|
337 |
-
//
|
338 |
-
|
339 |
-
flexible.$el.find('> .acf-input > .acf-flexible-content > .acf-actions > .acf-button').after(dropdown_blue);
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
*/
|
344 |
-
flexible.acfe_flexible_control_button = function(e, $el){
|
345 |
-
|
346 |
-
var $button = $el;
|
347 |
-
var $dropdown = $button.next('.tmpl-acfe-flexible-control-popup').html();
|
348 |
-
|
349 |
-
// new popup
|
350 |
-
var popup = new Popup({
|
351 |
-
target: $button,
|
352 |
-
targetConfirm: false,
|
353 |
-
text: $dropdown,
|
354 |
-
context: this,
|
355 |
-
confirm: function(e, $el){
|
356 |
-
|
357 |
-
if($el.attr('data-acfe-flexible-control-action') == 'paste')
|
358 |
-
acfe_flexible_control_button_paste(flexible);
|
359 |
-
|
360 |
-
else if($el.attr('data-acfe-flexible-control-action') == 'copy')
|
361 |
-
acfe_flexible_control_button_copy(flexible);
|
362 |
-
|
363 |
-
}
|
364 |
-
});
|
365 |
-
|
366 |
-
popup.on('click', 'a', 'onConfirm');
|
367 |
-
|
368 |
-
}
|
369 |
|
370 |
-
|
|
|
|
|
|
|
371 |
|
372 |
-
|
373 |
-
* ACFE: Flexible Duplicate Layout
|
374 |
-
*/
|
375 |
-
flexible.acfe_duplicate_layout = function(args){
|
376 |
|
377 |
-
|
378 |
-
args = acf.parseArgs(args, {
|
379 |
-
layout: '',
|
380 |
-
before: false
|
381 |
-
});
|
382 |
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
|
387 |
-
|
388 |
-
var $el = acf.duplicate({
|
389 |
-
target: args.layout,
|
390 |
-
append: this.proxy(function($el, $el2){
|
391 |
-
|
392 |
-
// append before
|
393 |
-
if(args.before){
|
394 |
-
|
395 |
-
// Fix clone: Use after() instead of native before()
|
396 |
-
args.before.after($el2);
|
397 |
-
|
398 |
-
}
|
399 |
-
|
400 |
-
// append end
|
401 |
-
else{
|
402 |
-
|
403 |
-
this.$layoutsWrap().append($el2);
|
404 |
-
|
405 |
-
}
|
406 |
-
|
407 |
-
// enable
|
408 |
-
acf.enable($el2, this.cid);
|
409 |
-
|
410 |
-
// render
|
411 |
-
this.render();
|
412 |
-
|
413 |
-
})
|
414 |
-
});
|
415 |
|
416 |
-
|
417 |
-
|
|
|
418 |
|
419 |
-
|
420 |
-
|
|
|
|
|
421 |
|
422 |
-
}
|
423 |
-
|
424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
|
426 |
-
|
|
|
427 |
|
428 |
-
//
|
429 |
$layout.find('.acf-editor-wrap').each(function(){
|
430 |
|
431 |
var $input = $(this);
|
@@ -435,7 +316,7 @@
|
|
435 |
|
436 |
});
|
437 |
|
438 |
-
//
|
439 |
$layout.find('.acf-date-picker').each(function(){
|
440 |
|
441 |
var $input = $(this);
|
@@ -444,7 +325,7 @@
|
|
444 |
|
445 |
});
|
446 |
|
447 |
-
//
|
448 |
$layout.find('.acf-time-picker').each(function(){
|
449 |
|
450 |
var $input = $(this);
|
@@ -453,7 +334,7 @@
|
|
453 |
|
454 |
});
|
455 |
|
456 |
-
//
|
457 |
$layout.find('.acf-date-time-picker').each(function(){
|
458 |
|
459 |
var $input = $(this);
|
@@ -462,7 +343,7 @@
|
|
462 |
|
463 |
});
|
464 |
|
465 |
-
//
|
466 |
$layout.find('.acf-color-picker').each(function(){
|
467 |
|
468 |
var $input = $(this);
|
@@ -476,7 +357,7 @@
|
|
476 |
|
477 |
});
|
478 |
|
479 |
-
//
|
480 |
$layout.find('.acf-field-post-object').each(function(){
|
481 |
|
482 |
var $input = $(this);
|
@@ -487,7 +368,7 @@
|
|
487 |
|
488 |
});
|
489 |
|
490 |
-
//
|
491 |
$layout.find('.acf-field-page-link').each(function(){
|
492 |
|
493 |
var $input = $(this);
|
@@ -498,7 +379,7 @@
|
|
498 |
|
499 |
});
|
500 |
|
501 |
-
//
|
502 |
$layout.find('.acf-tab-wrap').each(function(){
|
503 |
|
504 |
var $wrap = $(this);
|
@@ -533,6 +414,72 @@
|
|
533 |
|
534 |
});
|
535 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
}
|
537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
})(jQuery);
|
3 |
if(typeof acf === 'undefined')
|
4 |
return;
|
5 |
|
6 |
+
/*
|
7 |
+
* Init
|
8 |
*/
|
9 |
+
var flexible = acf.getFieldType('flexible_content');
|
10 |
+
var model = flexible.prototype;
|
11 |
+
|
12 |
+
/*
|
13 |
+
* Actions
|
14 |
+
*/
|
15 |
+
|
16 |
+
// Layout: Clone
|
17 |
+
model.events['click [data-acfe-flexible-control-clone]'] = 'acfeCloneLayout';
|
18 |
+
model.acfeCloneLayout = function(e, $el){
|
19 |
|
20 |
+
// Get Flexible
|
21 |
+
var flexible = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
// Vars
|
24 |
+
var $layout_original = $el.closest('.layout');
|
25 |
+
var $layout = $el.closest('.layout').clone();
|
26 |
+
|
27 |
+
// Fix TinyMCE attribute value
|
28 |
+
$layout.find('textarea').each(function(){
|
29 |
+
$(this).html(this.value);
|
30 |
+
});
|
31 |
+
|
32 |
+
// Clean Layout
|
33 |
+
flexible.acfeCleanLayouts($layout);
|
34 |
+
|
35 |
+
// Clone
|
36 |
+
var $layout_added = flexible.acfeDuplicate({
|
37 |
+
layout: $layout,
|
38 |
+
before: $layout_original
|
39 |
+
});
|
40 |
+
|
41 |
+
// Scroll to new layout
|
42 |
+
$('html, body').animate({
|
43 |
+
scrollTop: parseInt($layout_added.offset().top) - 200
|
44 |
+
}, 200);
|
45 |
+
|
46 |
+
}
|
47 |
|
48 |
+
// Layout: Copy
|
49 |
+
model.events['click [data-acfe-flexible-control-copy]'] = 'acfeCopyLayout';
|
50 |
+
model.acfeCopyLayout = function(e, $el){
|
51 |
|
52 |
+
// Get Flexible
|
53 |
+
var flexible = this;
|
|
|
|
|
54 |
|
55 |
+
// Vars
|
56 |
+
var $layout = $el.closest('.layout').clone();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
+
// Fix inputs
|
59 |
+
flexible.acfeFixInputs($layout);
|
|
|
|
|
60 |
|
61 |
+
// Clean layout
|
62 |
+
flexible.acfeCleanLayouts($layout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
+
// Get layout data
|
65 |
+
var data = JSON.stringify($layout[0].outerHTML);
|
66 |
+
|
67 |
+
// Append Temp Input
|
68 |
+
var $input = $('<input type="text" style="clip:rect(0,0,0,0);clip-path:rect(0,0,0,0);position:absolute;" value="" />').appendTo($el);
|
69 |
+
$input.attr('value', data).select();
|
70 |
+
|
71 |
+
// Command: Copy
|
72 |
+
if(document.execCommand('copy'))
|
73 |
+
alert('Layout has been transferred to your clipboard');
|
|
|
74 |
|
75 |
+
// Prompt
|
76 |
+
else
|
77 |
+
prompt('Copy the following layout data to your clipboard', data);
|
78 |
+
|
79 |
+
// Remove the temp input
|
80 |
+
$input.remove();
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
// Flexible: Copy Layouts
|
85 |
+
model.acfeCopyLayouts = function(){
|
86 |
+
|
87 |
+
// Get Flexible
|
88 |
+
var flexible = this;
|
89 |
+
|
90 |
+
// Get layouts
|
91 |
+
var $layouts = flexible.$layoutsWrap().clone();
|
92 |
+
|
93 |
+
// Fix inputs
|
94 |
+
flexible.acfeFixInputs($layouts);
|
95 |
+
|
96 |
+
// Clean layout
|
97 |
+
flexible.acfeCleanLayouts($layouts);
|
98 |
+
|
99 |
+
// Get layouts data
|
100 |
+
var data = JSON.stringify($layouts.html());
|
101 |
+
|
102 |
+
// Append Temp Input
|
103 |
+
var $input = $('<input type="text" style="clip:rect(0,0,0,0);clip-path:rect(0,0,0,0);position:absolute;" value="" />').appendTo(flexible.$el);
|
104 |
+
$input.attr('value', data).select();
|
105 |
+
|
106 |
+
// Command: Copy
|
107 |
+
if(document.execCommand('copy'))
|
108 |
+
alert('Layouts have been transferred to your clipboard');
|
109 |
|
110 |
+
// Prompt
|
111 |
+
else
|
112 |
+
prompt('Copy the following layouts data to your clipboard', data);
|
113 |
|
114 |
+
$input.remove();
|
115 |
|
116 |
+
}
|
117 |
+
|
118 |
+
// Flexible: Paste Layouts
|
119 |
+
model.acfePasteLayouts = function(){
|
120 |
+
|
121 |
+
// Get Flexible
|
122 |
+
var flexible = this;
|
123 |
+
|
124 |
+
var paste = prompt('Paste layouts data in the following field');
|
125 |
+
|
126 |
+
// No input
|
127 |
+
if(paste == null || paste == '')
|
128 |
+
return;
|
129 |
+
|
130 |
+
try{
|
131 |
|
132 |
+
// Paste HTML
|
133 |
+
var $html = $(JSON.parse(paste));
|
134 |
|
135 |
+
// Parsed layouts
|
136 |
+
var $html_layouts = $html.closest('[data-layout]');
|
|
|
|
|
|
|
|
|
137 |
|
138 |
+
if(!$html_layouts.length)
|
139 |
+
return alert('No layouts data available');
|
|
|
|
|
|
|
|
|
140 |
|
141 |
+
// init
|
142 |
+
var validated_layouts = [];
|
143 |
+
|
144 |
+
// Each first level layouts
|
145 |
+
$html_layouts.each(function(){
|
146 |
|
147 |
+
var $this = $(this);
|
|
|
|
|
|
|
148 |
|
149 |
+
// Validate layout against available layouts
|
150 |
+
var get_clone_layout = flexible.$clone($this.attr('data-layout'));
|
|
|
|
|
151 |
|
152 |
+
// Layout is invalid
|
153 |
+
if(!get_clone_layout.length)
|
154 |
+
return;
|
155 |
+
|
156 |
+
// Add validated layout
|
157 |
+
validated_layouts.push($this);
|
158 |
|
159 |
});
|
160 |
|
161 |
+
// Nothing to add
|
162 |
+
if(!validated_layouts.length)
|
163 |
+
return alert('No corresponding layouts found');
|
|
|
|
|
164 |
|
165 |
+
// Add layouts
|
166 |
+
$.each(validated_layouts, function(){
|
|
|
|
|
|
|
167 |
|
168 |
+
flexible.acfeDuplicate({
|
169 |
+
layout: $(this),
|
170 |
+
before: false
|
171 |
+
});
|
172 |
|
173 |
+
});
|
174 |
|
175 |
+
}catch(e){
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
+
console.log(e);
|
178 |
+
alert('Invalid data');
|
179 |
|
180 |
}
|
181 |
|
182 |
+
}
|
183 |
+
|
184 |
+
// Flexible: Dropdown
|
185 |
+
model.events['click [data-name="acfe-flexible-control-button"]'] = 'acfeControl';
|
186 |
+
model.acfeControl = function(e, $el){
|
187 |
|
188 |
+
// Get Flexible
|
189 |
+
var flexible = this;
|
190 |
+
|
191 |
+
// Vars
|
192 |
+
var $dropdown = $el.next('.tmpl-acfe-flexible-control-popup').html();
|
193 |
+
|
194 |
+
// Init Popup
|
195 |
+
var Popup = acf.models.TooltipConfirm.extend({
|
196 |
+
render: function(){
|
197 |
+
this.html(this.get('text'));
|
198 |
+
this.$el.addClass('acf-fc-popup');
|
199 |
+
}
|
200 |
+
});
|
201 |
+
|
202 |
+
// New Popup
|
203 |
+
var popup = new Popup({
|
204 |
+
target: $el,
|
205 |
+
targetConfirm: false,
|
206 |
+
text: $dropdown,
|
207 |
+
context: flexible,
|
208 |
+
confirm: function(e, $el){
|
209 |
|
210 |
+
if($el.attr('data-acfe-flexible-control-action') == 'paste')
|
211 |
+
flexible.acfePasteLayouts();
|
212 |
|
213 |
+
else if($el.attr('data-acfe-flexible-control-action') == 'copy')
|
214 |
+
flexible.acfeCopyLayouts();
|
215 |
|
216 |
+
}
|
217 |
+
});
|
218 |
+
|
219 |
+
popup.on('click', 'a', 'onConfirm');
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
// Flexible: Duplicate
|
224 |
+
model.acfeDuplicate = function(args){
|
225 |
+
|
226 |
+
// Arguments
|
227 |
+
args = acf.parseArgs(args, {
|
228 |
+
layout: '',
|
229 |
+
before: false
|
230 |
+
});
|
231 |
+
|
232 |
+
// Validate
|
233 |
+
if(!this.allowAdd())
|
234 |
+
return false;
|
235 |
+
|
236 |
+
// Add row
|
237 |
+
var $el = acf.duplicate({
|
238 |
+
target: args.layout,
|
239 |
+
append: this.proxy(function($el, $el2){
|
240 |
|
241 |
+
// append before
|
242 |
+
if(args.before){
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
+
// Fix clone: Use after() instead of native before()
|
245 |
+
args.before.after($el2);
|
|
|
|
|
|
|
|
|
246 |
|
247 |
+
}
|
|
|
|
|
|
|
|
|
248 |
|
249 |
+
// append end
|
250 |
+
else{
|
251 |
|
252 |
+
this.$layoutsWrap().append($el2);
|
|
|
|
|
|
|
253 |
|
254 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
|
256 |
+
// enable
|
257 |
+
acf.enable($el2, this.cid);
|
258 |
|
259 |
+
// render
|
260 |
+
this.render();
|
|
|
|
|
261 |
|
262 |
+
})
|
263 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
|
265 |
+
// trigger change for validation errors
|
266 |
+
this.$input().trigger('change');
|
|
|
267 |
|
268 |
+
// return
|
269 |
+
return $el;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
+
}
|
272 |
+
|
273 |
+
// Flexible: Fix Inputs
|
274 |
+
model.acfeFixInputs = function($layout){
|
275 |
|
276 |
+
$layout.find('input').each(function(){
|
|
|
|
|
|
|
277 |
|
278 |
+
$(this).attr('value', this.value);
|
|
|
|
|
|
|
|
|
279 |
|
280 |
+
});
|
281 |
+
|
282 |
+
$layout.find('textarea').each(function(){
|
283 |
|
284 |
+
$(this).html(this.value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
|
286 |
+
});
|
287 |
+
|
288 |
+
$layout.find('input:radio,input:checkbox').each(function() {
|
289 |
|
290 |
+
if(this.checked)
|
291 |
+
$(this).attr('checked', 'checked');
|
292 |
+
else
|
293 |
+
$(this).attr('checked', false);
|
294 |
|
295 |
+
});
|
296 |
+
|
297 |
+
$layout.find('option').each(function(){
|
298 |
+
if(this.selected)
|
299 |
+
$(this).attr('selected', 'selected');
|
300 |
+
else
|
301 |
+
$(this).attr('selected', false);
|
302 |
+
});
|
303 |
+
|
304 |
+
}
|
305 |
|
306 |
+
// Flexible: Clean Layout
|
307 |
+
model.acfeCleanLayouts = function($layout){
|
308 |
|
309 |
+
// Clean WP Editor
|
310 |
$layout.find('.acf-editor-wrap').each(function(){
|
311 |
|
312 |
var $input = $(this);
|
316 |
|
317 |
});
|
318 |
|
319 |
+
// Clean Date
|
320 |
$layout.find('.acf-date-picker').each(function(){
|
321 |
|
322 |
var $input = $(this);
|
325 |
|
326 |
});
|
327 |
|
328 |
+
// Clean Time
|
329 |
$layout.find('.acf-time-picker').each(function(){
|
330 |
|
331 |
var $input = $(this);
|
334 |
|
335 |
});
|
336 |
|
337 |
+
// Clean DateTime
|
338 |
$layout.find('.acf-date-time-picker').each(function(){
|
339 |
|
340 |
var $input = $(this);
|
343 |
|
344 |
});
|
345 |
|
346 |
+
// Clean Color Picker
|
347 |
$layout.find('.acf-color-picker').each(function(){
|
348 |
|
349 |
var $input = $(this);
|
357 |
|
358 |
});
|
359 |
|
360 |
+
// Clean Post Object
|
361 |
$layout.find('.acf-field-post-object').each(function(){
|
362 |
|
363 |
var $input = $(this);
|
368 |
|
369 |
});
|
370 |
|
371 |
+
// Clean Page Link
|
372 |
$layout.find('.acf-field-page-link').each(function(){
|
373 |
|
374 |
var $input = $(this);
|
379 |
|
380 |
});
|
381 |
|
382 |
+
// Clean Tab
|
383 |
$layout.find('.acf-tab-wrap').each(function(){
|
384 |
|
385 |
var $wrap = $(this);
|
414 |
|
415 |
});
|
416 |
|
417 |
+
// Clean Accordion
|
418 |
+
$layout.find('.acf-field-accordion').each(function(){
|
419 |
+
|
420 |
+
var $input = $(this);
|
421 |
+
|
422 |
+
$input.find('> .acf-accordion-title > .acf-accordion-icon').remove();
|
423 |
+
|
424 |
+
});
|
425 |
+
|
426 |
}
|
427 |
|
428 |
+
/*
|
429 |
+
* Spawn
|
430 |
+
*/
|
431 |
+
acf.addAction('new_field/type=flexible_content', function(flexible){
|
432 |
+
|
433 |
+
/*
|
434 |
+
* Dropdown HTML
|
435 |
+
*/
|
436 |
+
var $dropdown_grey = $('' +
|
437 |
+
'<a href="#" class="button" style="padding-left:5px;padding-right:5px; margin-left:3px;" data-name="acfe-flexible-control-button">' +
|
438 |
+
' <span class="dashicons dashicons-arrow-down-alt2" style="vertical-align:text-top;width:auto;height:auto;font-size:13px;line-height:20px;"></span>' +
|
439 |
+
'</a>' +
|
440 |
+
|
441 |
+
'<script type="text-html" class="tmpl-acfe-flexible-control-popup">' +
|
442 |
+
' <ul>' +
|
443 |
+
' <li><a href="#" data-acfe-flexible-control-action="copy">Copy layouts</a></li>' +
|
444 |
+
' <li><a href="#" data-acfe-flexible-control-action="paste">Paste layouts</a></li>' +
|
445 |
+
' </ul>' +
|
446 |
+
'</script>');
|
447 |
+
|
448 |
+
var $dropdown_blue = $('' +
|
449 |
+
'<a href="#" class="button button-primary" style="padding-left:5px;padding-right:5px; margin-left:3px;" data-name="acfe-flexible-control-button">' +
|
450 |
+
' <span class="dashicons dashicons-arrow-down-alt2" style="vertical-align:text-top;width:auto;height:auto;font-size:13px;line-height:20px;"></span>' +
|
451 |
+
'</a>' +
|
452 |
+
|
453 |
+
'<script type="text-html" class="tmpl-acfe-flexible-control-popup">' +
|
454 |
+
' <ul>' +
|
455 |
+
' <li><a href="#" data-acfe-flexible-control-action="copy">Copy layouts</a></li>' +
|
456 |
+
' <li><a href="#" data-acfe-flexible-control-action="paste">Paste layouts</a></li>' +
|
457 |
+
' </ul>' +
|
458 |
+
'</script>');
|
459 |
+
|
460 |
+
|
461 |
+
// Remove potential duplicated buttons
|
462 |
+
flexible.$el.find('> .acf-input > .acf-flexible-content > .acfe-flexible-stylised-button > .acf-actions > [data-name="acfe-flexible-control-button"]').remove();
|
463 |
+
flexible.$el.find('> .acf-input > .acf-flexible-content > .acf-actions > [data-name="acfe-flexible-control-button"]').remove();
|
464 |
+
|
465 |
+
// Add buttons
|
466 |
+
flexible.$el.find('> .acf-input > .acf-flexible-content > .acfe-flexible-stylised-button > .acf-actions > .acf-button').after($dropdown_grey);
|
467 |
+
flexible.$el.find('> .acf-input > .acf-flexible-content > .acf-actions > .acf-button').after($dropdown_blue);
|
468 |
+
|
469 |
+
});
|
470 |
+
|
471 |
+
acf.addAction('acfe/flexible/layouts', function($layout, flexible){
|
472 |
+
|
473 |
+
var $controls = $layout.find('> .acf-fc-layout-controls');
|
474 |
+
|
475 |
+
// Remove Duplicated Buttons
|
476 |
+
$controls.find('> .acfe-flexible-icon').remove();
|
477 |
+
|
478 |
+
// Add Buttons
|
479 |
+
$controls.prepend('' +
|
480 |
+
'<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.attr('data-layout') + '"></a>' +
|
481 |
+
'<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.attr('data-layout') + '"></a>');
|
482 |
+
|
483 |
+
});
|
484 |
+
|
485 |
})(jQuery);
|
assets/acf-extended-fc-modal-edit.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/*
|
2 |
-
* Flexible
|
3 |
*/
|
4 |
-
.acfe-modal-edition.
|
5 |
-
|
6 |
}
|
1 |
/*
|
2 |
+
* Flexible Edit: Hide Collapse
|
3 |
*/
|
4 |
+
.acf-field-flexible-content[data-acfe-flexible-modal-edition="1"] > .acf-input > .acf-flexible-content > .values > .layout > .acf-fc-layout-controls > a.-collapse{
|
5 |
+
display:none;
|
6 |
}
|
assets/acf-extended-fc-modal-edit.js
CHANGED
@@ -3,137 +3,69 @@
|
|
3 |
if(typeof acf === 'undefined')
|
4 |
return;
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
// Remove potential duplicate
|
18 |
-
$layout.find('> .acfe-flexible-collapsed-placeholder').remove();
|
19 |
-
|
20 |
-
// Wrap content
|
21 |
-
$layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acfe-modal"><div class="acfe-modal-wrapper"><div class="acfe-modal-content"></div></div></div>');
|
22 |
-
|
23 |
-
if($flexible.attr('data-acfe-flexible-preview')){
|
24 |
-
|
25 |
-
var previews = $.parseJSON($flexible.attr('data-acfe-flexible-preview'));
|
26 |
-
var layout_name = $layout.data('layout');
|
27 |
-
var preview = previews[layout_name];
|
28 |
|
29 |
-
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
$layout.find('> .acf-fc-layout-controls').after('' +
|
35 |
-
'<a href="javascript:void(0);" class="acfe-flexible-collapsed-placeholder acfe-flexible-collapsed-preview" data-event="edit-layout" title="Edit layout">' +
|
36 |
-
' <button class="button">' +
|
37 |
-
' <span class="dashicons dashicons-edit"></span>' +
|
38 |
-
' </button>' +
|
39 |
-
' <div class="acfe-flexible-collapsed-overlay"></div>' +
|
40 |
-
' <img src="' + preview + '" />' +
|
41 |
-
'</a>'
|
42 |
-
);
|
43 |
-
|
44 |
-
}
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
' <div>' +
|
52 |
-
' <button class="button">' +
|
53 |
-
' <span class="dashicons dashicons-edit"></span>' +
|
54 |
-
' </button>' +
|
55 |
-
' </div>' +
|
56 |
-
'</a>'
|
57 |
-
);
|
58 |
-
|
59 |
-
}
|
60 |
|
61 |
}
|
62 |
|
|
|
|
|
|
|
63 |
acf.addAction('new_field/type=flexible_content', function(flexible){
|
64 |
|
65 |
-
if(flexible
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
var $layouts = flexible.$layouts();
|
71 |
-
|
72 |
-
if($layouts.length){
|
73 |
-
|
74 |
-
$layouts.each(function(){
|
75 |
-
|
76 |
-
// var
|
77 |
-
var $layout = $(this);
|
78 |
-
|
79 |
-
// Force open layout
|
80 |
-
flexible.openLayout($layout);
|
81 |
-
|
82 |
-
// init
|
83 |
-
acfe_flexible_modal_init($(this));
|
84 |
-
|
85 |
-
});
|
86 |
-
|
87 |
-
}
|
88 |
-
|
89 |
-
/*
|
90 |
-
* Available Layouts
|
91 |
-
*/
|
92 |
-
var $clones = flexible.$clones();
|
93 |
-
|
94 |
-
if($clones.length){
|
95 |
-
|
96 |
-
$clones.each(function(){
|
97 |
-
|
98 |
-
// var
|
99 |
-
var $layout = $(this);
|
100 |
-
|
101 |
-
// init
|
102 |
-
acfe_flexible_modal_init($(this));
|
103 |
-
|
104 |
-
|
105 |
-
});
|
106 |
-
|
107 |
-
}
|
108 |
-
|
109 |
-
// Button action
|
110 |
-
flexible.acfe_flexible_modal_edition = function(e, $el){
|
111 |
-
|
112 |
-
// Modal data
|
113 |
-
var $modal_content = $el.closest('.acfe-modal-edition').find('> .acfe-modal');
|
114 |
-
var $modal_title = $el.closest('.acfe-modal-edition').find('> .acf-fc-layout-handle').html();
|
115 |
-
|
116 |
-
// Open modal
|
117 |
-
var $modal = acfe.modal.open($modal_content, {
|
118 |
-
title: $modal_title,
|
119 |
-
footer: 'Close'
|
120 |
-
});
|
121 |
-
|
122 |
-
}
|
123 |
-
|
124 |
-
flexible.addEvents({'click [data-event="edit-layout"]': 'acfe_flexible_modal_edition'});
|
125 |
|
126 |
-
|
|
|
127 |
|
128 |
});
|
129 |
|
130 |
-
|
131 |
-
acf.addAction('invalid_field', function(field){
|
132 |
|
133 |
-
if(!
|
134 |
return;
|
135 |
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
});
|
139 |
|
3 |
if(typeof acf === 'undefined')
|
4 |
return;
|
5 |
|
6 |
+
/*
|
7 |
+
* Init
|
8 |
+
*/
|
9 |
+
var flexible = acf.getFieldType('flexible_content');
|
10 |
+
var model = flexible.prototype;
|
11 |
+
|
12 |
+
/*
|
13 |
+
* Actions
|
14 |
+
*/
|
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 |
}
|
32 |
|
33 |
+
/*
|
34 |
+
* Spawn
|
35 |
+
*/
|
36 |
acf.addAction('new_field/type=flexible_content', function(flexible){
|
37 |
|
38 |
+
if(!flexible.has('acfeFlexibleModalEdition'))
|
39 |
+
return;
|
40 |
+
|
41 |
+
// Remove Collapse Action
|
42 |
+
flexible.removeEvents({'click [data-name="collapse-layout"]': 'onClickCollapse'});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
+
// Remove placeholder Collapse Action
|
45 |
+
flexible.removeEvents({'click .acfe-flexible-collapsed-placeholder': 'onClickCollapse'});
|
46 |
|
47 |
});
|
48 |
|
49 |
+
acf.addAction('acfe/flexible/layouts', function($layout, flexible){
|
|
|
50 |
|
51 |
+
if(!flexible.has('acfeFlexibleModalEdition'))
|
52 |
return;
|
53 |
|
54 |
+
// var
|
55 |
+
var $name = $layout.data('layout');
|
56 |
+
var $controls = $layout.find('> .acf-fc-layout-controls');
|
57 |
+
|
58 |
+
// Remove collapse button
|
59 |
+
$controls.find('> a.-collapse').remove();
|
60 |
+
|
61 |
+
// Force close
|
62 |
+
flexible.closeLayout($layout);
|
63 |
+
|
64 |
+
// Wrap content
|
65 |
+
$layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acfe-modal"><div class="acfe-modal-wrapper"><div class="acfe-modal-content"></div></div></div>');
|
66 |
+
|
67 |
+
// Placeholder
|
68 |
+
$layout.find('> .acfe-flexible-collapsed-placeholder').attr('data-action', 'acfe-flexible-modal-edit');
|
69 |
|
70 |
});
|
71 |
|
assets/acf-extended-fc-modal-select.js
CHANGED
@@ -3,163 +3,187 @@
|
|
3 |
if(typeof acf === 'undefined')
|
4 |
return;
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
var
|
10 |
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
-
//
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
// validate
|
20 |
-
if(!this.validateAdd())
|
21 |
-
return false;
|
22 |
-
|
23 |
-
// within layout
|
24 |
-
var $layout = null;
|
25 |
-
if($el.hasClass('acf-icon')){
|
26 |
-
$layout = $el.closest('.layout');
|
27 |
-
$layout.addClass('-hover');
|
28 |
-
}
|
29 |
-
|
30 |
-
// Create modal
|
31 |
-
var flexible_layouts_html = flexible.getPopupHTML();
|
32 |
-
|
33 |
-
// ACFE: Modal Categories
|
34 |
-
var categories = [];
|
35 |
-
$(flexible_layouts_html).find('li a span').each(function(){
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
50 |
|
51 |
-
|
|
|
|
|
|
|
|
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
categories_html += '<h2 class="acfe-flexible-categories nav-tab-wrapper">';
|
56 |
-
|
57 |
-
categories_html += '<a href="#" data-acfe-flexible-category="acfe-all" class="nav-tab nav-tab-active"><span class="dashicons dashicons-menu"></span></a>';
|
58 |
-
|
59 |
-
$(categories).each(function(k, category){
|
60 |
-
|
61 |
-
categories_html += '<a href="#" data-acfe-flexible-category="' + category + '" class="nav-tab">' + category + '</a>';
|
62 |
-
|
63 |
-
});
|
64 |
-
|
65 |
-
categories_html += '</h2>';
|
66 |
-
|
67 |
-
}
|
68 |
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
-
|
79 |
-
var $modal_content = $('' +
|
80 |
-
'<div class="acfe-modal">' +
|
81 |
-
|
82 |
-
categories_html +
|
83 |
-
'<div class="acfe-flex-container">' +
|
84 |
-
flexible.getPopupHTML() +
|
85 |
-
'</div>' +
|
86 |
-
|
87 |
-
'</div>'
|
88 |
|
89 |
-
|
90 |
|
91 |
-
|
92 |
-
var $modal = acfe.modal.open($modal_content, {
|
93 |
-
title: $modal_title,
|
94 |
-
size: 'full',
|
95 |
-
destroy: true
|
96 |
-
});
|
97 |
|
98 |
-
|
99 |
-
if(flexible.$el.attr('data-acfe-flexible-modal-col')){
|
100 |
|
101 |
-
$
|
102 |
|
103 |
}
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
var $link = $(this);
|
114 |
-
|
115 |
-
$link.closest('.acfe-flexible-categories').find('a').removeClass('nav-tab-active');
|
116 |
-
$link.addClass('nav-tab-active');
|
117 |
-
|
118 |
-
var selected_category = $link.data('acfe-flexible-category');
|
119 |
-
|
120 |
-
$modal.find('a[data-layout] span').each(function(){
|
121 |
-
|
122 |
-
var $span = $(this);
|
123 |
-
|
124 |
-
var current_category = $span.data('acfe-flexible-category');
|
125 |
-
|
126 |
-
$span.closest('li').show();
|
127 |
-
|
128 |
-
if(selected_category != 'acfe-all' && current_category != selected_category){
|
129 |
-
|
130 |
-
$span.closest('li').hide();
|
131 |
-
|
132 |
-
}
|
133 |
-
|
134 |
-
});
|
135 |
-
|
136 |
-
});
|
137 |
-
|
138 |
-
// Click: Layout
|
139 |
-
$modal.find('a[data-layout]').click(function(e){
|
140 |
-
|
141 |
-
e.preventDefault();
|
142 |
-
|
143 |
-
// Add layout
|
144 |
-
flexible.add({
|
145 |
-
layout: $(this).data('layout'),
|
146 |
-
before: $layout
|
147 |
-
});
|
148 |
-
|
149 |
-
// Close modal
|
150 |
-
acfe.modal.close(true);
|
151 |
-
|
152 |
-
});
|
153 |
-
|
154 |
-
}
|
155 |
|
156 |
-
//
|
157 |
-
flexible.
|
|
|
|
|
|
|
158 |
|
159 |
-
//
|
160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
});
|
165 |
|
3 |
if(typeof acf === 'undefined')
|
4 |
return;
|
5 |
|
6 |
+
/*
|
7 |
+
* Init
|
8 |
+
*/
|
9 |
+
var flexible = acf.getFieldType('flexible_content');
|
10 |
+
var model = flexible.prototype;
|
11 |
+
|
12 |
+
/*
|
13 |
+
* Actions
|
14 |
+
*/
|
15 |
+
model.acfeModalSelect = function(e, $el){
|
16 |
|
17 |
+
// Get Flexible
|
18 |
+
var flexible = this;
|
19 |
|
20 |
+
// Validate
|
21 |
+
if(!flexible.validateAdd())
|
22 |
+
return false;
|
23 |
+
|
24 |
+
// Layout
|
25 |
+
var $layout_source = null;
|
26 |
+
|
27 |
+
if($el.hasClass('acf-icon'))
|
28 |
+
$layout_source = $el.closest('.layout');
|
29 |
|
30 |
+
// Get Available Layouts
|
31 |
+
var layouts = flexible.getPopupHTML();
|
32 |
+
|
33 |
+
// Init Categories
|
34 |
+
var categories = {
|
35 |
+
array: [],
|
36 |
+
html: ''
|
37 |
+
};
|
38 |
+
|
39 |
+
// Get Categories
|
40 |
+
$(layouts).find('li a span').each(function(){
|
41 |
|
42 |
+
var $link = $(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
+
if(!$link.data('acfe-flexible-category'))
|
45 |
+
return true;
|
46 |
+
|
47 |
+
var category = $link.data('acfe-flexible-category');
|
48 |
+
|
49 |
+
if(categories.array.indexOf(category) != -1)
|
50 |
+
return true;
|
51 |
+
|
52 |
+
categories.array.push(category);
|
53 |
+
|
54 |
+
});
|
55 |
+
|
56 |
+
// Categories HTML
|
57 |
+
if(categories.array.length){
|
58 |
+
|
59 |
+
categories.array.sort();
|
60 |
|
61 |
+
categories.html += '<h2 class="acfe-flexible-categories nav-tab-wrapper">';
|
62 |
+
|
63 |
+
categories.html += '<a href="#" data-acfe-flexible-category="acfe-all" class="nav-tab nav-tab-active"><span class="dashicons dashicons-menu"></span></a>';
|
64 |
+
|
65 |
+
$(categories.array).each(function(k, category){
|
66 |
|
67 |
+
categories.html += '<a href="#" data-acfe-flexible-category="' + category + '" class="nav-tab">' + category + '</a>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
+
});
|
70 |
+
|
71 |
+
categories.html += '</h2>';
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
// Modal Title
|
76 |
+
var $modal_title = 'Add Row';
|
77 |
+
|
78 |
+
if(flexible.has('acfeFlexibleModalTitle'))
|
79 |
+
$modal_title = flexible.get('acfeFlexibleModalTitle');
|
80 |
+
|
81 |
+
// Create Modal
|
82 |
+
var $modal = $('' +
|
83 |
+
'<div class="acfe-modal">' +
|
84 |
+
|
85 |
+
categories.html +
|
86 |
+
'<div class="acfe-flex-container">' +
|
87 |
+
layouts +
|
88 |
+
'</div>' +
|
89 |
|
90 |
+
'</div>'
|
91 |
+
|
92 |
+
).appendTo('body');
|
93 |
+
|
94 |
+
// Open Modal
|
95 |
+
var $modal = acfe.modal.open($modal, {
|
96 |
+
title: $modal_title,
|
97 |
+
size: 'full',
|
98 |
+
destroy: true
|
99 |
+
});
|
100 |
+
|
101 |
+
// Modal: Columns
|
102 |
+
if(flexible.has('acfeFlexibleModalCol'))
|
103 |
+
$modal.find('.acfe-modal-content .acfe-flex-container').addClass('acfe-col-' + flexible.get('acfeFlexibleModalCol'));
|
104 |
+
|
105 |
+
// Modal: ACF autofocus fix
|
106 |
+
$modal.find('li:first-of-type a').blur();
|
107 |
+
|
108 |
+
// Modal: Click Categories
|
109 |
+
$modal.find('.acfe-flexible-categories a').click(function(e){
|
110 |
+
|
111 |
+
e.preventDefault();
|
112 |
+
|
113 |
+
var $link = $(this);
|
114 |
+
|
115 |
+
$link.closest('.acfe-flexible-categories').find('a').removeClass('nav-tab-active');
|
116 |
+
$link.addClass('nav-tab-active');
|
117 |
+
|
118 |
+
var selected_category = $link.data('acfe-flexible-category');
|
119 |
+
|
120 |
+
$modal.find('a[data-layout] span').each(function(){
|
121 |
|
122 |
+
var $span = $(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
+
var current_category = $span.data('acfe-flexible-category');
|
125 |
|
126 |
+
$span.closest('li').show();
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
+
if(selected_category != 'acfe-all' && current_category != selected_category){
|
|
|
129 |
|
130 |
+
$span.closest('li').hide();
|
131 |
|
132 |
}
|
133 |
|
134 |
+
});
|
135 |
+
|
136 |
+
});
|
137 |
+
|
138 |
+
// Modal: Click Add Layout
|
139 |
+
$modal.on('click', 'a[data-layout]', function(e){
|
140 |
+
|
141 |
+
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
+
// Add layout
|
144 |
+
var $layout_added = flexible.add({
|
145 |
+
layout: $(this).data('layout'),
|
146 |
+
before: $layout_source
|
147 |
+
});
|
148 |
|
149 |
+
// Close modal
|
150 |
+
acfe.modal.close(true);
|
151 |
+
|
152 |
+
if(!$layout_added)
|
153 |
+
return;
|
154 |
+
|
155 |
+
// Scroll to new layout
|
156 |
+
$('html, body').animate({
|
157 |
+
scrollTop: parseInt($layout_added.offset().top) - 200
|
158 |
+
}, 200);
|
159 |
+
|
160 |
+
// Open layout modal edition
|
161 |
+
if(flexible.has('acfeFlexibleModalEdition'))
|
162 |
+
$layout_added.find('> [data-action="acfe-flexible-modal-edit"]').trigger('click');
|
163 |
+
|
164 |
+
});
|
165 |
|
166 |
+
}
|
167 |
+
|
168 |
+
/*
|
169 |
+
* Spawn
|
170 |
+
*/
|
171 |
+
acf.addAction('new_field/type=flexible_content', function(flexible){
|
172 |
+
|
173 |
+
if(!flexible.has('acfeFlexibleModal'))
|
174 |
+
return;
|
175 |
+
|
176 |
+
// Vars
|
177 |
+
var $clones = flexible.$clones();
|
178 |
+
|
179 |
+
if($clones.length <= 1)
|
180 |
+
return;
|
181 |
+
|
182 |
+
// Remove native ACF Tooltip action
|
183 |
+
flexible.removeEvents({'click [data-name="add-layout"]': 'onClickAdd'});
|
184 |
+
|
185 |
+
// Add ACF Extended Modal action
|
186 |
+
flexible.addEvents({'click [data-name="add-layout"]': 'acfeModalSelect'});
|
187 |
|
188 |
});
|
189 |
|
assets/acf-extended-fc.css
CHANGED
@@ -15,6 +15,18 @@
|
|
15 |
font-weight: 600;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/*
|
19 |
* Flexible Layout Collapsed
|
20 |
*/
|
@@ -22,27 +34,28 @@
|
|
22 |
border-bottom-width:1px;
|
23 |
}
|
24 |
|
25 |
-
|
26 |
-
|
|
|
|
|
27 |
text-align:center;
|
28 |
background:#fafafa;
|
29 |
display:block;
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
-
.layout >
|
33 |
border-color: #cccccc;
|
34 |
box-shadow: none;
|
35 |
}
|
36 |
|
37 |
-
.layout >
|
38 |
-
padding:
|
39 |
}
|
40 |
|
41 |
-
.layout >
|
42 |
-
border-color:#e1e1e1;
|
43 |
-
}
|
44 |
-
|
45 |
-
.layout > a.acfe-flexible-collapsed-placeholder button{
|
46 |
border-radius:100px;
|
47 |
box-shadow:none;
|
48 |
background:#fff;
|
@@ -51,18 +64,18 @@
|
|
51 |
padding:0;
|
52 |
}
|
53 |
|
54 |
-
.layout >
|
55 |
background: #fafafa;
|
56 |
border-color: #999;
|
57 |
color: #23282d;
|
58 |
}
|
59 |
|
60 |
-
.layout >
|
61 |
border-color: #cccccc;
|
62 |
box-shadow: none;
|
63 |
}
|
64 |
|
65 |
-
.layout >
|
66 |
width: 30px;
|
67 |
height: 30px;
|
68 |
vertical-align:middle;
|
@@ -70,22 +83,24 @@
|
|
70 |
font-size:18px;
|
71 |
}
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
}
|
81 |
|
82 |
-
.layout >
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
86 |
}
|
87 |
|
88 |
-
.layout >
|
89 |
z-index:0;
|
90 |
position:absolute;
|
91 |
width:100%;
|
@@ -97,21 +112,28 @@
|
|
97 |
transition: background-color 200ms linear;
|
98 |
}
|
99 |
|
100 |
-
.layout >
|
101 |
background-color:rgba(255,255,255,0.7);
|
102 |
}
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
111 |
}
|
112 |
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
|
117 |
/*
|
@@ -193,7 +215,7 @@
|
|
193 |
}
|
194 |
|
195 |
/*
|
196 |
-
*
|
197 |
*
|
198 |
*/
|
199 |
.acf-field.acf-field-flexible-content[data-acfe-flexible-hide-empty-message="1"] > .acf-input > .acf-flexible-content > .no-value-message{
|
15 |
font-weight: 600;
|
16 |
}
|
17 |
|
18 |
+
/*
|
19 |
+
* Flexible Field Error
|
20 |
+
*/
|
21 |
+
.layout.acfe-flexible-modal-edit-error > .acf-fc-layout-handle{
|
22 |
+
color:#f33b28;
|
23 |
+
}
|
24 |
+
|
25 |
+
.layout.acfe-flexible-modal-edit-error > .acf-fc-layout-handle > .acf-fc-layout-order{
|
26 |
+
background:#f33b28;
|
27 |
+
color:#fff;
|
28 |
+
}
|
29 |
+
|
30 |
/*
|
31 |
* Flexible Layout Collapsed
|
32 |
*/
|
34 |
border-bottom-width:1px;
|
35 |
}
|
36 |
|
37 |
+
/*
|
38 |
+
* Flexible Layout: Placeholder
|
39 |
+
*/
|
40 |
+
.layout > .acfe-flexible-collapsed-placeholder{
|
41 |
text-align:center;
|
42 |
background:#fafafa;
|
43 |
display:block;
|
44 |
+
text-decoration:none;
|
45 |
+
position:relative;
|
46 |
+
cursor:pointer;
|
47 |
}
|
48 |
|
49 |
+
.layout > .acfe-flexible-collapsed-placeholder:focus{
|
50 |
border-color: #cccccc;
|
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;
|
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 |
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%;
|
112 |
transition: background-color 200ms linear;
|
113 |
}
|
114 |
|
115 |
+
.layout > .acfe-flexible-collapsed-placeholder:hover .acfe-flexible-collapsed-overlay{
|
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 |
+
*/
|
132 |
+
.layout > .acfe-flexible-opened-actions{
|
133 |
+
background:#f9f9f9;
|
134 |
+
border-top:1px solid #e1e1e1;
|
135 |
+
padding:12px;
|
136 |
+
text-align:right;
|
137 |
}
|
138 |
|
139 |
/*
|
215 |
}
|
216 |
|
217 |
/*
|
218 |
+
* Flexible Hide Empty Message
|
219 |
*
|
220 |
*/
|
221 |
.acf-field.acf-field-flexible-content[data-acfe-flexible-hide-empty-message="1"] > .acf-input > .acf-flexible-content > .no-value-message{
|
assets/acf-extended-fc.js
CHANGED
@@ -3,99 +3,125 @@
|
|
3 |
if(typeof acf === 'undefined')
|
4 |
return;
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
acf.addAction('new_field/type=flexible_content', function(flexible){
|
7 |
|
|
|
8 |
var $clones = flexible.$clones();
|
9 |
var $layouts = flexible.$layouts();
|
10 |
|
11 |
-
//
|
12 |
-
|
13 |
-
|
14 |
-
if($layouts.length){
|
15 |
-
|
16 |
-
$layouts.each(function(){
|
17 |
-
flexible.closeLayout($(this));
|
18 |
-
});
|
19 |
-
|
20 |
-
}
|
21 |
-
|
22 |
-
}
|
23 |
|
24 |
-
//
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
$layouts.each(function(){
|
30 |
-
flexible.openLayout($(this));
|
31 |
-
});
|
32 |
-
|
33 |
-
}
|
34 |
|
35 |
-
|
|
|
|
|
|
|
36 |
|
37 |
// ACFE: Stylised button
|
38 |
-
if(flexible
|
39 |
|
40 |
-
|
41 |
-
|
42 |
|
43 |
}
|
44 |
|
45 |
-
// ACFE:1 layout available - OneClick
|
46 |
if($clones.length === 1){
|
47 |
|
48 |
-
flexible.acfe_flexible_oneclick = function(e, $el){
|
49 |
-
|
50 |
-
var $layout_name = $($clones[0]).attr('data-layout');
|
51 |
-
|
52 |
-
var $layout = null;
|
53 |
-
if($(this).hasClass('acf-icon')){
|
54 |
-
$layout = $(this).closest('.layout');
|
55 |
-
$layout.addClass('-hover');
|
56 |
-
}
|
57 |
-
|
58 |
-
flexible.add({
|
59 |
-
layout: $layout_name,
|
60 |
-
before: $layout
|
61 |
-
});
|
62 |
-
|
63 |
-
// Hide native ACF tooltip
|
64 |
-
if($('.acf-fc-popup').length)
|
65 |
-
$('.acf-fc-popup').hide();
|
66 |
-
|
67 |
-
}
|
68 |
-
|
69 |
// Remove native ACF Tooltip action
|
70 |
flexible.removeEvents({'click [data-name="add-layout"]': 'onClickAdd'});
|
71 |
|
72 |
// Add ACF Extended Modal action
|
73 |
-
flexible.addEvents({'click [data-name="add-layout"]': '
|
74 |
|
75 |
}
|
76 |
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
-
|
|
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
var $layout = $(this);
|
85 |
-
|
86 |
-
if(!flexible.isLayoutClosed($layout))
|
87 |
-
return;
|
88 |
-
|
89 |
-
flexible.closeLayout($layout);
|
90 |
-
|
91 |
-
});
|
92 |
|
93 |
}
|
94 |
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
}
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
});
|
100 |
|
101 |
acf.addAction('show', function($layout, type){
|
@@ -103,14 +129,18 @@
|
|
103 |
if(type != 'collapse' || !$layout.is('.layout'))
|
104 |
return;
|
105 |
|
106 |
-
var
|
107 |
-
|
108 |
-
if(!$flexible.attr('data-acfe-flexible-modal-edition')){
|
109 |
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
-
|
|
|
114 |
|
115 |
});
|
116 |
|
@@ -119,53 +149,111 @@
|
|
119 |
if(type != 'collapse' || !$layout.is('.layout'))
|
120 |
return;
|
121 |
|
122 |
-
|
|
|
123 |
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
-
|
127 |
-
$layout.find('> .acfe-flexible-collapsed-placeholder').remove();
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
var previews = $.parseJSON($flexible.attr('data-acfe-flexible-preview'));
|
132 |
-
var layout_name = $layout.data('layout');
|
133 |
-
var preview = previews[layout_name];
|
134 |
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
// Create button
|
140 |
-
$layout.find('> .acf-fc-layout-controls').after('' +
|
141 |
-
'<a href="javascript:void(0);" class="acfe-flexible-collapsed-placeholder acfe-flexible-collapsed-preview" data-event="acfe-flexible-open-layout" title="Edit layout">' +
|
142 |
-
' <button class="button">' +
|
143 |
-
' <span class="dashicons dashicons-edit"></span>' +
|
144 |
-
' </button>' +
|
145 |
-
' <div class="acfe-flexible-collapsed-overlay"></div>' +
|
146 |
-
' <img src="' + preview + '" />' +
|
147 |
-
'</a>'
|
148 |
-
);
|
149 |
-
|
150 |
-
}
|
151 |
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
' <div>' +
|
158 |
-
' <button class="button">' +
|
159 |
-
' <span class="dashicons dashicons-edit"></span>' +
|
160 |
-
' </button>' +
|
161 |
-
' </div>' +
|
162 |
-
'</a>'
|
163 |
-
);
|
164 |
|
165 |
-
}
|
166 |
-
|
167 |
}
|
168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
});
|
170 |
|
171 |
})(jQuery);
|
3 |
if(typeof acf === 'undefined')
|
4 |
return;
|
5 |
|
6 |
+
/*
|
7 |
+
* Init
|
8 |
+
*/
|
9 |
+
var flexible = acf.getFieldType('flexible_content');
|
10 |
+
var model = flexible.prototype;
|
11 |
+
|
12 |
+
/*
|
13 |
+
* Actions
|
14 |
+
*/
|
15 |
+
model.acfeOneClick = function(e, $el){
|
16 |
+
|
17 |
+
// Get Flexible
|
18 |
+
var flexible = this;
|
19 |
+
|
20 |
+
// Vars
|
21 |
+
var $clones = flexible.$clones();
|
22 |
+
var $layout_name = $($clones[0]).data('layout');
|
23 |
+
|
24 |
+
// Source
|
25 |
+
var $layout_source = null;
|
26 |
+
if($el.hasClass('acf-icon'))
|
27 |
+
$layout_source = $el.closest('.layout');
|
28 |
+
|
29 |
+
// Add
|
30 |
+
flexible.add({
|
31 |
+
layout: $layout_name,
|
32 |
+
before: $layout_source
|
33 |
+
});
|
34 |
+
|
35 |
+
// Hide native tooltip
|
36 |
+
if($('.acf-fc-popup').length)
|
37 |
+
$('.acf-fc-popup').hide();
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
/*
|
42 |
+
* Spawn
|
43 |
+
*/
|
44 |
acf.addAction('new_field/type=flexible_content', function(flexible){
|
45 |
|
46 |
+
// Vars
|
47 |
var $clones = flexible.$clones();
|
48 |
var $layouts = flexible.$layouts();
|
49 |
|
50 |
+
// Merge
|
51 |
+
var $all_layouts = $.merge($layouts, $clones);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
// Do Actions
|
54 |
+
$all_layouts.each(function(){
|
55 |
|
56 |
+
var $layout = $(this);
|
57 |
+
var $name = $layout.data('layout');
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
acf.doAction('acfe/flexible/layouts', $layout, flexible);
|
60 |
+
acf.doAction('acfe/flexible/layout/name=' + $name, $layout, flexible);
|
61 |
+
|
62 |
+
});
|
63 |
|
64 |
// ACFE: Stylised button
|
65 |
+
if(flexible.has('acfeFlexibleStylisedButton')){
|
66 |
|
67 |
+
flexible.$button().removeClass('button-primary');
|
68 |
+
flexible.$actions().wrap('<div class="acfe-flexible-stylised-button" />');
|
69 |
|
70 |
}
|
71 |
|
72 |
+
// ACFE: 1 layout available - OneClick
|
73 |
if($clones.length === 1){
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
// Remove native ACF Tooltip action
|
76 |
flexible.removeEvents({'click [data-name="add-layout"]': 'onClickAdd'});
|
77 |
|
78 |
// Add ACF Extended Modal action
|
79 |
+
flexible.addEvents({'click [data-name="add-layout"]': 'acfeOneClick'});
|
80 |
|
81 |
}
|
82 |
|
83 |
+
flexible.addEvents({'click .acfe-flexible-collapsed-placeholder': 'onClickCollapse'});
|
84 |
+
|
85 |
+
flexible.addEvents({'click .acfe-flexible-opened-actions > a': 'onClickCollapse'});
|
86 |
+
|
87 |
+
});
|
88 |
+
|
89 |
+
acf.addAction('acfe/flexible/layouts', function($layout, flexible){
|
90 |
+
|
91 |
+
// Not clones
|
92 |
+
if(!$layout.is('.acf-clone')){
|
93 |
|
94 |
+
// Layout State: Collapse
|
95 |
+
if(flexible.has('acfeFlexibleCollapse')){
|
96 |
|
97 |
+
flexible.closeLayout($layout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
}
|
100 |
|
101 |
+
// Layout State: Open
|
102 |
+
else if(flexible.has('acfeFlexibleOpen')){
|
103 |
+
|
104 |
+
flexible.openLayout($layout);
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
// Compatibility: Plugins that don't use native layout close method
|
111 |
+
// TODO: Move to ready action for late init?
|
112 |
+
if(flexible.isLayoutClosed($layout)){
|
113 |
+
|
114 |
+
flexible.closeLayout($layout);
|
115 |
|
116 |
}
|
117 |
+
|
118 |
+
// Trigger show action for opened layouts
|
119 |
+
else{
|
120 |
+
|
121 |
+
acf.doAction('show', $layout, 'collapse');
|
122 |
+
|
123 |
+
}
|
124 |
+
|
125 |
});
|
126 |
|
127 |
acf.addAction('show', function($layout, type){
|
129 |
if(type != 'collapse' || !$layout.is('.layout'))
|
130 |
return;
|
131 |
|
132 |
+
var flexible = acf.getInstance($layout.closest('.acf-field-flexible-content'));
|
|
|
|
|
133 |
|
134 |
+
// Bail early if Modal Edit
|
135 |
+
if(flexible.has('acfeFlexibleModalEdition'))
|
136 |
+
return;
|
137 |
+
|
138 |
+
// Remove duplicate
|
139 |
+
$layout.find('> .acfe-flexible-collapsed-placeholder').remove();
|
140 |
+
$layout.find('> .acfe-flexible-opened-actions').remove();
|
141 |
|
142 |
+
var $button = $('<div class="acfe-flexible-opened-actions"><a href="javascript:void(0);" class="button">Close</button></a>');
|
143 |
+
var $button = $button.appendTo($layout);
|
144 |
|
145 |
});
|
146 |
|
149 |
if(type != 'collapse' || !$layout.is('.layout'))
|
150 |
return;
|
151 |
|
152 |
+
// Get Flexible
|
153 |
+
var flexible = acf.getInstance($layout.closest('.acf-field-flexible-content'));
|
154 |
|
155 |
+
// Vars
|
156 |
+
var $name = $layout.data('layout');
|
157 |
+
var $controls = $layout.find('> .acf-fc-layout-controls');
|
158 |
+
|
159 |
+
// Remove duplicate
|
160 |
+
$layout.find('> .acfe-flexible-collapsed-placeholder').remove();
|
161 |
+
$layout.find('> .acfe-flexible-opened-actions').remove();
|
162 |
+
|
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]', '');
|
182 |
+
|
183 |
+
// ajax data
|
184 |
+
var ajaxData = {
|
185 |
+
action: 'acfe/flexible/layout_preview',
|
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
|
193 |
+
$.ajax({
|
194 |
+
url: acf.get('ajaxurl'),
|
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 |
+
/*
|
235 |
+
* Field Error
|
236 |
+
*/
|
237 |
+
acf.addAction('invalid_field', function(field){
|
238 |
+
|
239 |
+
field.$el.parents('.layout').addClass('acfe-flexible-modal-edit-error');
|
240 |
+
|
241 |
+
});
|
242 |
+
|
243 |
+
/*
|
244 |
+
* Field Valid
|
245 |
+
*/
|
246 |
+
acf.addAction('valid_field', function(field){
|
247 |
+
|
248 |
+
field.$el.parents('.layout').each(function(){
|
249 |
+
|
250 |
+
var $layout = $(this);
|
251 |
+
|
252 |
+
if(!$layout.find('.acf-error').length)
|
253 |
+
$layout.removeClass('acfe-flexible-modal-edit-error');
|
254 |
+
|
255 |
+
});
|
256 |
+
|
257 |
});
|
258 |
|
259 |
})(jQuery);
|
assets/acf-extended-fg.css
CHANGED
@@ -56,29 +56,6 @@
|
|
56 |
margin-left:10px;
|
57 |
}
|
58 |
|
59 |
-
pre {
|
60 |
-
display: block;
|
61 |
-
padding: 9.5px;
|
62 |
-
margin: 0;
|
63 |
-
font-size: 13px;
|
64 |
-
line-height: 1.42857143;
|
65 |
-
color: #333;
|
66 |
-
word-break: break-all;
|
67 |
-
word-wrap: break-word;
|
68 |
-
background-color: #f5f5f5;
|
69 |
-
border: 1px solid #ccc;
|
70 |
-
border-radius: 4px;
|
71 |
-
white-space: pre-wrap;
|
72 |
-
overflow: auto;
|
73 |
-
}
|
74 |
-
code, kbd, pre, samp {
|
75 |
-
font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
|
76 |
-
}
|
77 |
-
code, kbd, pre, samp {
|
78 |
-
font-family: monospace,monospace;
|
79 |
-
font-size: 1em;
|
80 |
-
}
|
81 |
-
|
82 |
.acfe_width_auto{
|
83 |
width:auto !important;
|
84 |
}
|
@@ -116,17 +93,4 @@ td.acf-field-group-category a{
|
|
116 |
.column-acfe-autosync-json{
|
117 |
width:65px;
|
118 |
text-align:center;
|
119 |
-
}
|
120 |
-
|
121 |
-
.settings_page_acfe-options .column-option_id{
|
122 |
-
width:65px;
|
123 |
-
}
|
124 |
-
|
125 |
-
.settings_page_acfe-options .column-option_name{
|
126 |
-
width:435px;
|
127 |
-
}
|
128 |
-
|
129 |
-
.settings_page_acfe-options .column-autoload{
|
130 |
-
width:100px;
|
131 |
-
text-align:center;
|
132 |
}
|
56 |
margin-left:10px;
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
.acfe_width_auto{
|
60 |
width:auto !important;
|
61 |
}
|
93 |
.column-acfe-autosync-json{
|
94 |
width:65px;
|
95 |
text-align:center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
assets/acf-extended-modal.css
CHANGED
@@ -25,6 +25,9 @@ body.acfe-modal-opened{
|
|
25 |
*/
|
26 |
.acfe-modal{
|
27 |
display:none;
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
.acfe-modal.-open{
|
@@ -38,10 +41,19 @@ body.acfe-modal-opened{
|
|
38 |
right:0;
|
39 |
-webkit-font-smoothing: subpixel-antialiased;
|
40 |
|
|
|
|
|
41 |
display: flex;
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
pointer-events:none;
|
47 |
}
|
@@ -51,8 +63,13 @@ body.acfe-modal-opened{
|
|
51 |
*/
|
52 |
.acfe-modal.-open > .acfe-modal-wrapper{
|
53 |
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
|
|
|
|
|
54 |
display: flex;
|
55 |
-
|
|
|
|
|
|
|
56 |
|
57 |
width: calc(100vw - 60px);
|
58 |
max-width:1100px;
|
@@ -68,7 +85,9 @@ body.acfe-modal-opened{
|
|
68 |
|
69 |
.acfe-modal.-open.-full > .acfe-modal-wrapper{
|
70 |
max-width:100%;
|
71 |
-
flex: 1;
|
|
|
|
|
72 |
}
|
73 |
|
74 |
/*
|
@@ -228,8 +247,8 @@ body.acfe-modal-opened{
|
|
228 |
display: -webkit-box;
|
229 |
display: -ms-flexbox;
|
230 |
display: flex;
|
231 |
-
-ms-flex-wrap: wrap;
|
232 |
-
|
233 |
}
|
234 |
|
235 |
.acfe-modal.-open >.acfe-modal-content .acfe-flex-container ul:after{
|
@@ -246,8 +265,9 @@ body.acfe-modal-opened{
|
|
246 |
padding-bottom: 14px;
|
247 |
margin:0;
|
248 |
|
249 |
-
-
|
250 |
-
|
|
|
251 |
max-width: 25%;
|
252 |
}
|
253 |
|
25 |
*/
|
26 |
.acfe-modal{
|
27 |
display:none;
|
28 |
+
-webkit-transition: all 0.3s ease-in-out;
|
29 |
+
-o-transition: all 0.3s ease-in-out;
|
30 |
+
transition: all 0.3s ease-in-out;
|
31 |
}
|
32 |
|
33 |
.acfe-modal.-open{
|
41 |
right:0;
|
42 |
-webkit-font-smoothing: subpixel-antialiased;
|
43 |
|
44 |
+
display: -webkit-box;
|
45 |
+
display: -ms-flexbox;
|
46 |
display: flex;
|
47 |
+
-webkit-box-orient: vertical;
|
48 |
+
-webkit-box-direction: normal;
|
49 |
+
-ms-flex-direction: column;
|
50 |
+
flex-direction: column;
|
51 |
+
-webkit-box-pack: center;
|
52 |
+
-ms-flex-pack: center;
|
53 |
+
justify-content: center;
|
54 |
+
-webkit-box-align: center;
|
55 |
+
-ms-flex-align: center;
|
56 |
+
align-items: center;
|
57 |
|
58 |
pointer-events:none;
|
59 |
}
|
63 |
*/
|
64 |
.acfe-modal.-open > .acfe-modal-wrapper{
|
65 |
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
|
66 |
+
display: -webkit-box;
|
67 |
+
display: -ms-flexbox;
|
68 |
display: flex;
|
69 |
+
-webkit-box-orient: vertical;
|
70 |
+
-webkit-box-direction: normal;
|
71 |
+
-ms-flex-direction: column;
|
72 |
+
flex-direction: column;
|
73 |
|
74 |
width: calc(100vw - 60px);
|
75 |
max-width:1100px;
|
85 |
|
86 |
.acfe-modal.-open.-full > .acfe-modal-wrapper{
|
87 |
max-width:100%;
|
88 |
+
-webkit-box-flex: 1;
|
89 |
+
-ms-flex: 1;
|
90 |
+
flex: 1;
|
91 |
}
|
92 |
|
93 |
/*
|
247 |
display: -webkit-box;
|
248 |
display: -ms-flexbox;
|
249 |
display: flex;
|
250 |
+
-ms-flex-wrap: wrap;
|
251 |
+
flex-wrap: wrap;
|
252 |
}
|
253 |
|
254 |
.acfe-modal.-open >.acfe-modal-content .acfe-flex-container ul:after{
|
265 |
padding-bottom: 14px;
|
266 |
margin:0;
|
267 |
|
268 |
+
-webkit-box-flex: 0;
|
269 |
+
-ms-flex: 0 0 25%;
|
270 |
+
flex: 0 0 25%;
|
271 |
max-width: 25%;
|
272 |
}
|
273 |
|
assets/acf-extended.css
CHANGED
@@ -285,4 +285,46 @@ body.post-type-acfe-dbt #minor-publishing{
|
|
285 |
#acf-admin-tool-acfe_tool_dt_export ul,
|
286 |
#acf-admin-tool-acfe_tool_dop_export ul{
|
287 |
column-width: 200px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
}
|
285 |
#acf-admin-tool-acfe_tool_dt_export ul,
|
286 |
#acf-admin-tool-acfe_tool_dop_export ul{
|
287 |
column-width: 200px;
|
288 |
+
}
|
289 |
+
|
290 |
+
/*
|
291 |
+
* ACFE WP Options
|
292 |
+
*/
|
293 |
+
.settings_page_acfe-options .column-option_id{
|
294 |
+
width:65px;
|
295 |
+
}
|
296 |
+
|
297 |
+
.settings_page_acfe-options .column-option_name{
|
298 |
+
width:435px;
|
299 |
+
}
|
300 |
+
|
301 |
+
.settings_page_acfe-options .column-autoload{
|
302 |
+
width:100px;
|
303 |
+
text-align:center;
|
304 |
+
}
|
305 |
+
|
306 |
+
/*
|
307 |
+
* ACFE General
|
308 |
+
*/
|
309 |
+
pre {
|
310 |
+
display: block;
|
311 |
+
padding: 9.5px;
|
312 |
+
margin: 0;
|
313 |
+
font-size: 13px;
|
314 |
+
line-height: 1.42857143;
|
315 |
+
color: #333;
|
316 |
+
word-break: break-all;
|
317 |
+
word-wrap: break-word;
|
318 |
+
background-color: #f5f5f5;
|
319 |
+
border: 1px solid #ccc;
|
320 |
+
border-radius: 4px;
|
321 |
+
white-space: pre-wrap;
|
322 |
+
overflow: auto;
|
323 |
+
}
|
324 |
+
code, kbd, pre, samp {
|
325 |
+
font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
|
326 |
+
}
|
327 |
+
code, kbd, pre, samp {
|
328 |
+
font-family: monospace,monospace;
|
329 |
+
font-size: 1em;
|
330 |
}
|
assets/acf-extended.js
CHANGED
@@ -79,6 +79,8 @@
|
|
79 |
|
80 |
}
|
81 |
|
|
|
|
|
82 |
return $target;
|
83 |
|
84 |
},
|
@@ -107,8 +109,28 @@
|
|
107 |
$('body').removeClass('acfe-modal-opened');
|
108 |
|
109 |
}
|
|
|
|
|
110 |
|
111 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
};
|
114 |
|
79 |
|
80 |
}
|
81 |
|
82 |
+
acfe.modal.multiple();
|
83 |
+
|
84 |
return $target;
|
85 |
|
86 |
},
|
109 |
$('body').removeClass('acfe-modal-opened');
|
110 |
|
111 |
}
|
112 |
+
|
113 |
+
acfe.modal.multiple();
|
114 |
|
115 |
+
},
|
116 |
+
|
117 |
+
// Multiple
|
118 |
+
multiple: function(){
|
119 |
+
|
120 |
+
var last = acfe.modal.modals.length - 1;
|
121 |
+
|
122 |
+
$.each(acfe.modal.modals, function(i){
|
123 |
+
|
124 |
+
if(last == i){
|
125 |
+
$(this).css('margin-left', '');
|
126 |
+
return;
|
127 |
+
}
|
128 |
+
|
129 |
+
$(this).css('margin-left', - (500 / (i+1)));
|
130 |
+
|
131 |
+
});
|
132 |
+
|
133 |
+
}
|
134 |
|
135 |
};
|
136 |
|
includes/admin/tools/dop-import.php
CHANGED
@@ -104,6 +104,7 @@ class ACFE_Admin_Tool_Import_DOP extends ACF_Admin_Tool{
|
|
104 |
|
105 |
// Register Args
|
106 |
update_field('page_title', $args['page_title'], $post_id);
|
|
|
107 |
update_field('menu_title', $args['menu_title'], $post_id);
|
108 |
update_field('menu_slug', $args['menu_slug'], $post_id);
|
109 |
update_field('capability', $args['capability'], $post_id);
|
104 |
|
105 |
// Register Args
|
106 |
update_field('page_title', $args['page_title'], $post_id);
|
107 |
+
update_field('acfe_dop_name', $name, $post_id);
|
108 |
update_field('menu_title', $args['menu_title'], $post_id);
|
109 |
update_field('menu_slug', $args['menu_slug'], $post_id);
|
110 |
update_field('capability', $args['capability'], $post_id);
|
includes/core/enqueue.php
CHANGED
@@ -13,11 +13,6 @@ function acfe_enqueue_admin(){
|
|
13 |
wp_enqueue_style('acf-input');
|
14 |
wp_enqueue_script('acf-input');
|
15 |
|
16 |
-
// WP jQuery UI Dialog
|
17 |
-
wp_enqueue_style('wp-jquery-ui-dialog');
|
18 |
-
wp_enqueue_script('jquery-ui-core');
|
19 |
-
wp_enqueue_script('jquery-ui-dialog');
|
20 |
-
|
21 |
// ACF Extended
|
22 |
wp_enqueue_script('acf-extended', plugins_url('assets/acf-extended.js', ACFE_FILE), array('jquery'), null);
|
23 |
wp_enqueue_style('acf-extended', plugins_url('assets/acf-extended.css', ACFE_FILE), false, null);
|
@@ -40,7 +35,6 @@ function acfe_enqueue_fields(){
|
|
40 |
|
41 |
wp_enqueue_script('acf-extended-fields', plugins_url('assets/acf-extended-fields.js', ACFE_FILE), array('jquery'), null);
|
42 |
|
43 |
-
// ACF Extended: Flexible Content
|
44 |
wp_enqueue_style('acf-extended-fc', plugins_url('assets/acf-extended-fc.css', ACFE_FILE), false, null);
|
45 |
wp_enqueue_script('acf-extended-fc', plugins_url('assets/acf-extended-fc.js', ACFE_FILE), array('jquery'), null);
|
46 |
|
@@ -53,10 +47,10 @@ function acfe_enqueue_fields(){
|
|
53 |
|
54 |
// ACF Extended: Flexible Content Modal Select
|
55 |
wp_enqueue_style('acf-extended-fc-modal-select', plugins_url('assets/acf-extended-fc-modal-select.css', ACFE_FILE), false, null);
|
56 |
-
wp_enqueue_script('acf-extended-fc-modal-select', plugins_url('assets/acf-extended-fc-modal-select.js', ACFE_FILE), array('jquery'
|
57 |
|
58 |
// ACF Extended: Flexible Content Modal Edit
|
59 |
wp_enqueue_style('acf-extended-fc-modal-edit', plugins_url('assets/acf-extended-fc-modal-edit.css', ACFE_FILE), false, null);
|
60 |
-
wp_enqueue_script('acf-extended-fc-modal-edit', plugins_url('assets/acf-extended-fc-modal-edit.js', ACFE_FILE), array('jquery'
|
61 |
|
62 |
}
|
13 |
wp_enqueue_style('acf-input');
|
14 |
wp_enqueue_script('acf-input');
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
// ACF Extended
|
17 |
wp_enqueue_script('acf-extended', plugins_url('assets/acf-extended.js', ACFE_FILE), array('jquery'), null);
|
18 |
wp_enqueue_style('acf-extended', plugins_url('assets/acf-extended.css', ACFE_FILE), false, null);
|
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 |
|
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);
|
51 |
|
52 |
// ACF Extended: Flexible Content Modal Edit
|
53 |
wp_enqueue_style('acf-extended-fc-modal-edit', plugins_url('assets/acf-extended-fc-modal-edit.css', ACFE_FILE), false, null);
|
54 |
+
wp_enqueue_script('acf-extended-fc-modal-edit', plugins_url('assets/acf-extended-fc-modal-edit.js', ACFE_FILE), array('jquery'), null);
|
55 |
|
56 |
}
|
includes/core/helpers.php
CHANGED
@@ -101,6 +101,19 @@ function the_flexible($selector, $post_id = false){
|
|
101 |
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
/**
|
105 |
* Get Field Group from Field
|
106 |
*/
|
101 |
|
102 |
}
|
103 |
|
104 |
+
/**
|
105 |
+
* Has Flexible
|
106 |
+
*/
|
107 |
+
if(!function_exists('has_flexible')){
|
108 |
+
|
109 |
+
function has_flexible($selector, $post_id = false){
|
110 |
+
|
111 |
+
return have_rows($selector, $post_id);
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
116 |
+
|
117 |
/**
|
118 |
* Get Field Group from Field
|
119 |
*/
|
includes/fields-settings/flexible-content.php
CHANGED
@@ -86,7 +86,7 @@ function acfe_flexible_settings($field){
|
|
86 |
|
87 |
// Layouts preview
|
88 |
acf_render_field_setting($field, array(
|
89 |
-
'label' => __('Layouts
|
90 |
'name' => 'acfe_flexible_layouts_previews',
|
91 |
'key' => 'acfe_flexible_layouts_previews',
|
92 |
'instructions' => __('Use thumbnails as preview in the post administration screen'),
|
@@ -595,4 +595,37 @@ function acfe_flexible_layout_title_remove($title, $field, $layout, $i){
|
|
595 |
|
596 |
return $title;
|
597 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
}
|
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'),
|
595 |
|
596 |
return $title;
|
597 |
|
598 |
+
}
|
599 |
+
|
600 |
+
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' => '',
|
608 |
+
'nonce' => '',
|
609 |
+
'layout' => '',
|
610 |
+
'value' => array()
|
611 |
+
));
|
612 |
+
|
613 |
+
// Load field
|
614 |
+
$field = acf_get_field($options['field_key']);
|
615 |
+
if(!$field)
|
616 |
+
die;
|
617 |
+
|
618 |
+
// Get Flexible
|
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 |
+
|
631 |
}
|
includes/fields-settings/update.php
CHANGED
@@ -29,27 +29,34 @@ function acfe_update_functions($choices){
|
|
29 |
/**
|
30 |
* Exclude layout advanced fields
|
31 |
*/
|
32 |
-
add_filter('acfe/update/exclude', 'acfe_update_exclude',
|
33 |
-
function acfe_update_exclude($exclude, $
|
34 |
|
35 |
$excludes = array('message', 'accordion', 'tab', 'group', 'repeater', 'flexible_content', 'clone', 'acfe_dynamic_message');
|
36 |
-
if(in_array($
|
37 |
$exclude = true;
|
38 |
|
39 |
return $exclude;
|
40 |
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* Add Setting
|
45 |
*/
|
46 |
-
add_action('acf/render_field_settings', 'acfe_update_settings', 991);
|
47 |
function acfe_update_settings($field){
|
48 |
|
49 |
-
$exclude = apply_filters('acfe/update/exclude', false, $field);
|
50 |
-
if($exclude)
|
51 |
-
return;
|
52 |
-
|
53 |
$choices = apply_filters('acfe/update/functions', array(), $field);
|
54 |
if(empty($choices))
|
55 |
return;
|
@@ -82,7 +89,7 @@ function acfe_update_settings($field){
|
|
82 |
),
|
83 |
),
|
84 |
)
|
85 |
-
),
|
86 |
|
87 |
}
|
88 |
|
29 |
/**
|
30 |
* Exclude layout advanced fields
|
31 |
*/
|
32 |
+
add_filter('acfe/update/exclude', 'acfe_update_exclude', 0, 2);
|
33 |
+
function acfe_update_exclude($exclude, $type){
|
34 |
|
35 |
$excludes = array('message', 'accordion', 'tab', 'group', 'repeater', 'flexible_content', 'clone', 'acfe_dynamic_message');
|
36 |
+
if(in_array($type, $excludes))
|
37 |
$exclude = true;
|
38 |
|
39 |
return $exclude;
|
40 |
|
41 |
}
|
42 |
|
43 |
+
foreach(acf_get_field_types_info() as $field){
|
44 |
+
|
45 |
+
$type = $field['name'];
|
46 |
+
|
47 |
+
$exclude = apply_filters('acfe/update/exclude', false, $type);
|
48 |
+
if($exclude)
|
49 |
+
continue;
|
50 |
+
|
51 |
+
add_action('acf/render_field_settings/type=' . $type, 'acfe_update_settings', 991);
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
/**
|
56 |
* Add Setting
|
57 |
*/
|
|
|
58 |
function acfe_update_settings($field){
|
59 |
|
|
|
|
|
|
|
|
|
60 |
$choices = apply_filters('acfe/update/functions', array(), $field);
|
61 |
if(empty($choices))
|
62 |
return;
|
89 |
),
|
90 |
),
|
91 |
)
|
92 |
+
), false);
|
93 |
|
94 |
}
|
95 |
|
includes/fields-settings/validation.php
CHANGED
@@ -81,21 +81,32 @@ function acfe_validate_functions($choices){
|
|
81 |
/**
|
82 |
* Exclude layout advanced fields
|
83 |
*/
|
84 |
-
add_filter('acfe/validate/exclude', 'acfe_validate_exclude',
|
85 |
-
function acfe_validate_exclude($exclude, $
|
86 |
|
87 |
$excludes = array('message', 'accordion', 'tab', 'group', 'repeater', 'flexible_content', 'clone', 'acfe_dynamic_message');
|
88 |
-
if(in_array($
|
89 |
$exclude = true;
|
90 |
|
91 |
return $exclude;
|
92 |
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
/**
|
96 |
* Add Setting
|
97 |
*/
|
98 |
-
add_action('acf/render_field_settings', 'acfe_validation_settings', 990);
|
99 |
function acfe_validation_settings($field){
|
100 |
|
101 |
$exclude = apply_filters('acfe/validate/exclude', false, $field);
|
@@ -204,7 +215,7 @@ function acfe_validation_settings($field){
|
|
204 |
),
|
205 |
),
|
206 |
)
|
207 |
-
),
|
208 |
|
209 |
}
|
210 |
|
81 |
/**
|
82 |
* Exclude layout advanced fields
|
83 |
*/
|
84 |
+
add_filter('acfe/validate/exclude', 'acfe_validate_exclude', 0, 2);
|
85 |
+
function acfe_validate_exclude($exclude, $type){
|
86 |
|
87 |
$excludes = array('message', 'accordion', 'tab', 'group', 'repeater', 'flexible_content', 'clone', 'acfe_dynamic_message');
|
88 |
+
if(in_array($type, $excludes))
|
89 |
$exclude = true;
|
90 |
|
91 |
return $exclude;
|
92 |
|
93 |
}
|
94 |
|
95 |
+
foreach(acf_get_field_types_info() as $field){
|
96 |
+
|
97 |
+
$type = $field['name'];
|
98 |
+
|
99 |
+
$exclude = apply_filters('acfe/validate/exclude', false, $type);
|
100 |
+
if($exclude)
|
101 |
+
continue;
|
102 |
+
|
103 |
+
add_action('acf/render_field_settings/type=' . $type, 'acfe_validation_settings', 990);
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
/**
|
108 |
* Add Setting
|
109 |
*/
|
|
|
110 |
function acfe_validation_settings($field){
|
111 |
|
112 |
$exclude = apply_filters('acfe/validate/exclude', false, $field);
|
215 |
),
|
216 |
),
|
217 |
)
|
218 |
+
), false);
|
219 |
|
220 |
}
|
221 |
|
includes/locations/post-type-archive.php
CHANGED
@@ -54,9 +54,19 @@ function acfe_location_post_type_archive_save(){
|
|
54 |
|
55 |
// Autoload
|
56 |
acf_update_setting('autoload', false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
// Save
|
59 |
-
acf_save_post($
|
60 |
|
61 |
// Redirect
|
62 |
wp_redirect(add_query_arg(array('message' => 'acfe_post_type_archive')));
|
@@ -333,6 +343,13 @@ function acfe_post_type_archive_render_mb($array, $args){
|
|
333 |
// Set post_id
|
334 |
$post_id = $typenow . '_options';
|
335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
// Set form data
|
337 |
acf_form_data(array(
|
338 |
'screen' => 'post_type_archive_options',
|
54 |
|
55 |
// Autoload
|
56 |
acf_update_setting('autoload', false);
|
57 |
+
|
58 |
+
// Post ID
|
59 |
+
$post_id = $post_type . '_options';
|
60 |
+
|
61 |
+
// Languages Support
|
62 |
+
$dl = acf_get_setting('default_language');
|
63 |
+
$cl = acf_get_setting('current_language');
|
64 |
+
|
65 |
+
if($cl && $cl !== $dl)
|
66 |
+
$post_id .= '_' . $cl;
|
67 |
|
68 |
// Save
|
69 |
+
acf_save_post($post_id);
|
70 |
|
71 |
// Redirect
|
72 |
wp_redirect(add_query_arg(array('message' => 'acfe_post_type_archive')));
|
343 |
// Set post_id
|
344 |
$post_id = $typenow . '_options';
|
345 |
|
346 |
+
// Languages Support
|
347 |
+
$dl = acf_get_setting('default_language');
|
348 |
+
$cl = acf_get_setting('current_language');
|
349 |
+
|
350 |
+
if($cl && $cl !== $dl)
|
351 |
+
$post_id .= '_' . $cl;
|
352 |
+
|
353 |
// Set form data
|
354 |
acf_form_data(array(
|
355 |
'screen' => 'post_type_archive_options',
|
includes/locations/taxonomy-archive.php
CHANGED
@@ -76,9 +76,19 @@ function acfe_location_taxonomy_archive_save(){
|
|
76 |
|
77 |
// Autoload
|
78 |
acf_update_setting('autoload', false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
// Save
|
81 |
-
acf_save_post(
|
82 |
|
83 |
// Redirect
|
84 |
wp_redirect(add_query_arg(array('message' => 'acfe_taxonomy_archive')));
|
@@ -346,6 +356,13 @@ function acfe_taxonomy_archive_render_mb($array, $args){
|
|
346 |
// Set post_id
|
347 |
$post_id = 'tax_' . $taxnow . '_options';
|
348 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
// Set form data
|
350 |
acf_form_data(array(
|
351 |
'screen' => 'taxonomy_archive_options',
|
76 |
|
77 |
// Autoload
|
78 |
acf_update_setting('autoload', false);
|
79 |
+
|
80 |
+
// Post ID
|
81 |
+
$post_id = 'tax_' . $taxonomy . '_options';
|
82 |
+
|
83 |
+
// Languages Support
|
84 |
+
$dl = acf_get_setting('default_language');
|
85 |
+
$cl = acf_get_setting('current_language');
|
86 |
+
|
87 |
+
if($cl && $cl !== $dl)
|
88 |
+
$post_id .= '_' . $cl;
|
89 |
|
90 |
// Save
|
91 |
+
acf_save_post($post_id);
|
92 |
|
93 |
// Redirect
|
94 |
wp_redirect(add_query_arg(array('message' => 'acfe_taxonomy_archive')));
|
356 |
// Set post_id
|
357 |
$post_id = 'tax_' . $taxnow . '_options';
|
358 |
|
359 |
+
// Languages Support
|
360 |
+
$dl = acf_get_setting('default_language');
|
361 |
+
$cl = acf_get_setting('current_language');
|
362 |
+
|
363 |
+
if($cl && $cl !== $dl)
|
364 |
+
$post_id .= '_' . $cl;
|
365 |
+
|
366 |
// Set form data
|
367 |
acf_form_data(array(
|
368 |
'screen' => 'taxonomy_archive_options',
|
includes/modules/dynamic-block-type.php
CHANGED
@@ -453,7 +453,7 @@ function acfe_dbt_admin_columns_html($column, $post_id){
|
|
453 |
add_filter('post_row_actions','acfe_dbt_admin_row', 10, 2);
|
454 |
function acfe_dbt_admin_row($actions, $post){
|
455 |
|
456 |
-
if($post->post_type != 'acfe-dbt')
|
457 |
return $actions;
|
458 |
|
459 |
$post_id = $post->ID;
|
453 |
add_filter('post_row_actions','acfe_dbt_admin_row', 10, 2);
|
454 |
function acfe_dbt_admin_row($actions, $post){
|
455 |
|
456 |
+
if($post->post_type != 'acfe-dbt' || $post->post_status != 'publish')
|
457 |
return $actions;
|
458 |
|
459 |
$post_id = $post->ID;
|
includes/modules/dynamic-options-page.php
CHANGED
@@ -147,7 +147,11 @@ function acfe_dop_filter_save($post_id){
|
|
147 |
return;
|
148 |
|
149 |
$title = get_field('page_title', $post_id);
|
150 |
-
$name =
|
|
|
|
|
|
|
|
|
151 |
|
152 |
// Update post
|
153 |
wp_update_post(array(
|
@@ -233,7 +237,7 @@ function acfe_dop_filter_status_trash($post){
|
|
233 |
|
234 |
$post_id = $post->ID;
|
235 |
$title = get_field('page_title', $post_id);
|
236 |
-
$name =
|
237 |
|
238 |
// Get ACFE option
|
239 |
$option = get_option('acfe_dynamic_options_pages', array());
|
@@ -308,7 +312,7 @@ function acfe_dop_admin_columns($columns){
|
|
308 |
if(isset($columns['date']))
|
309 |
unset($columns['date']);
|
310 |
|
311 |
-
$columns['
|
312 |
$columns['post_id'] = __('Post ID');
|
313 |
$columns['autoload'] = __('Autoload');
|
314 |
|
@@ -322,22 +326,12 @@ function acfe_dop_admin_columns($columns){
|
|
322 |
add_action('manage_acfe-dop_posts_custom_column', 'acfe_dop_admin_columns_html', 10, 2);
|
323 |
function acfe_dop_admin_columns_html($column, $post_id){
|
324 |
|
325 |
-
//
|
326 |
-
if($column == '
|
327 |
-
|
328 |
-
$page_title = get_field('page_title', $post_id);
|
329 |
-
$menu_title = get_field('menu_title', $post_id);
|
330 |
-
$menu_title = get_field('menu_title', $post_id);
|
331 |
|
332 |
-
|
333 |
-
|
334 |
-
$menu_slug = sanitize_title($menu_title);
|
335 |
-
if(empty($menu_title))
|
336 |
-
$menu_slug = sanitize_title($page_title);
|
337 |
-
|
338 |
-
}
|
339 |
|
340 |
-
echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . $
|
341 |
|
342 |
}
|
343 |
|
@@ -348,7 +342,7 @@ function acfe_dop_admin_columns_html($column, $post_id){
|
|
348 |
if(empty($p_id))
|
349 |
$p_id = 'options';
|
350 |
|
351 |
-
echo $p_id;
|
352 |
|
353 |
}
|
354 |
|
@@ -372,10 +366,10 @@ function acfe_dop_admin_columns_html($column, $post_id){
|
|
372 |
add_filter('post_row_actions','acfe_dop_admin_row', 10, 2);
|
373 |
function acfe_dop_admin_row($actions, $post){
|
374 |
|
375 |
-
if($post->post_type != 'acfe-dop')
|
376 |
return $actions;
|
377 |
|
378 |
-
$name =
|
379 |
|
380 |
$actions['acfe_dpt_export_json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dop_export&keys=' . $name) . '">' . __('Json') . '</a>';
|
381 |
|
@@ -383,6 +377,56 @@ function acfe_dop_admin_row($actions, $post){
|
|
383 |
|
384 |
}
|
385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
/**
|
387 |
* Dynamic Options Page: Local Field Group
|
388 |
*/
|
@@ -435,6 +479,28 @@ function acfe_dop_local_field_group(){
|
|
435 |
'append' => '',
|
436 |
'maxlength' => '',
|
437 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
array(
|
439 |
'key' => 'field_acfe_dop_menu_title',
|
440 |
'label' => 'Menu title',
|
147 |
return;
|
148 |
|
149 |
$title = get_field('page_title', $post_id);
|
150 |
+
$name = get_field('acfe_dop_name', $post_id);
|
151 |
+
|
152 |
+
// Force name
|
153 |
+
if(empty($name))
|
154 |
+
$name = sanitize_title($title);
|
155 |
|
156 |
// Update post
|
157 |
wp_update_post(array(
|
237 |
|
238 |
$post_id = $post->ID;
|
239 |
$title = get_field('page_title', $post_id);
|
240 |
+
$name = get_field('acfe_dop_name', $post_id);
|
241 |
|
242 |
// Get ACFE option
|
243 |
$option = get_option('acfe_dynamic_options_pages', array());
|
312 |
if(isset($columns['date']))
|
313 |
unset($columns['date']);
|
314 |
|
315 |
+
$columns['name'] = __('Name');
|
316 |
$columns['post_id'] = __('Post ID');
|
317 |
$columns['autoload'] = __('Autoload');
|
318 |
|
326 |
add_action('manage_acfe-dop_posts_custom_column', 'acfe_dop_admin_columns_html', 10, 2);
|
327 |
function acfe_dop_admin_columns_html($column, $post_id){
|
328 |
|
329 |
+
// Name
|
330 |
+
if($column == 'name'){
|
|
|
|
|
|
|
|
|
331 |
|
332 |
+
$name = get_field('acfe_dop_name', $post_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
|
334 |
+
echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . $name . '</code>';
|
335 |
|
336 |
}
|
337 |
|
342 |
if(empty($p_id))
|
343 |
$p_id = 'options';
|
344 |
|
345 |
+
echo '<code style="-webkit-user-select: all;-moz-user-select: all;-ms-user-select: all;user-select: all;font-size: 12px;">' . $p_id. '</code>';
|
346 |
|
347 |
}
|
348 |
|
366 |
add_filter('post_row_actions','acfe_dop_admin_row', 10, 2);
|
367 |
function acfe_dop_admin_row($actions, $post){
|
368 |
|
369 |
+
if($post->post_type != 'acfe-dop' || $post->post_status != 'publish')
|
370 |
return $actions;
|
371 |
|
372 |
+
$name = get_field('acfe_dop_name', $post_id);
|
373 |
|
374 |
$actions['acfe_dpt_export_json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=acfe_tool_dop_export&keys=' . $name) . '">' . __('Json') . '</a>';
|
375 |
|
377 |
|
378 |
}
|
379 |
|
380 |
+
/**
|
381 |
+
* Admin Disable Name
|
382 |
+
*/
|
383 |
+
add_filter('acf/prepare_field/name=acfe_dop_name', 'acfe_dop_admin_disable_name');
|
384 |
+
function acfe_dop_admin_disable_name($field){
|
385 |
+
|
386 |
+
global $pagenow;
|
387 |
+
if($pagenow != 'post.php')
|
388 |
+
return $field;
|
389 |
+
|
390 |
+
$field['disabled'] = true;
|
391 |
+
|
392 |
+
return $field;
|
393 |
+
|
394 |
+
}
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Admin Force Name
|
398 |
+
*/
|
399 |
+
add_action('load-edit.php', 'acfe_dop_admin_name_value');
|
400 |
+
function acfe_dop_admin_name_value(){
|
401 |
+
|
402 |
+
// Get post type
|
403 |
+
global $typenow;
|
404 |
+
|
405 |
+
// Check post type
|
406 |
+
$post_type = $typenow;
|
407 |
+
if(empty($post_type) || $post_type != 'acfe-dop')
|
408 |
+
return;
|
409 |
+
|
410 |
+
$get_options = get_posts(array(
|
411 |
+
'post_type' => 'acfe-dop',
|
412 |
+
'posts_per_page' => -1,
|
413 |
+
'fields' => 'ids'
|
414 |
+
));
|
415 |
+
|
416 |
+
if(empty($get_options))
|
417 |
+
return;
|
418 |
+
|
419 |
+
foreach($get_options as $post_id){
|
420 |
+
|
421 |
+
if(get_field('acfe_dop_name', $post_id))
|
422 |
+
continue;
|
423 |
+
|
424 |
+
update_field('acfe_dop_name', sanitize_title(get_field('page_title', $post_id)), $post_id);
|
425 |
+
|
426 |
+
}
|
427 |
+
|
428 |
+
}
|
429 |
+
|
430 |
/**
|
431 |
* Dynamic Options Page: Local Field Group
|
432 |
*/
|
479 |
'append' => '',
|
480 |
'maxlength' => '',
|
481 |
),
|
482 |
+
array(
|
483 |
+
'key' => 'field_acfe_dop_name',
|
484 |
+
'label' => 'Name',
|
485 |
+
'name' => 'acfe_dop_name',
|
486 |
+
'type' => 'acfe_slug',
|
487 |
+
'instructions' => '(string) Options page slug. Must be unique',
|
488 |
+
'required' => 1,
|
489 |
+
'conditional_logic' => 0,
|
490 |
+
'wrapper' => array(
|
491 |
+
'width' => '',
|
492 |
+
'class' => '',
|
493 |
+
'id' => '',
|
494 |
+
),
|
495 |
+
'acfe_validate' => '',
|
496 |
+
'acfe_update' => '',
|
497 |
+
'acfe_permissions' => '',
|
498 |
+
'default_value' => '',
|
499 |
+
'placeholder' => '',
|
500 |
+
'prepend' => '',
|
501 |
+
'append' => '',
|
502 |
+
'maxlength' => '',
|
503 |
+
),
|
504 |
array(
|
505 |
'key' => 'field_acfe_dop_menu_title',
|
506 |
'label' => 'Menu title',
|
includes/modules/dynamic-post-type.php
CHANGED
@@ -570,7 +570,7 @@ function acfe_dpt_admin_columns_html($column, $post_id){
|
|
570 |
add_filter('post_row_actions','acfe_dpt_admin_row', 10, 2);
|
571 |
function acfe_dpt_admin_row($actions, $post){
|
572 |
|
573 |
-
if($post->post_type != 'acfe-dpt')
|
574 |
return $actions;
|
575 |
|
576 |
$post_id = $post->ID;
|
570 |
add_filter('post_row_actions','acfe_dpt_admin_row', 10, 2);
|
571 |
function acfe_dpt_admin_row($actions, $post){
|
572 |
|
573 |
+
if($post->post_type != 'acfe-dpt' || $post->post_status != 'publish')
|
574 |
return $actions;
|
575 |
|
576 |
$post_id = $post->ID;
|
includes/modules/dynamic-taxonomy.php
CHANGED
@@ -510,7 +510,7 @@ function acfe_dt_admin_columns_html($column, $post_id){
|
|
510 |
add_filter('post_row_actions','acfe_dt_admin_row', 10, 2);
|
511 |
function acfe_dt_admin_row($actions, $post){
|
512 |
|
513 |
-
if($post->post_type != 'acfe-dt')
|
514 |
return $actions;
|
515 |
|
516 |
$post_id = $post->ID;
|
510 |
add_filter('post_row_actions','acfe_dt_admin_row', 10, 2);
|
511 |
function acfe_dt_admin_row($actions, $post){
|
512 |
|
513 |
+
if($post->post_type != 'acfe-dt' || $post->post_status != 'publish')
|
514 |
return $actions;
|
515 |
|
516 |
$post_id = $post->ID;
|
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
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -161,7 +161,7 @@ Taxonomies list & edit views have been enhanced for a more consistent administra
|
|
161 |
Manage WordPress options from Settings > Options.
|
162 |
|
163 |
* View, add, edit and delete options
|
164 |
-
* Working with strings
|
165 |
|
166 |
= ACF: Options Pages =
|
167 |
|
@@ -205,12 +205,15 @@ Manage ACF Block Types from ACF > Block Types.
|
|
205 |
* Thanks to [Damien C.](https://twitter.com/DamChtlv) for his support & tests
|
206 |
* Thanks to [Valentin P.](https://twitter.com/Val_Pellegrin) for his support & tests
|
207 |
* Thanks to Damian P. for his support & tests
|
|
|
|
|
208 |
|
209 |
== 🛠️ Links ==
|
210 |
|
211 |
* Found a bug? [Submit a ticket](https://wordpress.org/support/plugin/acf-extended)
|
212 |
* Enjoying this plugin? [Submit a review](https://wordpress.org/support/plugin/acf-extended/reviews/#new-post)
|
213 |
* Want to keep me awake? [Buy me a coffee](https://ko-fi.com/acfextended)
|
|
|
214 |
|
215 |
== Installation ==
|
216 |
|
@@ -305,6 +308,26 @@ Note (2): The image container has a default background color set to: `#fafafa`.
|
|
305 |
|
306 |
== Changelog ==
|
307 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
= 0.7.5 =
|
309 |
* Field: Flexible Content - Added 'Control': Copy, Paste & Duplicate Layouts on the fly using icons in the layouts handle
|
310 |
* Field: Flexible Content - Control: Copy & Paste all layouts on the fly using the new icon next to 'Add row' button (can be used to transfer layout data from one page to an another)
|
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 |
|
161 |
Manage WordPress options from Settings > Options.
|
162 |
|
163 |
* View, add, edit and delete options
|
164 |
+
* Working with strings, serialized & Json values
|
165 |
|
166 |
= ACF: Options Pages =
|
167 |
|
205 |
* Thanks to [Damien C.](https://twitter.com/DamChtlv) for his support & tests
|
206 |
* Thanks to [Valentin P.](https://twitter.com/Val_Pellegrin) for his support & tests
|
207 |
* Thanks to Damian P. for his support & tests
|
208 |
+
* Thanks to [Jaakko S.](https://twitter.com/jsaarenk) for his support & tests
|
209 |
+
* Thanks to [Renan A.](https://twitter.com/altendorfme) for his support & tests
|
210 |
|
211 |
== 🛠️ Links ==
|
212 |
|
213 |
* Found a bug? [Submit a ticket](https://wordpress.org/support/plugin/acf-extended)
|
214 |
* Enjoying this plugin? [Submit a review](https://wordpress.org/support/plugin/acf-extended/reviews/#new-post)
|
215 |
* Want to keep me awake? [Buy me a coffee](https://ko-fi.com/acfextended)
|
216 |
+
* Want to check upcoming features? [Here is my Twitter](https://twitter.com/hwkfr)
|
217 |
|
218 |
== Installation ==
|
219 |
|
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
|
314 |
+
* Field: Flexible Content - Automatically open layout edition modal when adding a new layout
|
315 |
+
* Field: Flexible Content - Added 'Close' (collapse) button at the bottom of layout when opened
|
316 |
+
* Field: Flexible Content - Fixed typo error in the 'Paste Layouts' prompt
|
317 |
+
* Field: Flexible Content - Added Flexbox CSS compatibility
|
318 |
+
* Field: Flexible Content - Better Multi Modal Handling (modal inside a modal inside a modal...)
|
319 |
+
* Field: Flexible Content - Better Field Validation Handling inside layouts
|
320 |
+
* Field: Flexible Content - Added `has_flexible($field_name, $post_id)` front-end function to check if rows exists
|
321 |
+
* Field: Flexible Content Control - Automatically scroll to the new layout position when using 'Clone Layout'
|
322 |
+
* Field: Flexible Content Control - Fixed 'Clone Layout' when an already cloned layout had an 'Editor' field
|
323 |
+
* Field: Flexible Content Control - Fixed 'Clone Layout' unwanted icon when a layout had an 'Accordion' field
|
324 |
+
* Field: Advanced Validation/Update - The settings are now hidden on non-necessary fields (Clone, Flexible content, Tabs etc...)
|
325 |
+
* Module: Dynamic Options Pages - Now forces a unique slug to avoid duplication
|
326 |
+
* Module: Dynamic Post Types/Taxonomies/Options Pages & Block Types - Manual Json export has been removed from possible actions on the trashed status screen
|
327 |
+
* Module: Options - Fixed a CSS enqueue problem introduced in last patch
|
328 |
+
* Location: Post Type Archive & Taxonomy Archive options now use ACF multi-languages settings
|
329 |
+
* General: Removed jQuery UI & jQuery UI Dialog dependency (ACF Extended now uses its own lightweight modal system)
|
330 |
+
|
331 |
= 0.7.5 =
|
332 |
* Field: Flexible Content - Added 'Control': Copy, Paste & Duplicate Layouts on the fly using icons in the layouts handle
|
333 |
* Field: Flexible Content - Control: Copy & Paste all layouts on the fly using the new icon next to 'Add row' button (can be used to transfer layout data from one page to an another)
|