Version Description
- Field: Flexible Content - Added Inline Layout Title Edition
- Field: Flexible Content - Added Auto scroll + Modal edit on One Click layout
- Field: Flexible Content - Removed native "Controls Icons" visibility being visible on all sub flexible content fields (better readability)
- Field: Flexible Content - Added WP Unslash on preview values to prevent backlashes on values (thanks @Dam)
- Field: Flexible Content - Added compatibility for layouts that have been synced and not manually created (thanks @T. Dubois)
- Field: Flexible Content - Copy/Paste functionality is now a Flexible Content setting (Default: Disabled) (Feature resquest: @louiswalch)
- Field: Flexible Content - 'Close Button' (collapse) on layouts is now a Flexible Content setting(Default: Disabled)
- Field: Flexible Content - Layouts Thumbnails aspect ratio are now locked (base ratio: 450px * 200px) (Feature resquest: @louiswalch)
- Field: Flexible Content - Dynamic Layout Preview refresh has been optimized. The preview content is now kept instead of being reset
- Field: Flexible Content - Dynamic Layout Preview style & script enqueue now use wp_enqueue_style() & wp_enqueue_script()
- Field: Flexible Content - Modal Edition - 'Enter' & 'ESC' keys now close Modals (instead of submitting the form)
- Field: Flexible Content - Added
action('acfe/flexible/enqueue', $field, $is_preview)
to enqueue new style/script (back & front) (with 6 variations) - Field: Flexible Content - Added
filter('acfe/flexible/layout/thumbnail/layout={layout:name}', $thumbnail, $field, $layout)
to change layout thumbnail (must returnattachment ID
orURL
) (with 3 variations) - Field: Flexible Content - Added
action('acfe/flexible/preview', $field, $layout)
to change Dynamic Layout Preview content (with 6 variations) - Field: Flexible Content - Added
filter('acfe/flexible/render/template', $template, $field, $layout, $is_preview)
to change Layout Render: Template Path (with 6 variations) - Field: Flexible Content - Added
filter('acfe/flexible/render/style', $style, $field, $layout, $is_preview)
to change Layout Render: Style Path (with 6 variations) - Field: Flexible Content - Added
filter('acfe/flexible/render/script', $script, $field, $layout, $is_preview)
to change Layout Render: Script Path (with 6 variations) - Field: Flexible Content - Added
filter('acfe/flexible/placeholder/icon', $class, $field)
to change the Placeholder Button Dashicon class (default: 'dashicons dashicons-edit') (with 3 variations) - Module: Dynamic Options Page - Fixed 'Undefinied $post_id' PHP warning in Dynamic Options Page screen
- Module: Dynamic Options Page - Fixed registration order for child options pages (thanks @Val)
- Module: Dynamic Post Type - Fixed undefined ID php Warning on edit screen when Dynamic Post Type is registered locally (thanks @Val)
- Module: Dynamic Taxonomies - Taxonomy name character limit has been fixed to 32 instead of 20 (thanks @Damian)
- Module: Dynamic Taxonomies - 'Add New' button is now based on Taxonomy capabilities & Taxonomy Label (thanks @absolute_web)
- Module: Author - Field groups 'Hide on screen' is now taken in account (thanks @louiswalch)
- Tools: Dynamic Taxonomies Import - Fixed 'undefined index' PHP warning on taxonomy import (thanks @Val)
Download this release
Release Info
Developer | hwk-fr |
Plugin | Advanced Custom Fields: Extended |
Version | 0.7.9 |
Comparing to | |
See all releases |
Code changes from version 0.7.8 to 0.7.9
- acf-extended.php +1 -1
- assets/acf-extended-fc-control.css +53 -1
- assets/acf-extended-fc-control.js +166 -44
- assets/acf-extended-fc-modal-edit.js +14 -33
- assets/acf-extended-fc-modal-select.js +12 -7
- assets/acf-extended-fc.css +41 -4
- assets/acf-extended-fc.js +188 -87
- assets/acf-extended.js +27 -0
- includes/admin/tools/dop-import.php +41 -1
- includes/admin/tools/dt-import.php +2 -1
- includes/core/enqueue.php +4 -0
- includes/core/helpers.php +84 -74
- includes/fields-settings/data.php +1 -1
- includes/fields-settings/flexible-content.php +220 -38
- includes/modules/author.php +13 -0
- includes/modules/dynamic-options-page.php +47 -4
- includes/modules/dynamic-post-type.php +3 -0
- includes/modules/dynamic-taxonomy.php +5 -3
- includes/modules/taxonomy.php +6 -1
- readme.txt +195 -8
acf-extended.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: Enhancement Suite which improves Advanced Custom Fields administration
|
5 |
-
* Version: 0.7.
|
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.9
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
assets/acf-extended-fc-control.css
CHANGED
@@ -9,6 +9,58 @@
|
|
9 |
font-family: dashicons;
|
10 |
}
|
11 |
|
12 |
-
.acf-flexible-content .layout:hover .acf-icon.acfe-flexible-icon.dashicons{
|
13 |
visibility: visible;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
9 |
font-family: dashicons;
|
10 |
}
|
11 |
|
12 |
+
.acf-flexible-content .layout:hover > .acf-fc-layout-controls .acf-icon.acfe-flexible-icon.dashicons{
|
13 |
visibility: visible;
|
14 |
+
}
|
15 |
+
|
16 |
+
.acf-flexible-content .layout:hover .acf-fc-layout-controls .acf-icon.-plus,
|
17 |
+
.acf-flexible-content .layout:hover .acf-fc-layout-controls .acf-icon.-minus,
|
18 |
+
.acf-flexible-content .layout.-hover .acf-fc-layout-controls .acf-icon.-plus,
|
19 |
+
.acf-flexible-content .layout.-hover .acf-fc-layout-controls .acf-icon.-minus{
|
20 |
+
visibility: hidden;
|
21 |
+
}
|
22 |
+
|
23 |
+
.acf-flexible-content .layout:hover > .acf-fc-layout-controls .acf-icon.-plus,
|
24 |
+
.acf-flexible-content .layout:hover > .acf-fc-layout-controls .acf-icon.-minus,
|
25 |
+
.acf-flexible-content .layout.-hover > .acf-fc-layout-controls .acf-icon.-plus,
|
26 |
+
.acf-flexible-content .layout.-hover > .acf-fc-layout-controls .acf-icon.-minus{
|
27 |
+
visibility: visible;
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
/*
|
32 |
+
* ACFE: Title Edit
|
33 |
+
*/
|
34 |
+
.acf-field-acfe-flexible-layout-title{
|
35 |
+
display:none;
|
36 |
+
}
|
37 |
+
|
38 |
+
input.acfe-flexible-control-title{
|
39 |
+
border:none;
|
40 |
+
box-shadow:none !important;
|
41 |
+
outline:none !important;
|
42 |
+
border-radius:0;
|
43 |
+
border-bottom:1px solid transparent !important;
|
44 |
+
font-weight:600;
|
45 |
+
width:auto !important;
|
46 |
+
padding:0 !important;
|
47 |
+
display:none;
|
48 |
+
}
|
49 |
+
|
50 |
+
.layout > .acf-fc-layout-handle .acfe-layout-title{
|
51 |
+
cursor:text;
|
52 |
+
position:relative;
|
53 |
+
}
|
54 |
+
|
55 |
+
.layout > .acf-fc-layout-handle .acfe-layout-title:hover{
|
56 |
+
background:#f4f4f4;
|
57 |
+
}
|
58 |
+
|
59 |
+
.layout.acfe-flexible-title-edition > .acf-fc-layout-handle .acfe-layout-title input.acfe-flexible-control-title{
|
60 |
+
display:inline-block;
|
61 |
+
border-bottom:1px solid #ddd !important;
|
62 |
+
}
|
63 |
+
|
64 |
+
.layout.acfe-flexible-title-edition > .acf-fc-layout-handle .acfe-layout-title .acfe-layout-title-text{
|
65 |
+
display:none;
|
66 |
}
|
assets/acf-extended-fc-control.js
CHANGED
@@ -13,6 +13,116 @@
|
|
13 |
* Actions
|
14 |
*/
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
// Layout: Clone
|
17 |
model.events['click [data-acfe-flexible-control-clone]'] = 'acfeCloneLayout';
|
18 |
model.acfeCloneLayout = function(e, $el){
|
@@ -38,11 +148,6 @@
|
|
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
|
@@ -430,55 +535,72 @@
|
|
430 |
*/
|
431 |
acf.addAction('new_field/type=flexible_content', function(flexible){
|
432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
/*
|
434 |
-
*
|
435 |
*/
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
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 |
-
|
476 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
13 |
* Actions
|
14 |
*/
|
15 |
|
16 |
+
// Layout: Edit Title
|
17 |
+
model.events['focusout input.acfe-flexible-control-title'] = 'acfeEditLayoutTitleToggle';
|
18 |
+
model.events['click .acfe-layout-title-text'] = 'acfeEditLayoutTitle';
|
19 |
+
model.acfeEditLayoutTitle = function(e, $el){
|
20 |
+
|
21 |
+
// Stop propagation
|
22 |
+
e.stopPropagation();
|
23 |
+
|
24 |
+
// Get Flexible
|
25 |
+
var flexible = this;
|
26 |
+
|
27 |
+
// Toggle
|
28 |
+
flexible.acfeEditLayoutTitleToggle(e, $el);
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
model.acfeEditLayoutTitleToggle = function(e, $el){
|
33 |
+
|
34 |
+
var flexible = this;
|
35 |
+
|
36 |
+
// Vars
|
37 |
+
var $layout = $el.closest('.layout');
|
38 |
+
var $handle = $layout.find('> .acf-fc-layout-handle');
|
39 |
+
var $title = $handle.find('.acfe-layout-title');
|
40 |
+
|
41 |
+
|
42 |
+
if(flexible.has('acfeFlexibleModalEdition')){
|
43 |
+
|
44 |
+
var $hidden = $layout.find('> .acfe-modal > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields > .acf-field-acfe-flexible-layout-title > .acf-input > .acf-input-wrap > input');
|
45 |
+
|
46 |
+
}else{
|
47 |
+
|
48 |
+
var $hidden = $layout.find('> .acf-fields > .acf-field-acfe-flexible-layout-title > .acf-input > .acf-input-wrap > input');
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
// Hidden Input
|
53 |
+
if($hidden.length){
|
54 |
+
|
55 |
+
// Add Edit Title
|
56 |
+
$hidden.addClass('acfe-flexible-control-title').attr('data-acfe-flexible-control-title-input', 1).insertAfter($handle);
|
57 |
+
|
58 |
+
// Remove legacy field
|
59 |
+
$layout.find('> .acf-fields > .acf-field-acfe-flexible-layout-title').remove();
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
if($layout.hasClass('acfe-flexible-title-edition')){
|
64 |
+
|
65 |
+
var $input = $title.find('> input[data-acfe-flexible-control-title-input]');
|
66 |
+
|
67 |
+
if($input.val() === '')
|
68 |
+
$input.val($input.attr('placeholder')).trigger('input');
|
69 |
+
|
70 |
+
$layout.removeClass('acfe-flexible-title-edition');
|
71 |
+
|
72 |
+
$input.insertAfter($handle);
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
else{
|
77 |
+
|
78 |
+
var $input = $layout.find('> input[data-acfe-flexible-control-title-input]');
|
79 |
+
|
80 |
+
var $input = $input.appendTo($title);
|
81 |
+
|
82 |
+
$layout.addClass('acfe-flexible-title-edition');
|
83 |
+
$input.focus().attr('size', $input.val().length);
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
// Layout: Edit Title
|
90 |
+
model.events['click input.acfe-flexible-control-title'] = 'acfeEditLayoutTitlePropagation';
|
91 |
+
model.acfeEditLayoutTitlePropagation = function(e, $el){
|
92 |
+
|
93 |
+
e.stopPropagation();
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
// Layout: Edit Title Input
|
98 |
+
model.events['input [data-acfe-flexible-control-title-input]'] = 'acfeEditLayoutTitleInput';
|
99 |
+
model.acfeEditLayoutTitleInput = function(e, $el){
|
100 |
+
|
101 |
+
// Vars
|
102 |
+
var $layout = $el.closest('.layout');
|
103 |
+
var $title = $layout.find('> .acf-fc-layout-handle .acfe-layout-title .acfe-layout-title-text');
|
104 |
+
|
105 |
+
var val = $el.val();
|
106 |
+
|
107 |
+
$el.attr('size', val.length);
|
108 |
+
|
109 |
+
$title.html(val);
|
110 |
+
|
111 |
+
}
|
112 |
+
|
113 |
+
// Layout: Edit Title Input Enter
|
114 |
+
model.events['keypress [data-acfe-flexible-control-title-input]'] = 'acfeEditLayoutTitleInputEnter';
|
115 |
+
model.acfeEditLayoutTitleInputEnter = function(e, $el){
|
116 |
+
|
117 |
+
// Enter Key
|
118 |
+
if(e.keyCode != 13)
|
119 |
+
return;
|
120 |
+
|
121 |
+
e.preventDefault();
|
122 |
+
$el.blur();
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
// Layout: Clone
|
127 |
model.events['click [data-acfe-flexible-control-clone]'] = 'acfeCloneLayout';
|
128 |
model.acfeCloneLayout = function(e, $el){
|
148 |
before: $layout_original
|
149 |
});
|
150 |
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
|
153 |
// Layout: Copy
|
535 |
*/
|
536 |
acf.addAction('new_field/type=flexible_content', function(flexible){
|
537 |
|
538 |
+
if(!flexible.has('acfeFlexibleCopyPaste'))
|
539 |
+
return;
|
540 |
+
|
541 |
+
/*
|
542 |
+
* Stylised Button
|
543 |
+
*/
|
544 |
+
if(flexible.has('acfeFlexibleStylisedButton')){
|
545 |
+
|
546 |
+
var $dropdown = $('' +
|
547 |
+
'<a href="#" class="button" style="padding-left:5px;padding-right:5px; margin-left:3px;" data-name="acfe-flexible-control-button">' +
|
548 |
+
' <span class="dashicons dashicons-arrow-down-alt2" style="vertical-align:text-top;width:auto;height:auto;font-size:13px;line-height:20px;"></span>' +
|
549 |
+
'</a>' +
|
550 |
+
|
551 |
+
'<script type="text-html" class="tmpl-acfe-flexible-control-popup">' +
|
552 |
+
' <ul>' +
|
553 |
+
' <li><a href="#" data-acfe-flexible-control-action="copy">Copy layouts</a></li>' +
|
554 |
+
' <li><a href="#" data-acfe-flexible-control-action="paste">Paste layouts</a></li>' +
|
555 |
+
' </ul>' +
|
556 |
+
'</script>');
|
557 |
+
|
558 |
+
// Add button
|
559 |
+
flexible.$el.find('> .acf-input > .acf-flexible-content > .acfe-flexible-stylised-button > .acf-actions > .acf-button').after($dropdown);
|
560 |
+
|
561 |
+
|
562 |
+
}
|
563 |
+
|
564 |
/*
|
565 |
+
* Unstylised
|
566 |
*/
|
567 |
+
else{
|
568 |
+
|
569 |
+
var $dropdown = $('' +
|
570 |
+
'<a href="#" class="button button-primary" style="padding-left:5px;padding-right:5px; margin-left:3px;" data-name="acfe-flexible-control-button">' +
|
571 |
+
' <span class="dashicons dashicons-arrow-down-alt2" style="vertical-align:text-top;width:auto;height:auto;font-size:13px;line-height:20px;"></span>' +
|
572 |
+
'</a>' +
|
573 |
+
|
574 |
+
'<script type="text-html" class="tmpl-acfe-flexible-control-popup">' +
|
575 |
+
' <ul>' +
|
576 |
+
' <li><a href="#" data-acfe-flexible-control-action="copy">Copy layouts</a></li>' +
|
577 |
+
' <li><a href="#" data-acfe-flexible-control-action="paste">Paste layouts</a></li>' +
|
578 |
+
' </ul>' +
|
579 |
+
'</script>');
|
580 |
+
|
581 |
+
// Add button
|
582 |
+
flexible.$el.find('> .acf-input > .acf-flexible-content > .acf-actions > .acf-button').after($dropdown);
|
583 |
+
|
584 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
|
586 |
});
|
587 |
|
588 |
acf.addAction('acfe/flexible/layouts', function($layout, flexible){
|
589 |
|
590 |
+
// vars
|
591 |
var $controls = $layout.find('> .acf-fc-layout-controls');
|
592 |
|
593 |
+
if(flexible.has('acfeFlexibleCopyPaste')){
|
594 |
+
|
595 |
+
// Button: Copy
|
596 |
+
$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>');
|
597 |
+
|
598 |
+
}
|
599 |
+
|
600 |
+
// Button: Clone
|
601 |
+
$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>');
|
602 |
+
|
603 |
|
|
|
|
|
|
|
|
|
604 |
|
605 |
});
|
606 |
|
assets/acf-extended-fc-modal-edit.js
CHANGED
@@ -25,20 +25,27 @@
|
|
25 |
var $handle = $layout.find('> .acf-fc-layout-handle');
|
26 |
|
27 |
var $layout_order = $handle.find('> .acf-fc-layout-order').outerHTML();
|
28 |
-
var $layout_title = $handle.find('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
// Open modal
|
31 |
acfe.modal.open($modal, {
|
32 |
title: $layout_order + ' ' + $layout_title,
|
33 |
-
footer:
|
34 |
onClose: function(){
|
35 |
|
36 |
-
flexible.
|
37 |
|
38 |
}
|
39 |
});
|
40 |
|
41 |
-
}
|
42 |
|
43 |
/*
|
44 |
* Spawn
|
@@ -56,46 +63,20 @@
|
|
56 |
|
57 |
});
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
return;
|
63 |
-
|
64 |
-
// Get Flexible
|
65 |
-
var flexible = acf.getInstance($layout.closest('.acf-field-flexible-content'));
|
66 |
-
|
67 |
-
if(!flexible.has('acfeFlexibleModalEdition'))
|
68 |
-
return;
|
69 |
-
|
70 |
-
// Wrap content
|
71 |
-
$layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acfe-modal"><div class="acfe-modal-wrapper"><div class="acfe-modal-content"></div></div></div>');
|
72 |
-
|
73 |
-
// Placeholder
|
74 |
-
$layout.find('> .acfe-flexible-collapsed-placeholder').attr('data-action', 'acfe-flexible-modal-edit');
|
75 |
-
|
76 |
-
});
|
77 |
-
|
78 |
acf.addAction('acfe/flexible/layouts', function($layout, flexible){
|
79 |
|
80 |
if(!flexible.has('acfeFlexibleModalEdition'))
|
81 |
return;
|
82 |
|
83 |
// var
|
84 |
-
var $name = $layout.data('layout');
|
85 |
var $controls = $layout.find('> .acf-fc-layout-controls');
|
86 |
|
87 |
// Remove collapse button
|
88 |
$controls.find('> a.-collapse').remove();
|
89 |
|
90 |
-
// Force close
|
91 |
-
flexible.closeLayout($layout);
|
92 |
-
|
93 |
-
// Wrap content
|
94 |
-
$layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acfe-modal"><div class="acfe-modal-wrapper"><div class="acfe-modal-content"></div></div></div>');
|
95 |
-
|
96 |
-
// Placeholder
|
97 |
-
$layout.find('> .acfe-flexible-collapsed-placeholder').attr('data-action', 'acfe-flexible-modal-edit');
|
98 |
-
|
99 |
});
|
100 |
|
101 |
})(jQuery);
|
25 |
var $handle = $layout.find('> .acf-fc-layout-handle');
|
26 |
|
27 |
var $layout_order = $handle.find('> .acf-fc-layout-order').outerHTML();
|
28 |
+
var $layout_title = $handle.find('.acfe-layout-title-text').text();
|
29 |
+
|
30 |
+
var close = false;
|
31 |
+
if(flexible.has('acfeFlexibleCloseButton')){
|
32 |
+
|
33 |
+
close = 'Close';
|
34 |
+
|
35 |
+
}
|
36 |
|
37 |
// Open modal
|
38 |
acfe.modal.open($modal, {
|
39 |
title: $layout_order + ' ' + $layout_title,
|
40 |
+
footer: close,
|
41 |
onClose: function(){
|
42 |
|
43 |
+
flexible.acfeCloseLayoutInit($layout);
|
44 |
|
45 |
}
|
46 |
});
|
47 |
|
48 |
+
};
|
49 |
|
50 |
/*
|
51 |
* Spawn
|
63 |
|
64 |
});
|
65 |
|
66 |
+
/*
|
67 |
+
* Remove Legacy Collapse
|
68 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
acf.addAction('acfe/flexible/layouts', function($layout, flexible){
|
70 |
|
71 |
if(!flexible.has('acfeFlexibleModalEdition'))
|
72 |
return;
|
73 |
|
74 |
// var
|
|
|
75 |
var $controls = $layout.find('> .acf-fc-layout-controls');
|
76 |
|
77 |
// Remove collapse button
|
78 |
$controls.find('> a.-collapse').remove();
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
});
|
81 |
|
82 |
})(jQuery);
|
assets/acf-extended-fc-modal-select.js
CHANGED
@@ -152,14 +152,19 @@
|
|
152 |
if(!$layout_added)
|
153 |
return;
|
154 |
|
155 |
-
//
|
156 |
-
|
157 |
-
|
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 |
|
152 |
if(!$layout_added)
|
153 |
return;
|
154 |
|
155 |
+
// Modal Edition: Open
|
156 |
+
if(flexible.has('acfeFlexibleModalEdition')){
|
157 |
+
|
|
|
|
|
|
|
|
|
158 |
$layout_added.find('> [data-action="acfe-flexible-modal-edit"]').trigger('click');
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
// Normal Edition: Open
|
163 |
+
else{
|
164 |
+
|
165 |
+
flexible.openLayout($layout_added);
|
166 |
+
|
167 |
+
}
|
168 |
|
169 |
});
|
170 |
|
assets/acf-extended-fc.css
CHANGED
@@ -96,6 +96,7 @@
|
|
96 |
}
|
97 |
|
98 |
.layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview > .acfe-flexible-placeholder{
|
|
|
99 |
height:auto;
|
100 |
}
|
101 |
|
@@ -109,7 +110,7 @@
|
|
109 |
|
110 |
.layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview.acfe-is-loading{
|
111 |
background:#fafafa;
|
112 |
-
height:110px;
|
113 |
}
|
114 |
|
115 |
.layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview.acfe-is-loading > .acfe-flexible-placeholder > .spinner{
|
@@ -120,6 +121,7 @@
|
|
120 |
left:50%;
|
121 |
transform:translate(-50%, -50%);
|
122 |
margin:0;
|
|
|
123 |
}
|
124 |
|
125 |
.layout > .acfe-flexible-collapsed-placeholder .acfe-flexible-collapsed-overlay{
|
@@ -134,10 +136,15 @@
|
|
134 |
transition: background-color 200ms linear;
|
135 |
}
|
136 |
|
137 |
-
.layout > .acfe-flexible-collapsed-placeholder:hover .acfe-flexible-collapsed-overlay
|
|
|
138 |
background-color:rgba(255,255,255,0.7);
|
139 |
}
|
140 |
|
|
|
|
|
|
|
|
|
141 |
/*
|
142 |
* Flexible Layout Collapsed
|
143 |
*/
|
@@ -155,7 +162,7 @@
|
|
155 |
.acfe-flexible-layout-thumbnail{
|
156 |
display:block;
|
157 |
width:100%;
|
158 |
-
height:200px
|
159 |
background-color:#eee;
|
160 |
background-size:cover;
|
161 |
background-repeat:no-repeat;
|
@@ -187,6 +194,36 @@
|
|
187 |
font-size: 110px;
|
188 |
}
|
189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
/*
|
191 |
* Flexible Thumbnails (no modal)
|
192 |
*
|
@@ -194,7 +231,7 @@
|
|
194 |
.acfe-flexible-layout-thumbnail.acfe-flexible-layout-thumbnail-no-modal{
|
195 |
display:block;
|
196 |
width: 230px;
|
197 |
-
height:
|
198 |
background-color:#1f2329;
|
199 |
}
|
200 |
|
96 |
}
|
97 |
|
98 |
.layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview > .acfe-flexible-placeholder{
|
99 |
+
min-height:55px;
|
100 |
height:auto;
|
101 |
}
|
102 |
|
110 |
|
111 |
.layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview.acfe-is-loading{
|
112 |
background:#fafafa;
|
113 |
+
min-height:110px;
|
114 |
}
|
115 |
|
116 |
.layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview.acfe-is-loading > .acfe-flexible-placeholder > .spinner{
|
121 |
left:50%;
|
122 |
transform:translate(-50%, -50%);
|
123 |
margin:0;
|
124 |
+
z-index:10000;
|
125 |
}
|
126 |
|
127 |
.layout > .acfe-flexible-collapsed-placeholder .acfe-flexible-collapsed-overlay{
|
136 |
transition: background-color 200ms linear;
|
137 |
}
|
138 |
|
139 |
+
.layout > .acfe-flexible-collapsed-placeholder:hover .acfe-flexible-collapsed-overlay,
|
140 |
+
.layout > .acfe-flexible-collapsed-placeholder .acfe-flexible-collapsed-overlay.-hover{
|
141 |
background-color:rgba(255,255,255,0.7);
|
142 |
}
|
143 |
|
144 |
+
.layout > .acfe-flexible-collapsed-placeholder.acfe-flexible-collapsed-preview.acfe-is-loading > button span{
|
145 |
+
visibility:hidden;
|
146 |
+
}
|
147 |
+
|
148 |
/*
|
149 |
* Flexible Layout Collapsed
|
150 |
*/
|
162 |
.acfe-flexible-layout-thumbnail{
|
163 |
display:block;
|
164 |
width:100%;
|
165 |
+
height: 9.8vw; /* 200px / 1080p */
|
166 |
background-color:#eee;
|
167 |
background-size:cover;
|
168 |
background-repeat:no-repeat;
|
194 |
font-size: 110px;
|
195 |
}
|
196 |
|
197 |
+
.acfe-col-2 .acfe-flexible-layout-thumbnail{
|
198 |
+
height:20.5vw;
|
199 |
+
}
|
200 |
+
|
201 |
+
.acfe-col-3 .acfe-flexible-layout-thumbnail{
|
202 |
+
height:13.3vw;
|
203 |
+
}
|
204 |
+
|
205 |
+
.acfe-col-5 .acfe-flexible-layout-thumbnail{
|
206 |
+
height:7.65vw;
|
207 |
+
}
|
208 |
+
|
209 |
+
.acfe-col-6 .acfe-flexible-layout-thumbnail{
|
210 |
+
height:6.2vw;
|
211 |
+
}
|
212 |
+
|
213 |
+
@media only screen and (max-width:960px){
|
214 |
+
.acfe-flexible-layout-thumbnail,
|
215 |
+
.acfe-flex-container .acfe-flexible-layout-thumbnail{
|
216 |
+
height: 18.4vw; /* 200px */
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
@media only screen and (max-width:720px){
|
221 |
+
.acfe-flexible-layout-thumbnail,
|
222 |
+
.acfe-flex-container .acfe-flexible-layout-thumbnail{
|
223 |
+
height: 37.2vw; /* 200px */
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
/*
|
228 |
* Flexible Thumbnails (no modal)
|
229 |
*
|
231 |
.acfe-flexible-layout-thumbnail.acfe-flexible-layout-thumbnail-no-modal{
|
232 |
display:block;
|
233 |
width: 230px;
|
234 |
+
height: 103px;
|
235 |
background-color:#1f2329;
|
236 |
}
|
237 |
|
assets/acf-extended-fc.js
CHANGED
@@ -27,7 +27,7 @@
|
|
27 |
$layout_source = $el.closest('.layout');
|
28 |
|
29 |
// Add
|
30 |
-
flexible.add({
|
31 |
layout: $layout_name,
|
32 |
before: $layout_source
|
33 |
});
|
@@ -36,7 +36,132 @@
|
|
36 |
if($('.acf-fc-popup').length)
|
37 |
$('.acf-fc-popup').hide();
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
/*
|
42 |
* Spawn
|
@@ -88,38 +213,51 @@
|
|
88 |
|
89 |
acf.addAction('acfe/flexible/layouts', function($layout, flexible){
|
90 |
|
91 |
-
//
|
92 |
-
if(
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
flexible.closeLayout($layout);
|
98 |
-
|
99 |
-
}
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
flexible.openLayout($layout);
|
105 |
-
|
106 |
-
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
-
//
|
111 |
-
|
112 |
-
if(flexible.isLayoutClosed($layout)){
|
113 |
|
114 |
-
flexible.
|
115 |
|
116 |
}
|
117 |
|
118 |
-
//
|
119 |
else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
123 |
}
|
124 |
|
125 |
});
|
@@ -135,84 +273,47 @@
|
|
135 |
if(flexible.has('acfeFlexibleModalEdition'))
|
136 |
return;
|
137 |
|
138 |
-
//
|
139 |
-
$layout.find('> .acfe-flexible-collapsed-placeholder').
|
140 |
-
$layout.find('> .acfe-flexible-opened-actions').remove();
|
141 |
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
});
|
146 |
|
147 |
acf.addAction('hide', function($layout, type){
|
148 |
|
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 |
-
|
156 |
-
|
157 |
-
|
158 |
|
159 |
-
|
160 |
-
$layout.find('> .acfe-flexible-collapsed-placeholder').remove();
|
161 |
-
$layout.find('> .acfe-flexible-opened-actions').remove();
|
162 |
|
163 |
-
//
|
164 |
-
|
165 |
-
|
166 |
-
' <button class="button" onclick="return false;">' +
|
167 |
-
' <span class="dashicons dashicons-edit"></span>' +
|
168 |
-
' </button>' +
|
169 |
-
' <div class="acfe-flexible-collapsed-overlay"></div>' +
|
170 |
-
' <div class="acfe-flexible-placeholder"></div>' +
|
171 |
-
'</div>'
|
172 |
-
).insertAfter($controls);
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
var ajaxData = {
|
184 |
-
action: 'acfe/flexible/layout_preview',
|
185 |
-
field_key: flexible.get('key'),
|
186 |
-
i: $layout.index(),
|
187 |
-
layout: $layout.data('layout'),
|
188 |
-
value: acf.serialize($layout, prefix)
|
189 |
-
};
|
190 |
-
|
191 |
-
// ajax
|
192 |
-
$.ajax({
|
193 |
-
url: acf.get('ajaxurl'),
|
194 |
-
data: acf.prepareForAjax(ajaxData),
|
195 |
-
dataType: 'html',
|
196 |
-
type: 'post',
|
197 |
-
success: function(response){
|
198 |
-
if(response){
|
199 |
-
|
200 |
-
$placeholder.find('> .acfe-flexible-placeholder').html(response);
|
201 |
-
|
202 |
-
}else{
|
203 |
-
|
204 |
-
$placeholder.removeClass('acfe-flexible-collapsed-preview');
|
205 |
-
|
206 |
-
}
|
207 |
-
},
|
208 |
-
complete: function(){
|
209 |
-
|
210 |
-
$placeholder.removeClass('acfe-is-loading').find('> .acfe-flexible-placeholder > .spinner').remove();
|
211 |
-
|
212 |
-
}
|
213 |
-
});
|
214 |
-
|
215 |
-
}
|
216 |
|
217 |
});
|
218 |
|
27 |
$layout_source = $el.closest('.layout');
|
28 |
|
29 |
// Add
|
30 |
+
var $layout_added = flexible.add({
|
31 |
layout: $layout_name,
|
32 |
before: $layout_source
|
33 |
});
|
36 |
if($('.acf-fc-popup').length)
|
37 |
$('.acf-fc-popup').hide();
|
38 |
|
39 |
+
if(!$layout_added)
|
40 |
+
return;
|
41 |
+
|
42 |
+
// Open layout modal edition
|
43 |
+
if(flexible.has('acfeFlexibleModalEdition'))
|
44 |
+
$layout_added.find('> [data-action="acfe-flexible-modal-edit"]').trigger('click');
|
45 |
+
|
46 |
+
};
|
47 |
+
|
48 |
+
model.acfeCloseLayoutInit = function($layout){
|
49 |
+
|
50 |
+
$layout.addClass('-collapsed');
|
51 |
+
acf.doAction('hide', $layout, 'collapse');
|
52 |
+
|
53 |
+
};
|
54 |
+
|
55 |
+
model.acfeLayoutInit = function($layout){
|
56 |
+
|
57 |
+
// Get Flexible
|
58 |
+
var flexible = this;
|
59 |
+
|
60 |
+
// Vars
|
61 |
+
var $controls = $layout.find('> .acf-fc-layout-controls');
|
62 |
+
|
63 |
+
// Remove duplicate
|
64 |
+
$layout.find('> .acfe-flexible-opened-actions').remove();
|
65 |
+
|
66 |
+
// Placeholder
|
67 |
+
var $placeholder = $layout.find('> .acfe-flexible-collapsed-placeholder');
|
68 |
+
|
69 |
+
// Placeholder: Not found - Create new element
|
70 |
+
if(!$placeholder.length){
|
71 |
+
|
72 |
+
var placeholder_icon = 'dashicons dashicons-edit';
|
73 |
+
|
74 |
+
if(flexible.has('acfeFlexiblePlaceholderIcon'))
|
75 |
+
placeholder_icon = flexible.get('acfeFlexiblePlaceholderIcon');
|
76 |
+
|
77 |
+
// Placeholder
|
78 |
+
var $placeholder = $('' +
|
79 |
+
'<div class="acfe-flexible-collapsed-placeholder" title="Edit layout">' +
|
80 |
+
' <button class="button" onclick="return false;">' +
|
81 |
+
' <span class="' + placeholder_icon + '"></span>' +
|
82 |
+
' </button>' +
|
83 |
+
' <div class="acfe-flexible-collapsed-overlay"></div>' +
|
84 |
+
' <div class="acfe-flexible-placeholder"></div>' +
|
85 |
+
'</div>'
|
86 |
+
).insertAfter($controls);
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
// Placeholder: Show
|
91 |
+
$placeholder.show();
|
92 |
+
|
93 |
+
// Modal Edition Wrap
|
94 |
+
if(flexible.has('acfeFlexibleModalEdition')){
|
95 |
+
|
96 |
+
if(!$layout.find('> .acfe-modal').length){
|
97 |
+
|
98 |
+
// Wrap content
|
99 |
+
$layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acfe-modal"><div class="acfe-modal-wrapper"><div class="acfe-modal-content"></div></div></div>');
|
100 |
+
|
101 |
+
// Placeholder
|
102 |
+
$placeholder.attr('data-action', 'acfe-flexible-modal-edit');
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
else{
|
109 |
+
|
110 |
+
if(!flexible.isLayoutClosed($layout)){
|
111 |
+
|
112 |
+
$placeholder.hide();
|
113 |
+
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
// Flexible has Preview
|
119 |
+
if(flexible.has('acfeFlexiblePreview')){
|
120 |
+
|
121 |
+
$placeholder.addClass('acfe-flexible-collapsed-preview acfe-is-loading').find('> .acfe-flexible-placeholder').prepend('<span class="spinner"></span>');
|
122 |
+
$placeholder.find('> .acfe-flexible-collapsed-overlay').addClass('-hover');
|
123 |
+
|
124 |
+
// vars
|
125 |
+
var $input = $layout.children('input');
|
126 |
+
var prefix = $input.attr('name').replace('[acf_fc_layout]', '');
|
127 |
+
|
128 |
+
// ajax data
|
129 |
+
var ajaxData = {
|
130 |
+
action: 'acfe/flexible/layout_preview',
|
131 |
+
field_key: flexible.get('key'),
|
132 |
+
i: $layout.index(),
|
133 |
+
layout: $layout.data('layout'),
|
134 |
+
value: acf.serialize($layout, prefix)
|
135 |
+
};
|
136 |
+
|
137 |
+
// ajax
|
138 |
+
$.ajax({
|
139 |
+
url: acf.get('ajaxurl'),
|
140 |
+
data: acf.prepareForAjax(ajaxData),
|
141 |
+
dataType: 'html',
|
142 |
+
type: 'post',
|
143 |
+
success: function(response){
|
144 |
+
if(response){
|
145 |
+
|
146 |
+
$placeholder.find('> .acfe-flexible-placeholder').html(response);
|
147 |
+
|
148 |
+
}else{
|
149 |
+
|
150 |
+
$placeholder.removeClass('acfe-flexible-collapsed-preview');
|
151 |
+
|
152 |
+
}
|
153 |
+
},
|
154 |
+
complete: function(){
|
155 |
+
|
156 |
+
$placeholder.find('> .acfe-flexible-collapsed-overlay').removeClass('-hover');
|
157 |
+
$placeholder.removeClass('acfe-is-loading').find('> .acfe-flexible-placeholder > .spinner').remove();
|
158 |
+
|
159 |
+
}
|
160 |
+
});
|
161 |
+
|
162 |
+
}
|
163 |
+
|
164 |
+
};
|
165 |
|
166 |
/*
|
167 |
* Spawn
|
213 |
|
214 |
acf.addAction('acfe/flexible/layouts', function($layout, flexible){
|
215 |
|
216 |
+
// Flexible has Modal Edition
|
217 |
+
if(flexible.has('acfeFlexibleModalEdition')){
|
218 |
|
219 |
+
$layout.addClass('-collapsed');
|
220 |
+
flexible.acfeLayoutInit($layout);
|
|
|
|
|
|
|
|
|
221 |
|
222 |
+
return;
|
223 |
+
|
224 |
+
}
|
|
|
|
|
|
|
225 |
|
226 |
+
// Bail early if layout is clone
|
227 |
+
if($layout.is('.acf-clone'))
|
228 |
+
return;
|
229 |
+
|
230 |
+
// Layout State: Collapse
|
231 |
+
if(flexible.has('acfeFlexibleCollapse')){
|
232 |
+
|
233 |
+
flexible.acfeCloseLayoutInit($layout);
|
234 |
+
|
235 |
}
|
236 |
|
237 |
+
// Layout State: Open
|
238 |
+
else if(flexible.has('acfeFlexibleOpen')){
|
|
|
239 |
|
240 |
+
flexible.openLayout($layout);
|
241 |
|
242 |
}
|
243 |
|
244 |
+
// Others
|
245 |
else{
|
246 |
+
|
247 |
+
// Action: Close for closed layouts
|
248 |
+
if(flexible.isLayoutClosed($layout)){
|
249 |
+
|
250 |
+
flexible.acfeCloseLayoutInit($layout);
|
251 |
+
|
252 |
+
}
|
253 |
|
254 |
+
// Action: Show for opened layouts
|
255 |
+
else{
|
256 |
+
|
257 |
+
flexible.openLayout($layout);
|
258 |
+
|
259 |
+
}
|
260 |
+
|
261 |
}
|
262 |
|
263 |
});
|
273 |
if(flexible.has('acfeFlexibleModalEdition'))
|
274 |
return;
|
275 |
|
276 |
+
// Placeholder
|
277 |
+
$layout.find('> .acfe-flexible-collapsed-placeholder').hide();
|
|
|
278 |
|
279 |
+
// Close Button
|
280 |
+
if(flexible.has('acfeFlexibleCloseButton')){
|
281 |
+
|
282 |
+
$layout.find('> .acfe-flexible-opened-actions').remove();
|
283 |
+
|
284 |
+
$('<div class="acfe-flexible-opened-actions"><a href="javascript:void(0);" class="button">' + acf.get('close') + '</button></a>').appendTo($layout);
|
285 |
+
|
286 |
+
}
|
287 |
|
288 |
});
|
289 |
|
290 |
acf.addAction('hide', function($layout, type){
|
291 |
|
292 |
+
if(type != 'collapse' || !$layout.is('.layout') || $layout.is('.acf-clone'))
|
293 |
return;
|
294 |
|
295 |
// Get Flexible
|
296 |
var flexible = acf.getInstance($layout.closest('.acf-field-flexible-content'));
|
297 |
|
298 |
+
flexible.acfeLayoutInit($layout);
|
299 |
+
|
300 |
+
});
|
301 |
|
302 |
+
acf.addAction('append', function($el){
|
|
|
|
|
303 |
|
304 |
+
// Bail early if layout is not clone
|
305 |
+
if(!$el.is('.layout'))
|
306 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
|
308 |
+
// Get Flexible
|
309 |
+
var flexible = acf.getInstance($el.closest('.acf-field-flexible-content'));
|
310 |
+
|
311 |
+
flexible.acfeLayoutInit($el);
|
312 |
+
|
313 |
+
// Scroll to new layout
|
314 |
+
$('html, body').animate({
|
315 |
+
scrollTop: parseInt($el.offset().top) - 200
|
316 |
+
}, 200);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
318 |
});
|
319 |
|
assets/acf-extended.js
CHANGED
@@ -72,6 +72,16 @@
|
|
72 |
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
acfe.modal.multiple();
|
76 |
|
77 |
return $target;
|
@@ -81,6 +91,11 @@
|
|
81 |
// Close
|
82 |
close: function(args){
|
83 |
|
|
|
|
|
|
|
|
|
|
|
84 |
var $target = acfe.modal.modals.pop();
|
85 |
|
86 |
$target.find('.acfe-modal-title').remove();
|
@@ -138,4 +153,16 @@
|
|
138 |
|
139 |
};
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
})(jQuery);
|
72 |
|
73 |
}
|
74 |
|
75 |
+
$(window).keydown(function(e){
|
76 |
+
|
77 |
+
if((e.keyCode != 27 && e.keyCode != 13) || !$('body').hasClass('acfe-modal-opened'))
|
78 |
+
return;
|
79 |
+
|
80 |
+
acfe.modal.close(args);
|
81 |
+
return false;
|
82 |
+
|
83 |
+
});
|
84 |
+
|
85 |
acfe.modal.multiple();
|
86 |
|
87 |
return $target;
|
91 |
// Close
|
92 |
close: function(args){
|
93 |
|
94 |
+
args = acf.parseArgs(args, {
|
95 |
+
destroy: false,
|
96 |
+
onClose: false,
|
97 |
+
});
|
98 |
+
|
99 |
var $target = acfe.modal.modals.pop();
|
100 |
|
101 |
$target.find('.acfe-modal-title').remove();
|
153 |
|
154 |
};
|
155 |
|
156 |
+
/*
|
157 |
+
$(window).keydown(function(e){
|
158 |
+
|
159 |
+
if((e.keyCode != 27 && e.keyCode != 13) || !$('body').hasClass('acfe-modal-opened'))
|
160 |
+
return;
|
161 |
+
|
162 |
+
acfe.modal.close();
|
163 |
+
return false;
|
164 |
+
|
165 |
+
});
|
166 |
+
*/
|
167 |
+
|
168 |
})(jQuery);
|
includes/admin/tools/dop-import.php
CHANGED
@@ -70,6 +70,8 @@ class ACFE_Admin_Tool_Import_DOP extends ACF_Admin_Tool{
|
|
70 |
$ids = array();
|
71 |
|
72 |
$dynamic_options_pages = get_option('acfe_dynamic_options_pages', array());
|
|
|
|
|
73 |
|
74 |
// Loop over json
|
75 |
foreach($json as $options_page_name => $args){
|
@@ -126,13 +128,51 @@ class ACFE_Admin_Tool_Import_DOP extends ACF_Admin_Tool{
|
|
126 |
// Update ACFE option
|
127 |
update_option('acfe_dynamic_options_pages', $dynamic_options_pages);
|
128 |
|
129 |
-
//
|
130 |
$ids[] = $post_id;
|
131 |
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
|
|
|
134 |
if(empty($ids))
|
135 |
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
// Count total
|
138 |
$total = count($ids);
|
70 |
$ids = array();
|
71 |
|
72 |
$dynamic_options_pages = get_option('acfe_dynamic_options_pages', array());
|
73 |
+
|
74 |
+
$dynamic_options_sub_pages = array();
|
75 |
|
76 |
// Loop over json
|
77 |
foreach($json as $options_page_name => $args){
|
128 |
// Update ACFE option
|
129 |
update_option('acfe_dynamic_options_pages', $dynamic_options_pages);
|
130 |
|
131 |
+
// Append message
|
132 |
$ids[] = $post_id;
|
133 |
|
134 |
+
// Add Sub Page
|
135 |
+
if(isset($args['parent_slug']) && !empty($args['parent_slug']))
|
136 |
+
$dynamic_options_sub_pages[$post_id] = $args;
|
137 |
+
|
138 |
}
|
139 |
|
140 |
+
// Check if pages have been added
|
141 |
if(empty($ids))
|
142 |
return;
|
143 |
+
|
144 |
+
// Update Options Sub Pages
|
145 |
+
if(!empty($dynamic_options_sub_pages)){
|
146 |
+
|
147 |
+
foreach($dynamic_options_sub_pages as $post_id => $args){
|
148 |
+
|
149 |
+
// Get possible parent options pages
|
150 |
+
$get_dop_parent = get_posts(array(
|
151 |
+
'post_type' => 'acfe-dop',
|
152 |
+
'posts_per_page' => 1,
|
153 |
+
'fields' => 'ids',
|
154 |
+
'meta_query' => array(
|
155 |
+
array(
|
156 |
+
'key' => 'menu_slug',
|
157 |
+
'value' => $args['parent_slug']
|
158 |
+
)
|
159 |
+
)
|
160 |
+
));
|
161 |
+
|
162 |
+
if(empty($get_dop_parent))
|
163 |
+
continue;
|
164 |
+
|
165 |
+
$parent = $get_dop_parent[0];
|
166 |
+
|
167 |
+
// Update sub page post
|
168 |
+
wp_update_post(array(
|
169 |
+
'ID' => $post_id,
|
170 |
+
'post_parent' => $parent,
|
171 |
+
));
|
172 |
+
|
173 |
+
}
|
174 |
+
|
175 |
+
}
|
176 |
|
177 |
// Count total
|
178 |
$total = count($ids);
|
includes/admin/tools/dt-import.php
CHANGED
@@ -134,7 +134,8 @@ class ACFE_Admin_Tool_Import_DT extends ACF_Admin_Tool{
|
|
134 |
update_field('show_admin_column', $args['show_admin_column'], $post_id);
|
135 |
|
136 |
// Capability
|
137 |
-
|
|
|
138 |
|
139 |
// Single
|
140 |
update_field('acfe_dt_single_template', $args['acfe_single_template'], $post_id);
|
134 |
update_field('show_admin_column', $args['show_admin_column'], $post_id);
|
135 |
|
136 |
// Capability
|
137 |
+
if(isset($args['capabilities']))
|
138 |
+
update_field('capabilities', acf_encode_choices($args['capabilities'], false), $post_id);
|
139 |
|
140 |
// Single
|
141 |
update_field('acfe_dt_single_template', $args['acfe_single_template'], $post_id);
|
includes/core/enqueue.php
CHANGED
@@ -58,4 +58,8 @@ function acfe_enqueue_fields(){
|
|
58 |
wp_enqueue_style('acf-extended-fc-modal-edit', plugins_url('assets/acf-extended-fc-modal-edit.css', ACFE_FILE), false, null);
|
59 |
wp_enqueue_script('acf-extended-fc-modal-edit', plugins_url('assets/acf-extended-fc-modal-edit.js', ACFE_FILE), array('jquery'), null);
|
60 |
|
|
|
|
|
|
|
|
|
61 |
}
|
58 |
wp_enqueue_style('acf-extended-fc-modal-edit', plugins_url('assets/acf-extended-fc-modal-edit.css', ACFE_FILE), false, null);
|
59 |
wp_enqueue_script('acf-extended-fc-modal-edit', plugins_url('assets/acf-extended-fc-modal-edit.js', ACFE_FILE), array('jquery'), null);
|
60 |
|
61 |
+
acf_localize_data(array(
|
62 |
+
'close' => __('Close', 'acfe')
|
63 |
+
));
|
64 |
+
|
65 |
}
|
includes/core/helpers.php
CHANGED
@@ -13,19 +13,32 @@ function get_flexible($selector, $post_id = false){
|
|
13 |
if(!have_rows($selector, $post_id))
|
14 |
return;
|
15 |
|
16 |
-
//
|
17 |
$field = acf_get_field($selector);
|
18 |
$flexible = acf_get_field_type('flexible_content');
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
ob_start();
|
21 |
|
22 |
while(have_rows($selector, $post_id)): the_row();
|
23 |
|
24 |
-
//
|
25 |
$layout_name = get_row_layout();
|
26 |
$layout = $flexible->get_layout($layout_name, $field);
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
endwhile;
|
31 |
|
@@ -62,74 +75,28 @@ function has_flexible($selector, $post_id = false){
|
|
62 |
}
|
63 |
|
64 |
/**
|
65 |
-
* ACFE Flexible: Render
|
66 |
*/
|
67 |
-
function
|
68 |
|
69 |
-
//
|
70 |
-
$is_preview
|
71 |
-
if(wp_doing_ajax())
|
72 |
-
$is_preview = true;
|
73 |
|
74 |
-
//
|
75 |
-
$
|
76 |
-
|
77 |
-
// render
|
78 |
-
$render = array(
|
79 |
-
'style' => false,
|
80 |
-
'script' => false,
|
81 |
-
'template' => false,
|
82 |
-
);
|
83 |
-
|
84 |
-
if(!$is_preview){
|
85 |
-
|
86 |
-
// Add HTML Comment
|
87 |
-
echo "\n" . '<!-- ' . $layout['label'] . ' -->' . "\n";
|
88 |
-
|
89 |
-
}
|
90 |
|
91 |
-
//
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
if(!$is_preview){
|
97 |
-
|
98 |
-
wp_enqueue_style($handle, ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_style'], array(), false, 'all');
|
99 |
-
|
100 |
-
}else{
|
101 |
-
|
102 |
-
$render['style'] = '<link rel="stylesheet" href="' . ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_style'] . '" type="text/css" media="all">';
|
103 |
-
|
104 |
-
}
|
105 |
-
|
106 |
-
}
|
107 |
-
|
108 |
-
}
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
if(file_exists(ACFE_THEME_PATH . '/' . $layout['acfe_flexible_render_script'])){
|
114 |
-
|
115 |
-
if(!$is_preview){
|
116 |
-
|
117 |
-
wp_enqueue_script($handle, ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_script'], array(), false, true);
|
118 |
-
|
119 |
-
}else{
|
120 |
-
|
121 |
-
$render['script'] = '<script type="text/javascript" src="' . ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_script'] . '"></script>';
|
122 |
-
|
123 |
-
}
|
124 |
-
|
125 |
-
}
|
126 |
-
|
127 |
-
}
|
128 |
|
129 |
// Render: Template
|
130 |
-
if(
|
131 |
|
132 |
-
$acfe_flexible_render_template = ACFE_THEME_PATH . '/' . $layout['acfe_flexible_render_template'];
|
133 |
$path = false;
|
134 |
|
135 |
// File exists
|
@@ -147,22 +114,65 @@ function acfe_flexible_render_layout($layout, $field){
|
|
147 |
// Include
|
148 |
if(file_exists($path)){
|
149 |
|
150 |
-
|
151 |
-
|
152 |
-
include($path);
|
153 |
-
|
154 |
-
}else{
|
155 |
-
|
156 |
-
$render['template'] = $path;
|
157 |
-
|
158 |
-
}
|
159 |
|
160 |
}
|
161 |
|
162 |
}
|
163 |
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
}
|
168 |
|
13 |
if(!have_rows($selector, $post_id))
|
14 |
return;
|
15 |
|
16 |
+
// Vars
|
17 |
$field = acf_get_field($selector);
|
18 |
$flexible = acf_get_field_type('flexible_content');
|
19 |
+
$is_preview = false;
|
20 |
+
|
21 |
+
// Actions
|
22 |
+
do_action('acfe/flexible/enqueue', $field, $is_preview);
|
23 |
+
do_action('acfe/flexible/enqueue/name=' . $field['_name'], $field, $is_preview);
|
24 |
+
do_action('acfe/flexible/enqueue/key=' . $field['key'], $field, $is_preview);
|
25 |
|
26 |
ob_start();
|
27 |
|
28 |
while(have_rows($selector, $post_id)): the_row();
|
29 |
|
30 |
+
// Vars
|
31 |
$layout_name = get_row_layout();
|
32 |
$layout = $flexible->get_layout($layout_name, $field);
|
33 |
|
34 |
+
// Render: HTML Comment
|
35 |
+
echo "\n" . '<!-- ' . $layout['label'] . ' -->' . "\n";
|
36 |
+
|
37 |
+
// Render: Enqueue
|
38 |
+
acfe_flexible_render_layout_enqueue($layout, $field);
|
39 |
+
|
40 |
+
// Render: Template
|
41 |
+
acfe_flexible_render_layout_template($layout, $field);
|
42 |
|
43 |
endwhile;
|
44 |
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
+
* ACFE Flexible: Render Template
|
79 |
*/
|
80 |
+
function acfe_flexible_render_layout_template($layout, $field){
|
81 |
|
82 |
+
// Vars
|
83 |
+
global $is_preview;
|
|
|
|
|
84 |
|
85 |
+
// Template
|
86 |
+
$acfe_flexible_render_template = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
+
// Filters
|
89 |
+
$acfe_flexible_render_template = apply_filters('acfe/flexible/render/template', $acfe_flexible_render_template, $field, $layout, $is_preview);
|
90 |
+
$acfe_flexible_render_template = apply_filters('acfe/flexible/render/template/name=' . $field['_name'], $acfe_flexible_render_template, $field, $layout, $is_preview);
|
91 |
+
$acfe_flexible_render_template = apply_filters('acfe/flexible/render/template/key=' . $field['key'], $acfe_flexible_render_template, $field, $layout, $is_preview);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
+
$acfe_flexible_render_template = apply_filters('acfe/flexible/layout/render/template/layout=' . $layout['name'], $acfe_flexible_render_template, $field, $layout, $is_preview);
|
94 |
+
$acfe_flexible_render_template = apply_filters('acfe/flexible/layout/render/template/name=' . $field['_name'] . '&layout=' . $layout['name'], $acfe_flexible_render_template, $field, $layout, $is_preview);
|
95 |
+
$acfe_flexible_render_template = apply_filters('acfe/flexible/layout/render/template/key=' . $field['key'] . '&layout=' . $layout['name'], $acfe_flexible_render_template, $field, $layout, $is_preview);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
// Render: Template
|
98 |
+
if(!empty($acfe_flexible_render_template)){
|
99 |
|
|
|
100 |
$path = false;
|
101 |
|
102 |
// File exists
|
114 |
// Include
|
115 |
if(file_exists($path)){
|
116 |
|
117 |
+
include($path);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
}
|
120 |
|
121 |
}
|
122 |
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* ACFE Flexible: Render Enqueue
|
127 |
+
*/
|
128 |
+
function acfe_flexible_render_layout_enqueue($layout, $field){
|
129 |
+
|
130 |
+
// Vars
|
131 |
+
global $is_preview;
|
132 |
+
$handle = acf_slugify($field['name']) . '-layout-' . acf_slugify($layout['name']);
|
133 |
+
|
134 |
+
// Actions
|
135 |
+
do_action('acfe/flexible/layout/enqueue/layout=' . $layout['name'], $field, $layout, $is_preview);
|
136 |
+
do_action('acfe/flexible/layout/enqueue/name=' . $field['_name'] . '&layout=' . $layout['name'], $field, $layout, $is_preview);
|
137 |
+
do_action('acfe/flexible/layout/enqueue/key=' . $field['key'] . '&layout=' . $layout['name'], $field, $layout, $is_preview);
|
138 |
+
|
139 |
+
// Style
|
140 |
+
$acfe_flexible_render_style = false;
|
141 |
+
|
142 |
+
// Filters
|
143 |
+
$acfe_flexible_render_style = apply_filters('acfe/flexible/render/style', $acfe_flexible_render_style, $field, $layout, $is_preview);
|
144 |
+
$acfe_flexible_render_style = apply_filters('acfe/flexible/render/style/name=' . $field['_name'], $acfe_flexible_render_style, $field, $layout, $is_preview);
|
145 |
+
$acfe_flexible_render_style = apply_filters('acfe/flexible/render/style/key=' . $field['key'], $acfe_flexible_render_style, $field, $layout, $is_preview);
|
146 |
+
|
147 |
+
$acfe_flexible_render_style = apply_filters('acfe/flexible/layout/render/style/layout=' . $layout['name'], $acfe_flexible_render_style, $field, $layout, $is_preview);
|
148 |
+
$acfe_flexible_render_style = apply_filters('acfe/flexible/layout/render/style/name=' . $field['_name'] . '&layout=' . $layout['name'], $acfe_flexible_render_style, $field, $layout, $is_preview);
|
149 |
+
$acfe_flexible_render_style = apply_filters('acfe/flexible/layout/render/style/key=' . $field['key'] . '&layout=' . $layout['name'], $acfe_flexible_render_style, $field, $layout, $is_preview);
|
150 |
+
|
151 |
+
// Enqueue
|
152 |
+
if(!empty($acfe_flexible_render_style)){
|
153 |
+
|
154 |
+
wp_enqueue_style($handle, $acfe_flexible_render_style, array(), false, 'all');
|
155 |
+
|
156 |
+
}
|
157 |
+
|
158 |
+
// Script
|
159 |
+
$acfe_flexible_render_script = false;
|
160 |
+
|
161 |
+
// Filters
|
162 |
+
$acfe_flexible_render_script = apply_filters('acfe/flexible/render/script', $acfe_flexible_render_script, $field, $layout, $is_preview);
|
163 |
+
$acfe_flexible_render_script = apply_filters('acfe/flexible/render/script/name=' . $field['_name'], $acfe_flexible_render_script, $field, $layout, $is_preview);
|
164 |
+
$acfe_flexible_render_script = apply_filters('acfe/flexible/render/script/key=' . $field['key'], $acfe_flexible_render_script, $field, $layout, $is_preview);
|
165 |
+
|
166 |
+
$acfe_flexible_render_script = apply_filters('acfe/flexible/layout/render/script/layout=' . $layout['name'], $acfe_flexible_render_script, $field, $layout, $is_preview);
|
167 |
+
$acfe_flexible_render_script = apply_filters('acfe/flexible/layout/render/script/name=' . $field['_name'] . '&layout=' . $layout['name'], $acfe_flexible_render_script, $field, $layout, $is_preview);
|
168 |
+
$acfe_flexible_render_script = apply_filters('acfe/flexible/layout/render/script/key=' . $field['key'] . '&layout=' . $layout['name'], $acfe_flexible_render_script, $field, $layout, $is_preview);
|
169 |
+
|
170 |
+
// Enqueue
|
171 |
+
if(!empty($acfe_flexible_render_script)){
|
172 |
+
|
173 |
+
wp_enqueue_script($handle, $acfe_flexible_render_script, array(), false, true);
|
174 |
+
|
175 |
+
}
|
176 |
|
177 |
}
|
178 |
|
includes/fields-settings/data.php
CHANGED
@@ -9,7 +9,7 @@ if(!defined('ABSPATH'))
|
|
9 |
add_action('acf/render_field_settings', 'acfe_settings_field_data', 992);
|
10 |
function acfe_settings_field_data($field){
|
11 |
|
12 |
-
if($field['ID'] == 'acfcloneindex')
|
13 |
return;
|
14 |
|
15 |
$acfe_field_data_id = false;
|
9 |
add_action('acf/render_field_settings', 'acfe_settings_field_data', 992);
|
10 |
function acfe_settings_field_data($field){
|
11 |
|
12 |
+
if(!isset($field['ID']) || $field['ID'] == 'acfcloneindex')
|
13 |
return;
|
14 |
|
15 |
$acfe_field_data_id = false;
|
includes/fields-settings/flexible-content.php
CHANGED
@@ -11,7 +11,7 @@ function acfe_flexible_settings($field){
|
|
11 |
|
12 |
// Stylised button
|
13 |
acf_render_field_setting($field, array(
|
14 |
-
'label' => __('Stylised
|
15 |
'name' => 'acfe_flexible_stylised_button',
|
16 |
'key' => 'acfe_flexible_stylised_button',
|
17 |
'instructions' => __('Better layouts button integration'),
|
@@ -72,7 +72,7 @@ function acfe_flexible_settings($field){
|
|
72 |
|
73 |
// Layouts thumbnails
|
74 |
acf_render_field_setting($field, array(
|
75 |
-
'label' => __('Layouts Thumbnails'),
|
76 |
'name' => 'acfe_flexible_layouts_thumbnails',
|
77 |
'key' => 'acfe_flexible_layouts_thumbnails',
|
78 |
'instructions' => __('Set a thumbnail for each layouts. You must save the field group to apply this setting'),
|
@@ -84,9 +84,9 @@ function acfe_flexible_settings($field){
|
|
84 |
'ui_off_text' => '',
|
85 |
), true);
|
86 |
|
87 |
-
// Layouts
|
88 |
acf_render_field_setting($field, array(
|
89 |
-
'label' => __('Layouts Render'),
|
90 |
'name' => 'acfe_flexible_layouts_templates',
|
91 |
'key' => 'acfe_flexible_layouts_templates',
|
92 |
'instructions' => __('Set template, style & javascript files for each layouts.. You must save the field group to apply this setting'),
|
@@ -98,9 +98,9 @@ function acfe_flexible_settings($field){
|
|
98 |
'ui_off_text' => '',
|
99 |
), true);
|
100 |
|
101 |
-
// Layouts
|
102 |
acf_render_field_setting($field, array(
|
103 |
-
'label' => __('Layouts Dynamic Preview'),
|
104 |
'name' => 'acfe_flexible_layouts_previews',
|
105 |
'key' => 'acfe_flexible_layouts_previews',
|
106 |
'instructions' => __('Use layouts render settings to display a dynamic preview in the post administration'),
|
@@ -121,9 +121,37 @@ function acfe_flexible_settings($field){
|
|
121 |
)
|
122 |
), true);
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
// Modal: Edition
|
125 |
acf_render_field_setting($field, array(
|
126 |
-
'label' => __('Modal: Edition'),
|
127 |
'name' => 'acfe_flexible_modal_edition',
|
128 |
'key' => 'acfe_flexible_modal_edition',
|
129 |
'instructions' => __('Edit layout content in a modal'),
|
@@ -137,7 +165,7 @@ function acfe_flexible_settings($field){
|
|
137 |
|
138 |
// Modal: Selection
|
139 |
acf_render_field_setting($field, array(
|
140 |
-
'label' => __('Modal: Selection'),
|
141 |
'name' => 'acfe_flexible_modal',
|
142 |
'key' => 'acfe_flexible_modal',
|
143 |
'instructions' => __('Select layouts in a modal'),
|
@@ -245,9 +273,9 @@ function acfe_flexible_settings($field){
|
|
245 |
)
|
246 |
), true);
|
247 |
|
248 |
-
// Layouts State
|
249 |
acf_render_field_setting($field, array(
|
250 |
-
'label' => __('Layouts State'),
|
251 |
'name' => 'acfe_flexible_layouts_state',
|
252 |
'key' => 'acfe_flexible_layouts_state',
|
253 |
'instructions' => __('Force layouts to be collapsed or opened'),
|
@@ -273,7 +301,7 @@ function acfe_flexible_settings($field){
|
|
273 |
add_action('acf/render_field', 'acfe_flexible_layouts_settings_before', 0);
|
274 |
function acfe_flexible_layouts_settings_before($field){
|
275 |
|
276 |
-
if($field['_name'] != 'label' || stripos($field['name'], '
|
277 |
return;
|
278 |
|
279 |
echo '</li>';
|
@@ -291,7 +319,7 @@ function acfe_flexible_layouts_settings_before($field){
|
|
291 |
add_action('acf/render_field', 'acfe_flexible_layouts_settings', 10);
|
292 |
function acfe_flexible_layouts_settings($field){
|
293 |
|
294 |
-
if($field['_name'] != 'max' || stripos($field['name'], '
|
295 |
return;
|
296 |
|
297 |
$layout_prefix = $field['prefix'];
|
@@ -501,7 +529,21 @@ function acfe_flexible_wrapper($wrapper, $field){
|
|
501 |
|
502 |
}
|
503 |
|
504 |
-
// Layouts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
if(isset($field['acfe_flexible_layouts_state']) && !empty($field['acfe_flexible_layouts_state'])){
|
506 |
|
507 |
// Collapse
|
@@ -529,6 +571,15 @@ function acfe_flexible_wrapper($wrapper, $field){
|
|
529 |
|
530 |
}
|
531 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
return $wrapper;
|
533 |
|
534 |
}
|
@@ -543,14 +594,15 @@ function acfe_flexible_empty_message($message, $field){
|
|
543 |
|
544 |
}
|
545 |
|
546 |
-
add_filter('acf/prepare_field/type=flexible_content', '
|
547 |
-
function
|
548 |
|
549 |
if(empty($field['layouts']))
|
550 |
return $field;
|
551 |
|
552 |
foreach($field['layouts'] as $k => &$layout){
|
553 |
|
|
|
554 |
$thumbnail = false;
|
555 |
if(isset($field['acfe_flexible_layouts_thumbnails']) && !empty($field['acfe_flexible_layouts_thumbnails'])){
|
556 |
|
@@ -563,13 +615,35 @@ function acfe_flexible_layout_title($field){
|
|
563 |
|
564 |
// Thumbnail is set
|
565 |
$thumbnail_found = false;
|
566 |
-
if(isset($layout['acfe_flexible_thumbnail']) && !empty($layout['acfe_flexible_thumbnail'])){
|
567 |
|
568 |
-
|
569 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
570 |
|
571 |
$thumbnail_found = true;
|
572 |
-
$style[] = 'background-image:url(' . $
|
573 |
|
574 |
}
|
575 |
|
@@ -586,6 +660,7 @@ function acfe_flexible_layout_title($field){
|
|
586 |
|
587 |
}
|
588 |
|
|
|
589 |
$category = '';
|
590 |
if(isset($layout['acfe_flexible_category']) && !empty($layout['acfe_flexible_category'])){
|
591 |
|
@@ -593,7 +668,7 @@ function acfe_flexible_layout_title($field){
|
|
593 |
|
594 |
}
|
595 |
|
596 |
-
$layout['label'] = $thumbnail . '<span '.$category.'
|
597 |
|
598 |
}
|
599 |
|
@@ -601,13 +676,43 @@ function acfe_flexible_layout_title($field){
|
|
601 |
|
602 |
}
|
603 |
|
604 |
-
add_filter('acf/fields/flexible_content/layout_title', '
|
605 |
-
function
|
606 |
|
607 |
// Remove thumbnail
|
608 |
$title = preg_replace('#<div class="acfe-flexible-layout-thumbnail(.*?)</div>#', '', $title);
|
609 |
|
610 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
|
612 |
}
|
613 |
|
@@ -637,6 +742,11 @@ function acfe_flexible_layout_preview(){
|
|
637 |
if(!$layout)
|
638 |
die;
|
639 |
|
|
|
|
|
|
|
|
|
|
|
640 |
$get_field_object = get_field_object($options['field_key'], $options['post_id'], false, false);
|
641 |
|
642 |
$preview_key = 'preview_' . $options['field_key'];
|
@@ -647,35 +757,107 @@ function acfe_flexible_layout_preview(){
|
|
647 |
add_filter('acf/load_value/key=' . $preview_key, function($value, $post_id, $field) use($options){
|
648 |
|
649 |
$value = array();
|
650 |
-
$value[0] = $options['value'];
|
651 |
|
652 |
return $value;
|
653 |
|
654 |
}, 10, 3);
|
655 |
|
656 |
-
$is_preview = true;
|
657 |
-
|
658 |
if(have_rows($preview_key)):
|
659 |
while(have_rows($preview_key)): the_row();
|
660 |
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
// Style
|
666 |
-
if(!empty($render['style']))
|
667 |
-
echo $render['style'];
|
668 |
|
669 |
-
//
|
670 |
-
|
671 |
-
|
|
|
672 |
|
673 |
-
//
|
674 |
-
|
675 |
|
676 |
endwhile;
|
677 |
endif;
|
678 |
|
679 |
die;
|
680 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
681 |
}
|
11 |
|
12 |
// Stylised button
|
13 |
acf_render_field_setting($field, array(
|
14 |
+
'label' => __('Stylised Button'),
|
15 |
'name' => 'acfe_flexible_stylised_button',
|
16 |
'key' => 'acfe_flexible_stylised_button',
|
17 |
'instructions' => __('Better layouts button integration'),
|
72 |
|
73 |
// Layouts thumbnails
|
74 |
acf_render_field_setting($field, array(
|
75 |
+
'label' => __('Layouts: Thumbnails'),
|
76 |
'name' => 'acfe_flexible_layouts_thumbnails',
|
77 |
'key' => 'acfe_flexible_layouts_thumbnails',
|
78 |
'instructions' => __('Set a thumbnail for each layouts. You must save the field group to apply this setting'),
|
84 |
'ui_off_text' => '',
|
85 |
), true);
|
86 |
|
87 |
+
// Layouts: Render
|
88 |
acf_render_field_setting($field, array(
|
89 |
+
'label' => __('Layouts: Render'),
|
90 |
'name' => 'acfe_flexible_layouts_templates',
|
91 |
'key' => 'acfe_flexible_layouts_templates',
|
92 |
'instructions' => __('Set template, style & javascript files for each layouts.. You must save the field group to apply this setting'),
|
98 |
'ui_off_text' => '',
|
99 |
), true);
|
100 |
|
101 |
+
// Layouts: Preview
|
102 |
acf_render_field_setting($field, array(
|
103 |
+
'label' => __('Layouts: Dynamic Preview'),
|
104 |
'name' => 'acfe_flexible_layouts_previews',
|
105 |
'key' => 'acfe_flexible_layouts_previews',
|
106 |
'instructions' => __('Use layouts render settings to display a dynamic preview in the post administration'),
|
121 |
)
|
122 |
), true);
|
123 |
|
124 |
+
// Layouts: Close Button
|
125 |
+
acf_render_field_setting($field, array(
|
126 |
+
'label' => __('Layouts: Close Button'),
|
127 |
+
'name' => 'acfe_flexible_close_button',
|
128 |
+
'key' => 'acfe_flexible_close_button',
|
129 |
+
'instructions' => __('Display a close button to collapse/close the layout'),
|
130 |
+
'type' => 'true_false',
|
131 |
+
'message' => '',
|
132 |
+
'default_value' => false,
|
133 |
+
'ui' => true,
|
134 |
+
'ui_on_text' => '',
|
135 |
+
'ui_off_text' => '',
|
136 |
+
), true);
|
137 |
+
|
138 |
+
// Layouts: Copy/Paste Buttons
|
139 |
+
acf_render_field_setting($field, array(
|
140 |
+
'label' => __('Layouts: Copy/Paste'),
|
141 |
+
'name' => 'acfe_flexible_copy_paste',
|
142 |
+
'key' => 'acfe_flexible_copy_paste',
|
143 |
+
'instructions' => __('Display copy/paste layouts buttons'),
|
144 |
+
'type' => 'true_false',
|
145 |
+
'message' => '',
|
146 |
+
'default_value' => false,
|
147 |
+
'ui' => true,
|
148 |
+
'ui_on_text' => '',
|
149 |
+
'ui_off_text' => '',
|
150 |
+
), true);
|
151 |
+
|
152 |
// Modal: Edition
|
153 |
acf_render_field_setting($field, array(
|
154 |
+
'label' => __('Layouts Modal: Edition'),
|
155 |
'name' => 'acfe_flexible_modal_edition',
|
156 |
'key' => 'acfe_flexible_modal_edition',
|
157 |
'instructions' => __('Edit layout content in a modal'),
|
165 |
|
166 |
// Modal: Selection
|
167 |
acf_render_field_setting($field, array(
|
168 |
+
'label' => __('Layouts Modal: Selection'),
|
169 |
'name' => 'acfe_flexible_modal',
|
170 |
'key' => 'acfe_flexible_modal',
|
171 |
'instructions' => __('Select layouts in a modal'),
|
273 |
)
|
274 |
), true);
|
275 |
|
276 |
+
// Layouts: Force State
|
277 |
acf_render_field_setting($field, array(
|
278 |
+
'label' => __('Layouts: Force State'),
|
279 |
'name' => 'acfe_flexible_layouts_state',
|
280 |
'key' => 'acfe_flexible_layouts_state',
|
281 |
'instructions' => __('Force layouts to be collapsed or opened'),
|
301 |
add_action('acf/render_field', 'acfe_flexible_layouts_settings_before', 0);
|
302 |
function acfe_flexible_layouts_settings_before($field){
|
303 |
|
304 |
+
if($field['_name'] != 'label' || stripos($field['name'], '[layouts]') === false)
|
305 |
return;
|
306 |
|
307 |
echo '</li>';
|
319 |
add_action('acf/render_field', 'acfe_flexible_layouts_settings', 10);
|
320 |
function acfe_flexible_layouts_settings($field){
|
321 |
|
322 |
+
if($field['_name'] != 'max' || stripos($field['name'], '[layouts]') === false)
|
323 |
return;
|
324 |
|
325 |
$layout_prefix = $field['prefix'];
|
529 |
|
530 |
}
|
531 |
|
532 |
+
// Layouts: Close Button
|
533 |
+
if(isset($field['acfe_flexible_close_button']) && !empty($field['acfe_flexible_close_button'])){
|
534 |
+
|
535 |
+
$wrapper['data-acfe-flexible-close-button'] = 1;
|
536 |
+
|
537 |
+
}
|
538 |
+
|
539 |
+
// Layouts: Copy/paste
|
540 |
+
if(isset($field['acfe_flexible_copy_paste']) && !empty($field['acfe_flexible_copy_paste'])){
|
541 |
+
|
542 |
+
$wrapper['data-acfe-flexible-copy-paste'] = 1;
|
543 |
+
|
544 |
+
}
|
545 |
+
|
546 |
+
// Layouts: State
|
547 |
if(isset($field['acfe_flexible_layouts_state']) && !empty($field['acfe_flexible_layouts_state'])){
|
548 |
|
549 |
// Collapse
|
571 |
|
572 |
}
|
573 |
|
574 |
+
// Placeholder Icon
|
575 |
+
$layout_placeholder_icon = false;
|
576 |
+
$layout_placeholder_icon = apply_filters('acfe/flexible/placeholder/icon', $layout_placeholder_icon, $field);
|
577 |
+
$layout_placeholder_icon = apply_filters('acfe/flexible/placeholder/icon/name=' . $field['_name'], $layout_placeholder_icon, $field);
|
578 |
+
$layout_placeholder_icon = apply_filters('acfe/flexible/placeholder/icon/key=' . $field['key'], $layout_placeholder_icon, $field);
|
579 |
+
|
580 |
+
if(!empty($layout_placeholder_icon))
|
581 |
+
$wrapper['data-acfe-flexible-placeholder-icon'] = $layout_placeholder_icon;
|
582 |
+
|
583 |
return $wrapper;
|
584 |
|
585 |
}
|
594 |
|
595 |
}
|
596 |
|
597 |
+
add_filter('acf/prepare_field/type=flexible_content', 'acfe_flexible_layout_title_prepare');
|
598 |
+
function acfe_flexible_layout_title_prepare($field){
|
599 |
|
600 |
if(empty($field['layouts']))
|
601 |
return $field;
|
602 |
|
603 |
foreach($field['layouts'] as $k => &$layout){
|
604 |
|
605 |
+
// Thumbnail
|
606 |
$thumbnail = false;
|
607 |
if(isset($field['acfe_flexible_layouts_thumbnails']) && !empty($field['acfe_flexible_layouts_thumbnails'])){
|
608 |
|
615 |
|
616 |
// Thumbnail is set
|
617 |
$thumbnail_found = false;
|
|
|
618 |
|
619 |
+
$acfe_flexible_thumbnail = false;
|
620 |
+
if(isset($layout['acfe_flexible_thumbnail']) && !empty($layout['acfe_flexible_thumbnail']))
|
621 |
+
$acfe_flexible_thumbnail = $layout['acfe_flexible_thumbnail'];
|
622 |
+
|
623 |
+
// Filter: acfe/flexible/layout/thumbnail/name={field:flexible:name}&layout={field:flexible:layout_name}
|
624 |
+
$acfe_flexible_thumbnail = apply_filters('acfe/flexible/layout/thumbnail/layout=' . $layout['name'], $acfe_flexible_thumbnail, $field, $layout);
|
625 |
+
$acfe_flexible_thumbnail = apply_filters('acfe/flexible/layout/thumbnail/name=' . $field['_name'] . '&layout=' . $layout['name'], $acfe_flexible_thumbnail, $field, $layout);
|
626 |
+
$acfe_flexible_thumbnail = apply_filters('acfe/flexible/layout/thumbnail/key=' . $field['key'] . '&layout=' . $layout['name'], $acfe_flexible_thumbnail, $field, $layout);
|
627 |
+
|
628 |
+
if(!empty($acfe_flexible_thumbnail)){
|
629 |
+
|
630 |
+
// Thumbnail ID
|
631 |
+
if(is_numeric($acfe_flexible_thumbnail)){
|
632 |
+
|
633 |
+
if($thumbnail_src = wp_get_attachment_url($acfe_flexible_thumbnail)){
|
634 |
+
|
635 |
+
$thumbnail_found = true;
|
636 |
+
$style[] = 'background-image:url(' . $thumbnail_src . ');';
|
637 |
+
|
638 |
+
}
|
639 |
+
|
640 |
+
}
|
641 |
+
|
642 |
+
// Thumbnail URL
|
643 |
+
else{
|
644 |
|
645 |
$thumbnail_found = true;
|
646 |
+
$style[] = 'background-image:url(' . $acfe_flexible_thumbnail . ');';
|
647 |
|
648 |
}
|
649 |
|
660 |
|
661 |
}
|
662 |
|
663 |
+
// Category
|
664 |
$category = '';
|
665 |
if(isset($layout['acfe_flexible_category']) && !empty($layout['acfe_flexible_category'])){
|
666 |
|
668 |
|
669 |
}
|
670 |
|
671 |
+
$layout['label'] = $thumbnail . '<span '.$category.'>' . $layout['label'] . '</span>';
|
672 |
|
673 |
}
|
674 |
|
676 |
|
677 |
}
|
678 |
|
679 |
+
add_filter('acf/fields/flexible_content/layout_title', 'acfe_flexible_layout_title_ajax', 0, 4);
|
680 |
+
function acfe_flexible_layout_title_ajax($title, $field, $layout, $i){
|
681 |
|
682 |
// Remove thumbnail
|
683 |
$title = preg_replace('#<div class="acfe-flexible-layout-thumbnail(.*?)</div>#', '', $title);
|
684 |
|
685 |
+
// Get Layout Title
|
686 |
+
$acfe_flexible_layout_title = get_sub_field('acfe_flexible_layout_title');
|
687 |
+
if(!empty($acfe_flexible_layout_title))
|
688 |
+
$title = esc_attr(wp_unslash($acfe_flexible_layout_title));
|
689 |
+
|
690 |
+
// Return
|
691 |
+
return '<span class="acfe-layout-title acf-js-tooltip" title="' . __('Layout', 'acfe') . ': ' . esc_attr(strip_tags($layout['label'])) . '"><span class="acfe-layout-title-text">' . $title . '</span></span>';
|
692 |
+
|
693 |
+
}
|
694 |
+
|
695 |
+
add_action('acf/render_field/type=flexible_content', 'acfe_flexible_render_field');
|
696 |
+
function acfe_flexible_render_field($field){
|
697 |
+
|
698 |
+
if(!isset($field['acfe_flexible_layouts_templates']) || empty($field['acfe_flexible_layouts_templates']) || !isset($field['acfe_flexible_layouts_previews']) || empty($field['acfe_flexible_layouts_previews']) || empty($field['layouts']))
|
699 |
+
return;
|
700 |
+
|
701 |
+
// Vars
|
702 |
+
$is_preview = true;
|
703 |
+
|
704 |
+
// Actions
|
705 |
+
do_action('acfe/flexible/enqueue', $field, $is_preview);
|
706 |
+
do_action('acfe/flexible/enqueue/name=' . $field['_name'], $field, $is_preview);
|
707 |
+
do_action('acfe/flexible/enqueue/key=' . $field['key'], $field, $is_preview);
|
708 |
+
|
709 |
+
// Layouts Previews
|
710 |
+
foreach($field['layouts'] as $layout_key => $layout){
|
711 |
+
|
712 |
+
// Render: Enqueue
|
713 |
+
acfe_flexible_render_layout_enqueue($layout, $field);
|
714 |
+
|
715 |
+
}
|
716 |
|
717 |
}
|
718 |
|
742 |
if(!$layout)
|
743 |
die;
|
744 |
|
745 |
+
// Layout Thumbnail
|
746 |
+
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/layout/thumbnail/layout=' . $layout['name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
747 |
+
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/layout/thumbnail/name=' . $field['_name'] . '&layout=' . $layout['name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
748 |
+
$layout['acfe_flexible_thumbnail'] = apply_filters('acfe/flexible/layout/thumbnail/key=' . $field['key'] . '&layout=' . $layout['name'], $layout['acfe_flexible_thumbnail'], $field, $layout);
|
749 |
+
|
750 |
$get_field_object = get_field_object($options['field_key'], $options['post_id'], false, false);
|
751 |
|
752 |
$preview_key = 'preview_' . $options['field_key'];
|
757 |
add_filter('acf/load_value/key=' . $preview_key, function($value, $post_id, $field) use($options){
|
758 |
|
759 |
$value = array();
|
760 |
+
$value[0] = wp_unslash($options['value']);
|
761 |
|
762 |
return $value;
|
763 |
|
764 |
}, 10, 3);
|
765 |
|
|
|
|
|
766 |
if(have_rows($preview_key)):
|
767 |
while(have_rows($preview_key)): the_row();
|
768 |
|
769 |
+
// Flexible Preview
|
770 |
+
do_action('acfe/flexible/preview/name=' . $field['_name'], $field, $layout);
|
771 |
+
do_action('acfe/flexible/preview/key=' . $field['key'], $field, $layout);
|
|
|
|
|
|
|
|
|
772 |
|
773 |
+
// Flexible Layout Preview
|
774 |
+
do_action('acfe/flexible/layout/preview/layout=' . $layout['name'], $field, $layout);
|
775 |
+
do_action('acfe/flexible/layout/preview/name=' . $field['_name'] . '&layout=' . $layout['name'], $field, $layout);
|
776 |
+
do_action('acfe/flexible/layout/preview/key=' . $field['key'] . '&layout=' . $layout['name'], $field, $layout);
|
777 |
|
778 |
+
// ACFE: All Flexible Preview
|
779 |
+
do_action('acfe/flexible/preview', $field, $layout);
|
780 |
|
781 |
endwhile;
|
782 |
endif;
|
783 |
|
784 |
die;
|
785 |
|
786 |
+
}
|
787 |
+
|
788 |
+
add_action('acfe/flexible/preview', 'acfe_flexible_layout_preview_render', 99, 2);
|
789 |
+
function acfe_flexible_layout_preview_render($field, $layout){
|
790 |
+
|
791 |
+
$is_preview = true;
|
792 |
+
|
793 |
+
acfe_flexible_render_layout_template($layout, $field);
|
794 |
+
|
795 |
+
}
|
796 |
+
|
797 |
+
add_filter('acfe/flexible/render/template', 'acfe_flexible_layout_render_template_setting', 0, 4);
|
798 |
+
function acfe_flexible_layout_render_template_setting($return, $field, $layout, $is_preview){
|
799 |
+
|
800 |
+
if(isset($layout['acfe_flexible_render_template']) && !empty($layout['acfe_flexible_render_template']))
|
801 |
+
$return = ACFE_THEME_PATH . '/' . $layout['acfe_flexible_render_template'];
|
802 |
+
|
803 |
+
return $return;
|
804 |
+
|
805 |
+
}
|
806 |
+
|
807 |
+
add_filter('acfe/flexible/render/style', 'acfe_flexible_layout_render_style_setting', 0, 4);
|
808 |
+
function acfe_flexible_layout_render_style_setting($return, $field, $layout, $is_preview){
|
809 |
+
|
810 |
+
if(isset($layout['acfe_flexible_render_style']) && !empty($layout['acfe_flexible_render_style']))
|
811 |
+
$return = ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_style'];
|
812 |
+
|
813 |
+
return $return;
|
814 |
+
|
815 |
+
}
|
816 |
+
|
817 |
+
add_filter('acfe/flexible/render/script', 'acfe_flexible_layout_render_script_setting', 0, 4);
|
818 |
+
function acfe_flexible_layout_render_script_setting($return, $field, $layout, $is_preview){
|
819 |
+
|
820 |
+
if(isset($layout['acfe_flexible_render_script']) && !empty($layout['acfe_flexible_render_script']))
|
821 |
+
$return = ACFE_THEME_URL . '/' . $layout['acfe_flexible_render_script'];
|
822 |
+
|
823 |
+
return $return;
|
824 |
+
|
825 |
+
}
|
826 |
+
|
827 |
+
add_filter('acf/load_field/type=flexible_content', 'acfe_flexible_layout_title_subfield');
|
828 |
+
function acfe_flexible_layout_title_subfield($field){
|
829 |
+
|
830 |
+
global $typenow;
|
831 |
+
|
832 |
+
if(acf_is_screen(array('edit-acf-field-group', 'acf-field-group')) || (isset($typenow) && $typenow == 'acf-field-group'))
|
833 |
+
return $field;
|
834 |
+
|
835 |
+
if(!isset($field['layouts']) || empty($field['layouts']))
|
836 |
+
return $field;
|
837 |
+
|
838 |
+
foreach($field['layouts'] as $layout_key => &$layout){
|
839 |
+
|
840 |
+
$layout['sub_fields'][] = array(
|
841 |
+
'ID' => false,
|
842 |
+
'label' => false,
|
843 |
+
'key' => 'field_acfe_flexible_layout_title',
|
844 |
+
'name' => 'acfe_flexible_layout_title',
|
845 |
+
'_name' => 'acfe_flexible_layout_title',
|
846 |
+
'type' => 'text',
|
847 |
+
'required' => 0,
|
848 |
+
'maxlength' => null,
|
849 |
+
'parent' => false,
|
850 |
+
'default_value' => $layout['label'],
|
851 |
+
'placeholder' => $layout['label'],
|
852 |
+
'wrapper' => array(
|
853 |
+
'id' => '',
|
854 |
+
'class' => '',
|
855 |
+
'width' => '',
|
856 |
+
)
|
857 |
+
);
|
858 |
+
|
859 |
+
}
|
860 |
+
|
861 |
+
return $field;
|
862 |
+
|
863 |
}
|
includes/modules/author.php
CHANGED
@@ -199,4 +199,17 @@ function acfe_author_meta_update($return, $value, $post_id, $field){
|
|
199 |
|
200 |
return $return;
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
199 |
|
200 |
return $return;
|
201 |
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Field Group Hide on Screen
|
206 |
+
*/
|
207 |
+
add_filter('acf/get_field_group_style', 'acfe_author_meta_hide_on_screen', 10, 2);
|
208 |
+
function acfe_author_meta_hide_on_screen($style, $field_group){
|
209 |
+
|
210 |
+
$style = str_replace('authordiv', 'acf-group_acfe_author', $style);
|
211 |
+
$style = str_replace('display: none;', 'display: none !important;', $style);
|
212 |
+
|
213 |
+
return $style;
|
214 |
+
|
215 |
}
|
includes/modules/dynamic-options-page.php
CHANGED
@@ -20,7 +20,7 @@ function acfe_dop_register(){
|
|
20 |
'add_new_item' => 'New Options Page',
|
21 |
),
|
22 |
'supports' => array('custom-fields'),
|
23 |
-
'hierarchical' =>
|
24 |
'public' => false,
|
25 |
'show_ui' => true,
|
26 |
'show_in_menu' => false,
|
@@ -107,12 +107,34 @@ function acfe_dop_registers(){
|
|
107 |
if(empty($dynamic_options_pages))
|
108 |
return;
|
109 |
|
|
|
|
|
110 |
foreach($dynamic_options_pages as $name => $register_args){
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
// Register: Execute
|
113 |
acf_add_options_page($register_args);
|
114 |
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
}
|
118 |
|
@@ -149,16 +171,38 @@ function acfe_dop_filter_save($post_id){
|
|
149 |
|
150 |
$title = get_field('page_title', $post_id);
|
151 |
$name = get_field('acfe_dop_name', $post_id);
|
|
|
152 |
|
153 |
// Force name
|
154 |
if(empty($name))
|
155 |
$name = sanitize_title($title);
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
// Update post
|
158 |
wp_update_post(array(
|
159 |
'ID' => $post_id,
|
160 |
'post_title' => $title,
|
161 |
'post_name' => $name,
|
|
|
162 |
));
|
163 |
|
164 |
// Register Args
|
@@ -167,7 +211,6 @@ function acfe_dop_filter_save($post_id){
|
|
167 |
$menu_slug = get_field('menu_slug', $post_id);
|
168 |
$capability = get_field('capability', $post_id);
|
169 |
$position = get_field('position', $post_id);
|
170 |
-
$parent_slug = get_field('parent_slug', $post_id);
|
171 |
$icon_url = get_field('icon_url', $post_id);
|
172 |
$redirect = get_field('redirect', $post_id);
|
173 |
$p_id = get_field('post_id', $post_id);
|
@@ -364,13 +407,13 @@ function acfe_dop_admin_columns_html($column, $post_id){
|
|
364 |
/**
|
365 |
* Admin List Row Actions
|
366 |
*/
|
367 |
-
add_filter('
|
368 |
function acfe_dop_admin_row($actions, $post){
|
369 |
|
370 |
if($post->post_type != 'acfe-dop' || $post->post_status != 'publish')
|
371 |
return $actions;
|
372 |
|
373 |
-
$name = get_field('acfe_dop_name', $
|
374 |
|
375 |
$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>';
|
376 |
|
20 |
'add_new_item' => 'New Options Page',
|
21 |
),
|
22 |
'supports' => array('custom-fields'),
|
23 |
+
'hierarchical' => true,
|
24 |
'public' => false,
|
25 |
'show_ui' => true,
|
26 |
'show_in_menu' => false,
|
107 |
if(empty($dynamic_options_pages))
|
108 |
return;
|
109 |
|
110 |
+
$options_sub_pages = array();
|
111 |
+
|
112 |
foreach($dynamic_options_pages as $name => $register_args){
|
113 |
|
114 |
+
// Do not register sub pages
|
115 |
+
if(isset($register_args['parent_slug']) && !empty($register_args['parent_slug'])){
|
116 |
+
|
117 |
+
$options_sub_pages[$name] = $register_args;
|
118 |
+
continue;
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
// Register: Execute
|
123 |
acf_add_options_page($register_args);
|
124 |
|
125 |
}
|
126 |
+
|
127 |
+
// Register sub pages
|
128 |
+
if(!empty($options_sub_pages)){
|
129 |
+
|
130 |
+
foreach($options_sub_pages as $name => $register_args){
|
131 |
+
|
132 |
+
// Register: Execute
|
133 |
+
acf_add_options_page($register_args);
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
}
|
138 |
|
139 |
}
|
140 |
|
171 |
|
172 |
$title = get_field('page_title', $post_id);
|
173 |
$name = get_field('acfe_dop_name', $post_id);
|
174 |
+
$parent_slug = get_field('parent_slug', $post_id);
|
175 |
|
176 |
// Force name
|
177 |
if(empty($name))
|
178 |
$name = sanitize_title($title);
|
179 |
|
180 |
+
$parent = 0;
|
181 |
+
if(!empty($parent_slug)){
|
182 |
+
|
183 |
+
$get_dop_parent = get_posts(array(
|
184 |
+
'post_type' => 'acfe-dop',
|
185 |
+
'posts_per_page' => 1,
|
186 |
+
'fields' => 'ids',
|
187 |
+
'meta_query' => array(
|
188 |
+
array(
|
189 |
+
'key' => 'menu_slug',
|
190 |
+
'value' => $parent_slug
|
191 |
+
)
|
192 |
+
)
|
193 |
+
));
|
194 |
+
|
195 |
+
if(!empty($get_dop_parent))
|
196 |
+
$parent = $get_dop_parent[0];
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
// Update post
|
201 |
wp_update_post(array(
|
202 |
'ID' => $post_id,
|
203 |
'post_title' => $title,
|
204 |
'post_name' => $name,
|
205 |
+
'post_parent' => $parent,
|
206 |
));
|
207 |
|
208 |
// Register Args
|
211 |
$menu_slug = get_field('menu_slug', $post_id);
|
212 |
$capability = get_field('capability', $post_id);
|
213 |
$position = get_field('position', $post_id);
|
|
|
214 |
$icon_url = get_field('icon_url', $post_id);
|
215 |
$redirect = get_field('redirect', $post_id);
|
216 |
$p_id = get_field('post_id', $post_id);
|
407 |
/**
|
408 |
* Admin List Row Actions
|
409 |
*/
|
410 |
+
add_filter('page_row_actions','acfe_dop_admin_row', 10, 2);
|
411 |
function acfe_dop_admin_row($actions, $post){
|
412 |
|
413 |
if($post->post_type != 'acfe-dop' || $post->post_status != 'publish')
|
414 |
return $actions;
|
415 |
|
416 |
+
$name = get_field('acfe_dop_name', $post->ID);
|
417 |
|
418 |
$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>';
|
419 |
|
includes/modules/dynamic-post-type.php
CHANGED
@@ -607,6 +607,9 @@ function acfe_dpt_admin_footer(){
|
|
607 |
// Get Dynamic Post Type Post
|
608 |
$acfe_dpt_post_type = get_page_by_path($post_type, 'OBJECT', 'acfe-dpt');
|
609 |
|
|
|
|
|
|
|
610 |
?>
|
611 |
<script type="text/html" id="tmpl-acfe-dpt-title-config">
|
612 |
<a href="<?php echo admin_url('post.php?post=' . $acfe_dpt_post_type->ID . '&action=edit'); ?>" class="page-title-action acfe-dpt-admin-config"><span class="dashicons dashicons-admin-generic"></span></a>
|
607 |
// Get Dynamic Post Type Post
|
608 |
$acfe_dpt_post_type = get_page_by_path($post_type, 'OBJECT', 'acfe-dpt');
|
609 |
|
610 |
+
if(empty($acfe_dpt_post_type))
|
611 |
+
return;
|
612 |
+
|
613 |
?>
|
614 |
<script type="text/html" id="tmpl-acfe-dpt-title-config">
|
615 |
<a href="<?php echo admin_url('post.php?post=' . $acfe_dpt_post_type->ID . '&action=edit'); ?>" class="page-title-action acfe-dpt-admin-config"><span class="dashicons dashicons-admin-generic"></span></a>
|
includes/modules/dynamic-taxonomy.php
CHANGED
@@ -215,8 +215,7 @@ function acfe_dt_filter_save($post_id){
|
|
215 |
}
|
216 |
|
217 |
// Capabilities
|
218 |
-
|
219 |
-
$register_args['capabilities'] = $capabilities;
|
220 |
|
221 |
// Get ACFE option
|
222 |
$option = get_option('acfe_dynamic_taxonomies', array());
|
@@ -602,6 +601,9 @@ function acfe_dt_admin_footer(){
|
|
602 |
// Get Dynamic Post Type Post
|
603 |
$acfe_dt_post_type = get_page_by_path($taxonomy, 'OBJECT', 'acfe-dt');
|
604 |
|
|
|
|
|
|
|
605 |
?>
|
606 |
<script type="text/html" id="tmpl-acfe-dt-title-config">
|
607 |
<a href="<?php echo admin_url('post.php?post=' . $acfe_dt_post_type->ID . '&action=edit'); ?>" class="page-title-action acfe-dt-admin-config"><span class="dashicons dashicons-admin-generic"></span></a>
|
@@ -705,7 +707,7 @@ function acfe_dt_local_field_group(){
|
|
705 |
'placeholder' => '',
|
706 |
'prepend' => '',
|
707 |
'append' => '',
|
708 |
-
'maxlength' =>
|
709 |
),
|
710 |
array(
|
711 |
'key' => 'field_acfe_dt_description',
|
215 |
}
|
216 |
|
217 |
// Capabilities
|
218 |
+
$register_args['capabilities'] = $capabilities;
|
|
|
219 |
|
220 |
// Get ACFE option
|
221 |
$option = get_option('acfe_dynamic_taxonomies', array());
|
601 |
// Get Dynamic Post Type Post
|
602 |
$acfe_dt_post_type = get_page_by_path($taxonomy, 'OBJECT', 'acfe-dt');
|
603 |
|
604 |
+
if(empty($acfe_dt_post_type))
|
605 |
+
return;
|
606 |
+
|
607 |
?>
|
608 |
<script type="text/html" id="tmpl-acfe-dt-title-config">
|
609 |
<a href="<?php echo admin_url('post.php?post=' . $acfe_dt_post_type->ID . '&action=edit'); ?>" class="page-title-action acfe-dt-admin-config"><span class="dashicons dashicons-admin-generic"></span></a>
|
707 |
'placeholder' => '',
|
708 |
'prepend' => '',
|
709 |
'append' => '',
|
710 |
+
'maxlength' => 32,
|
711 |
),
|
712 |
array(
|
713 |
'key' => 'field_acfe_dt_description',
|
includes/modules/taxonomy.php
CHANGED
@@ -9,9 +9,14 @@ if(!defined('ABSPATH'))
|
|
9 |
add_action('admin_footer-edit-tags.php', 'acfe_better_taxonomy_admin_footer');
|
10 |
function acfe_better_taxonomy_admin_footer(){
|
11 |
|
|
|
|
|
|
|
12 |
?>
|
13 |
<script type="text/html" id="tmpl-acfe-bt-admin-button-add">
|
14 |
-
|
|
|
|
|
15 |
</script>
|
16 |
|
17 |
<script type="text/html" id="tmpl-acfe-bt-wrapper">
|
9 |
add_action('admin_footer-edit-tags.php', 'acfe_better_taxonomy_admin_footer');
|
10 |
function acfe_better_taxonomy_admin_footer(){
|
11 |
|
12 |
+
global $tax;
|
13 |
+
$can_edit_terms = current_user_can($tax->cap->edit_terms);
|
14 |
+
|
15 |
?>
|
16 |
<script type="text/html" id="tmpl-acfe-bt-admin-button-add">
|
17 |
+
<?php if($can_edit_terms){ ?>
|
18 |
+
<a href="#" class="page-title-action acfe-bt-admin-button-add"><?php echo $tax->labels->add_new_item; ?></a>
|
19 |
+
<?php } ?>
|
20 |
</script>
|
21 |
|
22 |
<script type="text/html" id="tmpl-acfe-bt-wrapper">
|
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.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -182,6 +182,7 @@ Manage ACF Block Types from ACF > Block Types.
|
|
182 |
|
183 |
= ACF: Flexible Content Enhancement =
|
184 |
|
|
|
185 |
* Controls: Copy, Paste & Duplicate Layouts on the fly
|
186 |
* Controls: Copy & Paste all layouts on the fly
|
187 |
* Stylised Button: Add style to 'Add Row'
|
@@ -196,8 +197,8 @@ Manage ACF Block Types from ACF > Block Types.
|
|
196 |
* Modal Selection Columns: Change the layout modal columns grid. 1, 2, 3, 4, 5 or 6 columns available
|
197 |
* Modal Selection Categories: Add category for each layout in the layout modal
|
198 |
* Layouts State: Force layouts to be collapsed or opened by default
|
199 |
-
* Button Label:
|
200 |
-
* One
|
201 |
|
202 |
== ❤️ Supporters ==
|
203 |
|
@@ -278,12 +279,171 @@ When using this function, you have access to the following global variables: `$l
|
|
278 |
|
279 |
[More informations are available on the official website](https://www.acf-extended.com/post/flexible-content-dynamic-layout-preview)
|
280 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
== Screenshots ==
|
282 |
|
283 |
-
1.
|
284 |
-
2.
|
285 |
-
3.
|
286 |
-
4.
|
287 |
5. Dynamic Post Type
|
288 |
6. Dynamic Taxonomy
|
289 |
7. Dynamic Options Pages
|
@@ -293,8 +453,35 @@ When using this function, you have access to the following global variables: `$l
|
|
293 |
|
294 |
== Changelog ==
|
295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
= 0.7.8 =
|
297 |
-
* Field: Flexible Content - Removed 'Layouts Thumbnail as Preview' setting. You should now use 'Layouts: Dynamic Preview'
|
298 |
* Field: Flexible Content - Added 'Layouts: Dynamic Preview' ('Layouts: Render' setting must be turned ON)
|
299 |
* Field: Flexible Content - Reworked layouts settings order (better readability)
|
300 |
* Field: Flexible Content - Modal Edition title now removes eventual extra HTML tags (thanks @Thomas D.)
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.2
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 0.7.9
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
182 |
|
183 |
= ACF: Flexible Content Enhancement =
|
184 |
|
185 |
+
* Controls: Inline Layout Title Edition
|
186 |
* Controls: Copy, Paste & Duplicate Layouts on the fly
|
187 |
* Controls: Copy & Paste all layouts on the fly
|
188 |
* Stylised Button: Add style to 'Add Row'
|
197 |
* Modal Selection Columns: Change the layout modal columns grid. 1, 2, 3, 4, 5 or 6 columns available
|
198 |
* Modal Selection Categories: Add category for each layout in the layout modal
|
199 |
* Layouts State: Force layouts to be collapsed or opened by default
|
200 |
+
* Button Label: Supports Dashicons icons elments `<span>`
|
201 |
+
* One Click: the 'Add row' button will add a layout without the selection modal if there is only one layout available in the flexible content
|
202 |
|
203 |
== ❤️ Supporters ==
|
204 |
|
279 |
|
280 |
[More informations are available on the official website](https://www.acf-extended.com/post/flexible-content-dynamic-layout-preview)
|
281 |
|
282 |
+
= How to change the Flexible Content: Thumbnails URL in PHP? =
|
283 |
+
|
284 |
+
You can use the following filters:
|
285 |
+
|
286 |
+
`
|
287 |
+
// add_action('acfe/flexible/layout/thumbnail/name=my_flexible&layout=my_layout', 'acf_flexible_layout_thumbnail', 10, 3);
|
288 |
+
// add_action('acfe/flexible/layout/thumbnail/key=field_xxxxxx&layout=my_layout', 'acf_flexible_layout_thumbnail', 10, 3);
|
289 |
+
|
290 |
+
add_filter('acfe/flexible/layout/thumbnail/layout=my_layout', 'acf_flexible_layout_thumbnail', 10, 3);
|
291 |
+
function acf_flexible_layout_thumbnail($thumbnail, $field, $layout){
|
292 |
+
|
293 |
+
|
294 |
+
// Must return an URL or Attachment ID
|
295 |
+
return 'https://www.example.com/my-image?jpg';
|
296 |
+
|
297 |
+
}
|
298 |
+
`
|
299 |
+
|
300 |
+
= How to change the Flexible Content: Dynamic Preview content in PHP? =
|
301 |
+
|
302 |
+
You can use the following actions:
|
303 |
+
|
304 |
+
`
|
305 |
+
// add_action('acfe/flexible/preview/name=my_flexible', 'acf_flexible_preview', 10, 2);
|
306 |
+
// add_action('acfe/flexible/preview/key=field_xxxxxx', 'acf_flexible_preview', 10, 2);
|
307 |
+
|
308 |
+
add_action('acfe/flexible/preview', 'acf_flexible_preview', 10, 2);
|
309 |
+
function acf_flexible_preview($field, $layout){
|
310 |
+
|
311 |
+
echo 'My Preview';
|
312 |
+
|
313 |
+
// It is important to use 'die', as we are in an Ajax request
|
314 |
+
die;
|
315 |
+
|
316 |
+
}
|
317 |
+
|
318 |
+
// add_action('acfe/flexible/layout/preview/name=my_flexible&layout=my_layout', 'acf_flexible_layout_preview', 10, 2);
|
319 |
+
// add_action('acfe/flexible/layout/preview/key=field_xxxxxx&layout=my_layout', 'acf_flexible_layout_preview', 10, 2);
|
320 |
+
|
321 |
+
add_action('acfe/flexible/layout/preview/layout=my_layout', 'acf_flexible_layout_preview', 10, 2);
|
322 |
+
function acf_flexible_layout_preview($field, $layout){
|
323 |
+
|
324 |
+
echo 'My Preview';
|
325 |
+
|
326 |
+
// It is important to use 'die', as we are in an Ajax request
|
327 |
+
die;
|
328 |
+
|
329 |
+
}
|
330 |
+
`
|
331 |
+
|
332 |
+
= How to enqueue new style/script files in the Flexible Content in PHP? =
|
333 |
+
|
334 |
+
You can use the following actions:
|
335 |
+
|
336 |
+
`
|
337 |
+
// add_action('acfe/flexible/enqueue/name=my_flexible', 'acf_flexible_enqueue', 10, 2);
|
338 |
+
// add_action('acfe/flexible/enqueue/key=field_xxxxxx', 'acf_flexible_enqueue', 10, 2);
|
339 |
+
|
340 |
+
add_action('acfe/flexible/enqueue', 'acf_flexible_enqueue', 10, 2);
|
341 |
+
function acf_flexible_enqueue($field, $is_preview){
|
342 |
+
|
343 |
+
// Only in Ajax preview
|
344 |
+
if($is_preview){
|
345 |
+
|
346 |
+
wp_enqueue_style('my-style-preview', 'https://www.example.com/style-preview.css');
|
347 |
+
|
348 |
+
}
|
349 |
+
|
350 |
+
wp_enqueue_style('my-style', 'https://www.example.com/style.css');
|
351 |
+
|
352 |
+
}
|
353 |
+
|
354 |
+
// add_action('acfe/flexible/layout/enqueue/name=my_flexible&layout=my_layout', 'acf_flexible_layout_enqueue', 10, 3);
|
355 |
+
// add_action('acfe/flexible/layout/enqueue/key=field_xxxxxx&layout=my_layout', 'acf_flexible_layout_enqueue', 10, 3);
|
356 |
+
|
357 |
+
add_action('acfe/flexible/layout/enqueue/layout=my_layout', 'acf_flexible_layout_enqueue', 10, 3);
|
358 |
+
function acf_flexible_layout_enqueue($field, $layout, $is_preview){
|
359 |
+
|
360 |
+
// Only in Ajax preview
|
361 |
+
if($is_preview){
|
362 |
+
|
363 |
+
wp_enqueue_style('my-style-preview', 'https://www.example.com/style-preview.css');
|
364 |
+
|
365 |
+
}
|
366 |
+
|
367 |
+
wp_enqueue_style('my-style', 'https://www.example.com/style.css');
|
368 |
+
|
369 |
+
}
|
370 |
+
`
|
371 |
+
|
372 |
+
= How to change the Flexible Content: Layout Render Paths in PHP? =
|
373 |
+
|
374 |
+
You can use the following actions:
|
375 |
+
|
376 |
+
`
|
377 |
+
// add_action('acfe/flexible/render/template', 'acf_flexible_layout_render_template', 10, 4);
|
378 |
+
// add_action('acfe/flexible/render/template/name=my_flexible', 'acf_flexible_layout_render_template', 10, 4);
|
379 |
+
// add_action('acfe/flexible/render/template/key=field_xxxxxx', 'acf_flexible_layout_render_template', 10, 4);
|
380 |
+
|
381 |
+
// add_action('acfe/flexible/layout/render/template/name=my_flexible&layout=my_layout', 'acf_flexible_layout_render_template', 10, 4);
|
382 |
+
// add_action('acfe/flexible/layout/render/template/key=field_xxxxxx&layout=my_layout', 'acf_flexible_layout_render_template', 10, 4);
|
383 |
+
|
384 |
+
add_filter('acfe/flexible/layout/render/template/layout=my_layout', 'acf_flexible_layout_render_template', 10, 4);
|
385 |
+
function acf_flexible_layout_render_template($template, $field, $layout, $is_preview){
|
386 |
+
|
387 |
+
// Only in Ajax preview
|
388 |
+
if($is_preview){
|
389 |
+
|
390 |
+
return get_stylesheet_directory() . '/my-template-preview.php';
|
391 |
+
|
392 |
+
}
|
393 |
+
|
394 |
+
return get_stylesheet_directory() . '/my-template.php';
|
395 |
+
|
396 |
+
}
|
397 |
+
|
398 |
+
// add_action('acfe/flexible/render/style', 'acf_flexible_layout_render_style', 10, 4);
|
399 |
+
// add_action('acfe/flexible/render/style/name=my_flexible', 'acf_flexible_layout_render_style', 10, 4);
|
400 |
+
// add_action('acfe/flexible/render/style/key=field_xxxxxx', 'acf_flexible_layout_render_style', 10, 4);
|
401 |
+
|
402 |
+
// add_action('acfe/flexible/layout/render/style/name=my_flexible&layout=my_layout', 'acf_flexible_layout_render_style', 10, 4);
|
403 |
+
// add_action('acfe/flexible/layout/render/style/key=field_xxxxxx&layout=my_layout', 'acf_flexible_layout_render_style', 10, 4);
|
404 |
+
|
405 |
+
add_filter('acfe/flexible/layout/render/style/layout=my_layout', 'acf_flexible_layout_render_style', 10, 4);
|
406 |
+
function acf_flexible_layout_render_style($style, $field, $layout, $is_preview){
|
407 |
+
|
408 |
+
// Only in Ajax preview
|
409 |
+
if($is_preview){
|
410 |
+
|
411 |
+
return get_stylesheet_directory_uri() . '/my-style-preview.css';
|
412 |
+
|
413 |
+
}
|
414 |
+
|
415 |
+
return get_stylesheet_directory_uri() . '/my-style.css';
|
416 |
+
|
417 |
+
}
|
418 |
+
|
419 |
+
// add_action('acfe/flexible/render/script', 'acf_flexible_layout_render_script', 10, 4);
|
420 |
+
// add_action('acfe/flexible/render/script/name=my_flexible', 'acf_flexible_layout_render_script', 10, 4);
|
421 |
+
// add_action('acfe/flexible/render/script/key=field_xxxxxx', 'acf_flexible_layout_render_script', 10, 4);
|
422 |
+
|
423 |
+
// add_action('acfe/flexible/layout/render/script/name=my_flexible&layout=my_layout', 'acf_flexible_layout_render_script', 10, 4);
|
424 |
+
// add_action('acfe/flexible/layout/render/script/key=field_xxxxxx&layout=my_layout', 'acf_flexible_layout_render_script', 10, 4);
|
425 |
+
|
426 |
+
add_filter('acfe/flexible/layout/render/script/layout=my_layout', 'acf_flexible_layout_render_script', 10, 4);
|
427 |
+
function acf_flexible_layout_render_script($script, $field, $layout, $is_preview){
|
428 |
+
|
429 |
+
// Only in Ajax preview
|
430 |
+
if($is_preview){
|
431 |
+
|
432 |
+
return get_stylesheet_directory_uri() . '/my-script-preview.js';
|
433 |
+
|
434 |
+
}
|
435 |
+
|
436 |
+
return get_stylesheet_directory_uri() . '/my-script.js';
|
437 |
+
|
438 |
+
}
|
439 |
+
`
|
440 |
+
|
441 |
== Screenshots ==
|
442 |
|
443 |
+
1. Flexible Content Preview
|
444 |
+
2. Flexible Content Modal
|
445 |
+
3. Field Groups List
|
446 |
+
4. Field Group
|
447 |
5. Dynamic Post Type
|
448 |
6. Dynamic Taxonomy
|
449 |
7. Dynamic Options Pages
|
453 |
|
454 |
== Changelog ==
|
455 |
|
456 |
+
= 0.7.9 =
|
457 |
+
* Field: Flexible Content - Added Inline Layout Title Edition
|
458 |
+
* Field: Flexible Content - Added Auto scroll + Modal edit on One Click layout
|
459 |
+
* Field: Flexible Content - Removed native "Controls Icons" visibility being visible on all sub flexible content fields (better readability)
|
460 |
+
* Field: Flexible Content - Added WP Unslash on preview values to prevent backlashes on values (thanks @Dam)
|
461 |
+
* Field: Flexible Content - Added compatibility for layouts that have been synced and not manually created (thanks @T. Dubois)
|
462 |
+
* Field: Flexible Content - Copy/Paste functionality is now a Flexible Content setting (Default: Disabled) (Feature resquest: @louiswalch)
|
463 |
+
* Field: Flexible Content - 'Close Button' (collapse) on layouts is now a Flexible Content setting(Default: Disabled)
|
464 |
+
* Field: Flexible Content - Layouts Thumbnails aspect ratio are now locked (base ratio: 450px * 200px) (Feature resquest: @louiswalch)
|
465 |
+
* Field: Flexible Content - Dynamic Layout Preview refresh has been optimized. The preview content is now kept instead of being reset
|
466 |
+
* Field: Flexible Content - Dynamic Layout Preview style & script enqueue now use wp_enqueue_style() & wp_enqueue_script()
|
467 |
+
* Field: Flexible Content - Modal Edition - 'Enter' & 'ESC' keys now close Modals (instead of submitting the form)
|
468 |
+
* Field: Flexible Content - Added `action('acfe/flexible/enqueue', $field, $is_preview)` to enqueue new style/script (back & front) (with 6 variations)
|
469 |
+
* Field: Flexible Content - Added `filter('acfe/flexible/layout/thumbnail/layout={layout:name}', $thumbnail, $field, $layout)` to change layout thumbnail (must return `attachment ID` or `URL`) (with 3 variations)
|
470 |
+
* Field: Flexible Content - Added `action('acfe/flexible/preview', $field, $layout)` to change Dynamic Layout Preview content (with 6 variations)
|
471 |
+
* Field: Flexible Content - Added `filter('acfe/flexible/render/template', $template, $field, $layout, $is_preview)` to change Layout Render: Template Path (with 6 variations)
|
472 |
+
* Field: Flexible Content - Added `filter('acfe/flexible/render/style', $style, $field, $layout, $is_preview)` to change Layout Render: Style Path (with 6 variations)
|
473 |
+
* Field: Flexible Content - Added `filter('acfe/flexible/render/script', $script, $field, $layout, $is_preview)` to change Layout Render: Script Path (with 6 variations)
|
474 |
+
* Field: Flexible Content - Added `filter('acfe/flexible/placeholder/icon', $class, $field)` to change the Placeholder Button Dashicon class (default: 'dashicons dashicons-edit') (with 3 variations)
|
475 |
+
* Module: Dynamic Options Page - Fixed 'Undefinied $post_id' PHP warning in Dynamic Options Page screen
|
476 |
+
* Module: Dynamic Options Page - Fixed registration order for child options pages (thanks @Val)
|
477 |
+
* Module: Dynamic Post Type - Fixed undefined ID php Warning on edit screen when Dynamic Post Type is registered locally (thanks @Val)
|
478 |
+
* Module: Dynamic Taxonomies - Taxonomy name character limit has been fixed to 32 instead of 20 (thanks @Damian)
|
479 |
+
* Module: Dynamic Taxonomies - 'Add New' button is now based on Taxonomy capabilities & Taxonomy Label (thanks @absolute_web)
|
480 |
+
* Module: Author - Field groups 'Hide on screen' is now taken in account (thanks @louiswalch)
|
481 |
+
* Tools: Dynamic Taxonomies Import - Fixed 'undefined index' PHP warning on taxonomy import (thanks @Val)
|
482 |
+
|
483 |
= 0.7.8 =
|
484 |
+
* Field: Flexible Content - Removed 'Layouts Thumbnail as Preview' setting. You should now use 'Layouts: Dynamic Preview'
|
485 |
* Field: Flexible Content - Added 'Layouts: Dynamic Preview' ('Layouts: Render' setting must be turned ON)
|
486 |
* Field: Flexible Content - Reworked layouts settings order (better readability)
|
487 |
* Field: Flexible Content - Modal Edition title now removes eventual extra HTML tags (thanks @Thomas D.)
|