Version Description
- General: Added Settings/Options API
- General: Improved modules performance
- Module: Dynamic Forms - Improved module UI, fields UI & documentation
- Module: Dynamic Forms - Added "Cheatsheet" tab to list all available template tags
- Module: Dynamic Forms - Added "Validation" tab
- Module: Dynamic Forms - Email Action - Added "Reply-to", "Cc", & "Bcc" fields
- Module: Dynamic Forms - Email Action - Added "Delete attachment once sent" setting for each Dynamic attachments
- Module: Dynamic Forms - Email Action - Added "Static attachments"
- Module: Dynamic Forms - User Action - Added "Log user" action type
- Module: Dynamic Forms - Post Action - Terms can now be created on the fly using custom template tags. Example:
My new term|my-taxonomy
- Module: Dynamic Forms - Post Action - Fixed terms not being set correctly when user wasn't logged
- Module: Dynamic Forms - Template tags are now allowed everywhere
- Module: Dynamic Forms - Added "Apply field groups rules" setting to take field group conditional locations into account
- Module: Dynamic Forms - Added a switch on "Form HTML override" to explicity explain this setting is optional
- Module: Dynamic Forms - Added
{get_field:field_name}
template tags to retrieve field value from DB. More information in the "Cheatsheet" tab - Module: Dynamic Forms - Added
{current:post/term/user/author/form}
template tags to retrieve current data information. More information in the "Cheatsheet" tab - Module: Dynamic Forms - Added
{current:***}
template tags to retrieve current post/term/user/post author/form information. More information in the "Cheatsheet" tab - Module: Dynamic Forms - Added "Hide successful re-validation notice" setting
- Module: Dynamic Forms - Google Map return value is now correctly formatted
- Module: Dynamic Forms - Fixed WPML compatibility problem when using "honeypot" field
- Module: Dynamic Forms - Fields conditional logic are now working when fields are wrapper within custom div
- Module: Dynamic Forms - Added CSS to WP Media modal & cleaned accessibility text
- Module: Dynamic Forms - Added "Default Uploader Type" setting (based on field setting)
- Module: Dynamic Forms - Fixed Loading value not working correctly on repeaters/groups/flexible content
- Module: Dynamic Forms - Added PHP function to easily import form.
acfe_import_dynamic_form($array|$json);
- Module: Dynamic Forms - Fixed shortcode being interpreted in admin view (Gutenberg/Dynamic Ajax Preview)
- Module: Dynamic Post Type - Fixed capabilities not being correctly mapped
- Module: Dynamic Post Type - Fixed Admin orderby & order not working correctly when
has_archive
was disabled - Module: Dynamic Taxonomy - Fixed capabilities not being correctly mapped
- Module: Dynamic Taxonomy - Fixed Front posts per page, orderby & order settings
- Module: Dynamic Author - Added better post author ID cast
- Module: AutoSync - New fields groups now have Json/PHP AutoSync setting checked by default if the corresponding folder exists
- Field: Flexible Content - Modal Categories Selection setting is now using Select2 with tags
- Field: Flexible Content - The bottom bar in modal now clear potential floating elements
- Field: Flexible Content - Fixed clone function not working correctly with tabs that have conditional logic
- Field: Select - Added "## Title" markdown to add option group in field's choices
- Field: Select - Added "Allow custom" setting
- Field: Select2 - Tweaked CSS to match WordPress 5.3 UI
- Field: Select2 - Fixed WPML CSS overriding select2 style
- Field: Code Editor - The field now correctly trigger
change()
on input - Field: Code Editor - Added "Max rows" setting
- Field: Code Editor - Fixed "Default value" javascript code being executed within the Data modal
- Field: Advanced Link - Added Term link types
- Field: Advanced Link - Added Post Type Archive link types
- Field: Advanced Link - Fixed custom sub fields not working correctly when retrieving values
- Field: Advanced Link - Reworked the custom sub fields declaration. It's now easier to add custom fields
- Field: reCaptcha - Fixed v2 theme & size settings not working correctly
- Field: reCaptcha - Fixed v3 JS error on reset
- Field: Datepicker/Datetime picker/Timepicker - Added CSS to match WordPress 5.3 UI
- Field Group: Fixed Instructions "Tooltip" mode not working correclty in groups
- Field Group: Added pre-rendering CSS for field groups with labels on left, removing potential during admin page load
- Field Group: Renamed "Third Party" Field Groups types to "Local"
- General: Gutenberg - Fixed CSS for modal
Download this release
Release Info
Developer | hwk-fr |
Plugin | Advanced Custom Fields: Extended |
Version | 0.8.5 |
Comparing to | |
See all releases |
Code changes from version 0.8.4.6 to 0.8.5
- acf-extended.php +14 -9
- assets/acf-extended-admin.css +248 -14
- assets/acf-extended-fc-control.js +25 -3
- assets/acf-extended-fc-modal-select.js +33 -53
- assets/acf-extended-fc.css +1 -0
- assets/acf-extended-fg.css +30 -1
- assets/acf-extended-fg.js +23 -8
- assets/acf-extended-fields.js +491 -257
- assets/acf-extended-form.js +46 -0
- assets/acf-extended-modal.css +27 -2
- assets/acf-extended.css +325 -0
- assets/acf-extended.js +21 -10
- includes/admin/tools/dbt-export.php +5 -4
- includes/admin/tools/dbt-import.php +3 -3
- includes/admin/tools/dop-export.php +4 -4
- includes/admin/tools/dop-import.php +3 -3
- includes/admin/tools/dpt-export.php +5 -4
- includes/admin/tools/dpt-import.php +3 -3
- includes/admin/tools/dt-export.php +4 -3
- includes/admin/tools/dt-import.php +3 -3
- includes/admin/tools/form-export.php +3 -3
- includes/admin/tools/form-import.php +392 -82
- includes/core/compatibility.php +61 -33
- includes/core/helpers.php +82 -0
- includes/core/settings.php +387 -0
- includes/core/upgrades.php +564 -0
- includes/field-groups/field-group.php +30 -5
- includes/field-groups/{field-groups-third-party.php → field-groups-local.php} +15 -9
- includes/field-groups/field-groups.php +29 -13
- includes/fields-settings/data.php +80 -57
- includes/fields-settings/fields.php +15 -17
- includes/fields-settings/settings.php +489 -416
- includes/fields-settings/validation.php +2 -2
- includes/fields/field-advanced-link.php +262 -91
- includes/fields/field-code-editor.php +14 -2
- includes/fields/field-file.php +8 -4
- includes/fields/field-flexible-content.php +55 -12
- includes/fields/field-image.php +8 -4
- includes/fields/field-post-statuses.php +120 -102
- includes/fields/field-post-types.php +121 -102
- includes/fields/field-select.php +193 -25
- includes/fields/field-taxonomies.php +120 -102
- includes/fields/field-taxonomy-terms.php +32 -1
- includes/fields/field-user-roles.php +109 -99
- includes/modules/author.php +1 -1
- includes/modules/dev.php +3 -8
- includes/modules/dynamic-block-type.php +10 -9
- includes/modules/dynamic-form.php +1 -3
- includes/modules/dynamic-options-page.php +8 -7
- includes/modules/dynamic-post-type.php +45 -18
- includes/modules/dynamic-taxonomy.php +27 -17
- includes/modules/form/actions/custom.php +168 -1
- includes/modules/form/actions/email.php +223 -28
- includes/modules/form/actions/option.php +0 -101
- includes/modules/form/actions/post.php +438 -337
- includes/modules/form/actions/term.php +166 -175
- includes/modules/form/actions/user.php +599 -361
- includes/modules/form/admin.php +1925 -997
- includes/modules/form/field-group.php +2023 -1457
- includes/modules/form/form-front.php +195 -74
- init.php +84 -74
- readme.txt +82 -21
acf-extended.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: Enhancement Suite which improves Advanced Custom Fields administration
|
5 |
-
* Version: 0.8.
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
@@ -16,7 +16,7 @@ if(!class_exists('ACFE')):
|
|
16 |
class ACFE{
|
17 |
|
18 |
// Version
|
19 |
-
var $version = '0.8.
|
20 |
|
21 |
// Settings
|
22 |
var $settings = array();
|
@@ -100,9 +100,11 @@ class ACFE{
|
|
100 |
// Tools
|
101 |
add_action('acf/include_admin_tools', array($this, 'tools'));
|
102 |
|
103 |
-
//
|
|
|
104 |
acfe_include('includes/core/compatibility.php');
|
105 |
-
|
|
|
106 |
}
|
107 |
|
108 |
/**
|
@@ -153,7 +155,7 @@ class ACFE{
|
|
153 |
acfe_include('includes/field-groups/field-group.php');
|
154 |
acfe_include('includes/field-groups/field-group-category.php');
|
155 |
acfe_include('includes/field-groups/field-groups.php');
|
156 |
-
acfe_include('includes/field-groups/field-groups-
|
157 |
|
158 |
/**
|
159 |
* Locations
|
@@ -229,10 +231,13 @@ class ACFE{
|
|
229 |
acfe_include('includes/admin/tools/fg-export.php');
|
230 |
|
231 |
}
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
|
|
|
|
|
|
236 |
function define($name, $value = true){
|
237 |
|
238 |
if(!defined($name))
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: Enhancement Suite which improves Advanced Custom Fields administration
|
5 |
+
* Version: 0.8.5
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
16 |
class ACFE{
|
17 |
|
18 |
// Version
|
19 |
+
var $version = '0.8.5';
|
20 |
|
21 |
// Settings
|
22 |
var $settings = array();
|
100 |
// Tools
|
101 |
add_action('acf/include_admin_tools', array($this, 'tools'));
|
102 |
|
103 |
+
// Additional
|
104 |
+
acfe_include('includes/core/settings.php');
|
105 |
acfe_include('includes/core/compatibility.php');
|
106 |
+
acfe_include('includes/core/upgrades.php');
|
107 |
+
|
108 |
}
|
109 |
|
110 |
/**
|
155 |
acfe_include('includes/field-groups/field-group.php');
|
156 |
acfe_include('includes/field-groups/field-group-category.php');
|
157 |
acfe_include('includes/field-groups/field-groups.php');
|
158 |
+
acfe_include('includes/field-groups/field-groups-local.php');
|
159 |
|
160 |
/**
|
161 |
* Locations
|
231 |
acfe_include('includes/admin/tools/fg-export.php');
|
232 |
|
233 |
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* ACFE: Define
|
237 |
+
*
|
238 |
+
* @param $name
|
239 |
+
* @param bool $value
|
240 |
+
*/
|
241 |
function define($name, $value = true){
|
242 |
|
243 |
if(!defined($name))
|
assets/acf-extended-admin.css
CHANGED
@@ -1,25 +1,60 @@
|
|
1 |
/*
|
2 |
* ACFE General
|
3 |
*/
|
|
|
|
|
|
|
|
|
|
|
4 |
pre{
|
5 |
display: block;
|
6 |
padding: 9.5px;
|
7 |
margin: 0;
|
8 |
-
font-size: 13px;
|
9 |
line-height: 1.42857143;
|
10 |
color: #333;
|
11 |
word-break: break-all;
|
12 |
word-wrap: break-word;
|
13 |
-
background-color: #
|
14 |
border: 1px solid #ccc;
|
15 |
border-radius: 1px;
|
16 |
white-space: pre-wrap;
|
17 |
overflow: auto;
|
18 |
}
|
19 |
|
20 |
-
code
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
|
25 |
/*
|
@@ -44,6 +79,128 @@ code, kbd, pre, samp{
|
|
44 |
display:none;
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
/*
|
48 |
* ACFE: Dynamic Post Type 'Setting' Button
|
49 |
*/
|
@@ -169,7 +326,7 @@ body.post-type-acfe-form.post-new-php #major-publishing-actions{
|
|
169 |
#acf-admin-tool-acfe_tool_dbt_export ul,
|
170 |
#acf-admin-tool-acfe_tool_dpt_export ul,
|
171 |
#acf-admin-tool-acfe_tool_dt_export ul,
|
172 |
-
#acf-admin-tool-
|
173 |
column-width: 200px;
|
174 |
}
|
175 |
|
@@ -225,9 +382,23 @@ body.post-type-acfe-form.post-new-php #major-publishing-actions{
|
|
225 |
border-left-width:0;
|
226 |
}
|
227 |
|
228 |
-
.acf-field-repeater.acf-field-acfe-form-email-files > .acf-input > .acf-repeater > .acf-actions
|
|
|
229 |
text-align:left;
|
230 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
/*
|
233 |
* ACFE Dev Mode
|
@@ -260,28 +431,56 @@ body:not(.acf-admin-5-3) .select2-container .select2-search--inline .select2-sea
|
|
260 |
margin-top:0px !important;
|
261 |
}
|
262 |
|
|
|
263 |
.select2-container .select2-selection--single{
|
264 |
border-radius:3px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
}
|
266 |
|
267 |
.select2-container .select2-selection--single .select2-selection__rendered{
|
268 |
font-size:14px;
|
269 |
-
height:
|
270 |
-
line-height:
|
|
|
271 |
}
|
272 |
|
273 |
.select2-container .select2-selection--single .select2-selection__clear{
|
274 |
-
line-height:
|
275 |
-
height:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
}
|
277 |
|
278 |
.select2-container .select2-search--inline .select2-search__field{
|
279 |
-
margin-top:
|
280 |
font-size:14px !important;
|
|
|
281 |
}
|
282 |
|
|
|
283 |
.select2-container .select2-selection--multiple{
|
284 |
-
min-height:
|
285 |
line-height:1;
|
286 |
border-radius:3px !important;
|
287 |
}
|
@@ -293,7 +492,7 @@ body:not(.acf-admin-5-3) .select2-container .select2-search--inline .select2-sea
|
|
293 |
.select2-container--default .select2-selection--multiple .select2-selection__choice{
|
294 |
margin-right:2px !important;
|
295 |
margin-top:2px !important;
|
296 |
-
line-height:1.
|
297 |
border-radius:3px !important;
|
298 |
font-size:14px;
|
299 |
}
|
@@ -307,6 +506,41 @@ body:not(.acf-admin-5-3) .select2-container .select2-search--inline .select2-sea
|
|
307 |
border-color:#7e8993 !important;
|
308 |
}
|
309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
/*
|
311 |
* Menu Item: Fix Modal z-index
|
312 |
*/
|
1 |
/*
|
2 |
* ACFE General
|
3 |
*/
|
4 |
+
pre, code, kbd, samp{
|
5 |
+
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
6 |
+
font-size: 1em;
|
7 |
+
}
|
8 |
+
|
9 |
pre{
|
10 |
display: block;
|
11 |
padding: 9.5px;
|
12 |
margin: 0;
|
|
|
13 |
line-height: 1.42857143;
|
14 |
color: #333;
|
15 |
word-break: break-all;
|
16 |
word-wrap: break-word;
|
17 |
+
background-color: #f9f9f9;
|
18 |
border: 1px solid #ccc;
|
19 |
border-radius: 1px;
|
20 |
white-space: pre-wrap;
|
21 |
overflow: auto;
|
22 |
}
|
23 |
|
24 |
+
code{
|
25 |
+
-webkit-user-select: all;
|
26 |
+
-moz-user-select: all;
|
27 |
+
-ms-user-select: all;
|
28 |
+
user-select: all;
|
29 |
+
}
|
30 |
+
|
31 |
+
.pre-codemirror > .CodeMirror,
|
32 |
+
.code-codemirror > .CodeMirror{
|
33 |
+
border:1px solid #ccc;
|
34 |
+
height:auto;
|
35 |
+
width:auto;
|
36 |
+
background:#F9F9F9;
|
37 |
+
padding:9px 6px;
|
38 |
+
}
|
39 |
+
|
40 |
+
.code-codemirror{
|
41 |
+
display:inline;
|
42 |
+
vertical-align:middle;
|
43 |
+
}
|
44 |
+
|
45 |
+
.code-codemirror > .CodeMirror{
|
46 |
+
display:inline-block;
|
47 |
+
padding:0;
|
48 |
+
}
|
49 |
+
|
50 |
+
.pre-codemirror > .CodeMirror .CodeMirror-selected,
|
51 |
+
.code-codemirror > .CodeMirror .CodeMirror-selected{
|
52 |
+
background:#ddd !important;
|
53 |
+
}
|
54 |
+
|
55 |
+
.pre-codemirror > .CodeMirror .CodeMirror-lines,
|
56 |
+
.code-codemirror > .CodeMirror .CodeMirror-lines{
|
57 |
+
padding:0;
|
58 |
}
|
59 |
|
60 |
/*
|
79 |
display:none;
|
80 |
}
|
81 |
|
82 |
+
/*
|
83 |
+
* ACFE: Postbox-left
|
84 |
+
*/
|
85 |
+
.acfe-postbox-left>.inside {
|
86 |
+
position: relative
|
87 |
+
}
|
88 |
+
|
89 |
+
.acfe-postbox-left>.inside:after {
|
90 |
+
display: block;
|
91 |
+
clear: both;
|
92 |
+
content: ""
|
93 |
+
}
|
94 |
+
|
95 |
+
.acfe-postbox-left>.inside.-border {
|
96 |
+
border: #ccd0d4 solid 1px;
|
97 |
+
background: #fff
|
98 |
+
}
|
99 |
+
|
100 |
+
.acfe-postbox-left>.inside>.acf-field {
|
101 |
+
position: relative;
|
102 |
+
margin: 0;
|
103 |
+
padding: 15px 12px;
|
104 |
+
border-top: #EEEEEE solid 1px
|
105 |
+
}
|
106 |
+
|
107 |
+
.acfe-postbox-left>.inside>.acf-field:first-child {
|
108 |
+
border-top: none;
|
109 |
+
margin-top: 0
|
110 |
+
}
|
111 |
+
|
112 |
+
.acfe-postbox-left>.inside.-clear>.acf-field {
|
113 |
+
border: none;
|
114 |
+
padding: 0;
|
115 |
+
margin: 15px 0
|
116 |
+
}
|
117 |
+
|
118 |
+
.acfe-postbox-left>.inside>.acf-field {
|
119 |
+
padding: 15px 0
|
120 |
+
}
|
121 |
+
|
122 |
+
.acfe-postbox-left>.inside>.acf-field:after {
|
123 |
+
display: block;
|
124 |
+
clear: both;
|
125 |
+
content: ""
|
126 |
+
}
|
127 |
+
|
128 |
+
.acfe-postbox-left>.inside>.acf-field:before {
|
129 |
+
content: "";
|
130 |
+
display: block;
|
131 |
+
position: absolute;
|
132 |
+
z-index: 0;
|
133 |
+
background: #F9F9F9;
|
134 |
+
border-color: #E1E1E1;
|
135 |
+
border-style: solid;
|
136 |
+
border-width: 0 1px 0 0;
|
137 |
+
top: 0;
|
138 |
+
bottom: 0;
|
139 |
+
left: 0;
|
140 |
+
width: 20%
|
141 |
+
}
|
142 |
+
|
143 |
+
.acfe-postbox-left>.inside>.acf-field[data-width] {
|
144 |
+
float: none;
|
145 |
+
width: auto !important;
|
146 |
+
border-left-width: 0 !important;
|
147 |
+
border-right-width: 0 !important
|
148 |
+
}
|
149 |
+
|
150 |
+
.acfe-postbox-left>.inside>.acf-field>.acf-label {
|
151 |
+
float: left;
|
152 |
+
width: 20%;
|
153 |
+
margin: 0;
|
154 |
+
padding: 0 12px
|
155 |
+
}
|
156 |
+
|
157 |
+
.acfe-postbox-left>.inside>.acf-field>.acf-input {
|
158 |
+
float: left;
|
159 |
+
width: 80%;
|
160 |
+
margin: 0;
|
161 |
+
padding: 0 12px
|
162 |
+
}
|
163 |
+
|
164 |
+
html[dir="rtl"] .acfe-postbox-left>.inside>.acf-field:before {
|
165 |
+
border-width: 0 0 0 1px;
|
166 |
+
left: auto;
|
167 |
+
right: 0
|
168 |
+
}
|
169 |
+
|
170 |
+
html[dir="rtl"] .acfe-postbox-left>.inside>.acf-field>.acf-label {
|
171 |
+
float: right
|
172 |
+
}
|
173 |
+
|
174 |
+
html[dir="rtl"] .acfe-postbox-left>.inside>.acf-field>.acf-input {
|
175 |
+
float: right
|
176 |
+
}
|
177 |
+
|
178 |
+
#side-sortables .acfe-postbox-left>.inside>.acf-field:before {
|
179 |
+
display: none
|
180 |
+
}
|
181 |
+
|
182 |
+
#side-sortables .acfe-postbox-left>.inside>.acf-field>.acf-label {
|
183 |
+
width: 100%;
|
184 |
+
margin-bottom: 10px
|
185 |
+
}
|
186 |
+
|
187 |
+
#side-sortables .acfe-postbox-left>.inside>.acf-field>.acf-input {
|
188 |
+
width: 100%
|
189 |
+
}
|
190 |
+
|
191 |
+
@media screen and (max-width: 640px) {
|
192 |
+
.acfe-postbox-left>.inside>.acf-field:before {
|
193 |
+
display: none
|
194 |
+
}
|
195 |
+
.acfe-postbox-left>.inside>.acf-field>.acf-label {
|
196 |
+
width: 100%;
|
197 |
+
margin-bottom: 10px
|
198 |
+
}
|
199 |
+
.acfe-postbox-left>.inside>.acf-field>.acf-input {
|
200 |
+
width: 100%
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
/*
|
205 |
* ACFE: Dynamic Post Type 'Setting' Button
|
206 |
*/
|
326 |
#acf-admin-tool-acfe_tool_dbt_export ul,
|
327 |
#acf-admin-tool-acfe_tool_dpt_export ul,
|
328 |
#acf-admin-tool-acfe_tool_dt_export ul,
|
329 |
+
#acf-admin-tool-acfe_tool_form_export ul{
|
330 |
column-width: 200px;
|
331 |
}
|
332 |
|
382 |
border-left-width:0;
|
383 |
}
|
384 |
|
385 |
+
.acf-field-repeater.acf-field-acfe-form-email-files > .acf-input > .acf-repeater > .acf-actions,
|
386 |
+
.acf-field-repeater.acf-field-acfe-form-email-files-static > .acf-input > .acf-repeater > .acf-actions{
|
387 |
text-align:left;
|
388 |
}
|
389 |
+
/*
|
390 |
+
.acf-field[data-name="acfe_form_actions"] > .acf-label{
|
391 |
+
display:none;
|
392 |
+
}
|
393 |
+
|
394 |
+
.acf-field[data-name="acfe_form_actions"] > .acf-input{
|
395 |
+
width:100% !important;
|
396 |
+
}
|
397 |
+
|
398 |
+
.acf-field[data-name="acfe_form_actions"]:before{
|
399 |
+
background:none !important;
|
400 |
+
border:0 !important;
|
401 |
+
}*/
|
402 |
|
403 |
/*
|
404 |
* ACFE Dev Mode
|
431 |
margin-top:0px !important;
|
432 |
}
|
433 |
|
434 |
+
/* Select2: Single */
|
435 |
.select2-container .select2-selection--single{
|
436 |
border-radius:3px !important;
|
437 |
+
height:30px !important;
|
438 |
+
outline:none;
|
439 |
+
}
|
440 |
+
|
441 |
+
.select2-container:focus .select2-selection--single,
|
442 |
+
.select2-container.select2-container--open .select2-selection--single{
|
443 |
+
border-color: #007cba !important;
|
444 |
+
color: #016087 !important;
|
445 |
+
box-shadow: 0 0 0 1px #007cba !important;
|
446 |
}
|
447 |
|
448 |
.select2-container .select2-selection--single .select2-selection__rendered{
|
449 |
font-size:14px;
|
450 |
+
height:28px;
|
451 |
+
line-height: 27px !important;
|
452 |
+
padding-right:23px !important;
|
453 |
}
|
454 |
|
455 |
.select2-container .select2-selection--single .select2-selection__clear{
|
456 |
+
line-height:26px;
|
457 |
+
height:28px;
|
458 |
+
font-size:16px;
|
459 |
+
}
|
460 |
+
|
461 |
+
.select2-container--default .select2-selection--single .select2-selection__arrow{
|
462 |
+
height: 28px !important;
|
463 |
+
}
|
464 |
+
|
465 |
+
.select2-container--default .select2-selection--single .select2-selection__arrow b{
|
466 |
+
background: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E') no-repeat;
|
467 |
+
background-size: 16px 16px;
|
468 |
+
border:0 !important;
|
469 |
+
width:16px !important;
|
470 |
+
height:16px !important;
|
471 |
+
margin-left: -11px !important;
|
472 |
+
margin-top: -7px !important;
|
473 |
}
|
474 |
|
475 |
.select2-container .select2-search--inline .select2-search__field{
|
476 |
+
margin-top:4px !important;
|
477 |
font-size:14px !important;
|
478 |
+
padding-left: 2px !important;
|
479 |
}
|
480 |
|
481 |
+
/* Select2: Multiple */
|
482 |
.select2-container .select2-selection--multiple{
|
483 |
+
min-height: 30px !important;
|
484 |
line-height:1;
|
485 |
border-radius:3px !important;
|
486 |
}
|
492 |
.select2-container--default .select2-selection--multiple .select2-selection__choice{
|
493 |
margin-right:2px !important;
|
494 |
margin-top:2px !important;
|
495 |
+
line-height:1.6;
|
496 |
border-radius:3px !important;
|
497 |
font-size:14px;
|
498 |
}
|
506 |
border-color:#7e8993 !important;
|
507 |
}
|
508 |
|
509 |
+
.select2-container--default .select2-selection--multiple .select2-selection__clear{
|
510 |
+
margin-top: 5px !important;
|
511 |
+
margin-right: 5px !important;
|
512 |
+
font-size: 16px;
|
513 |
+
}
|
514 |
+
|
515 |
+
/*
|
516 |
+
* ACF Field: Tab Badge
|
517 |
+
*/
|
518 |
+
.acf-tab-group li a .acfe-tab-badge{
|
519 |
+
border-radius: 100px;
|
520 |
+
background: #ddd;
|
521 |
+
width: 18px;
|
522 |
+
height: 18px;
|
523 |
+
font-size: 12px;
|
524 |
+
display: inline-block;
|
525 |
+
vertical-align: text-bottom;
|
526 |
+
padding: 0;
|
527 |
+
text-align: center;
|
528 |
+
margin-left: 5px;
|
529 |
+
line-height: 18px;
|
530 |
+
}
|
531 |
+
|
532 |
+
.acf-tab-group li.active a .acfe-tab-badge,
|
533 |
+
.acf-tab-group li a:hover .acfe-tab-badge{
|
534 |
+
background: #f1f1f1;
|
535 |
+
}
|
536 |
+
|
537 |
+
/*
|
538 |
+
* ACF Field: Select2 WPML Fix
|
539 |
+
*/
|
540 |
+
.acf-field > .acf-input > .select2 .select2-search{
|
541 |
+
width:auto;
|
542 |
+
}
|
543 |
+
|
544 |
/*
|
545 |
* Menu Item: Fix Modal z-index
|
546 |
*/
|
assets/acf-extended-fc-control.js
CHANGED
@@ -504,6 +504,27 @@
|
|
504 |
|
505 |
// trigger change for validation errors
|
506 |
this.$input().trigger('change');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
|
508 |
// return
|
509 |
return $el;
|
@@ -644,7 +665,8 @@
|
|
644 |
$input.find('> .acf-input select').removeAttr('tabindex aria-hidden');
|
645 |
|
646 |
});
|
647 |
-
|
|
|
648 |
// Clean Tab
|
649 |
$layout.find('.acf-tab-wrap').each(function(){
|
650 |
|
@@ -652,7 +674,7 @@
|
|
652 |
|
653 |
var $content = $wrap.closest('.acf-fields');
|
654 |
|
655 |
-
var tabs = []
|
656 |
$.each($wrap.find('li a'), function(){
|
657 |
|
658 |
tabs.push($(this));
|
@@ -667,7 +689,7 @@
|
|
667 |
|
668 |
var $this = $(this);
|
669 |
|
670 |
-
if($this.attr('data-key')
|
671 |
return;
|
672 |
|
673 |
$current_tab.find('> .acf-input').append($this);
|
504 |
|
505 |
// trigger change for validation errors
|
506 |
this.$input().trigger('change');
|
507 |
+
|
508 |
+
// Fix tabs conditionally hidden
|
509 |
+
var tabs = acf.getFields({
|
510 |
+
type: 'tab',
|
511 |
+
parent: $el,
|
512 |
+
});
|
513 |
+
|
514 |
+
if(tabs.length){
|
515 |
+
|
516 |
+
$.each(tabs, function(){
|
517 |
+
|
518 |
+
if(this.$el.hasClass('acf-hidden')){
|
519 |
+
|
520 |
+
this.tab.$el.addClass('acf-hidden');
|
521 |
+
|
522 |
+
}
|
523 |
+
|
524 |
+
});
|
525 |
+
|
526 |
+
}
|
527 |
+
|
528 |
|
529 |
// return
|
530 |
return $el;
|
665 |
$input.find('> .acf-input select').removeAttr('tabindex aria-hidden');
|
666 |
|
667 |
});
|
668 |
+
|
669 |
+
|
670 |
// Clean Tab
|
671 |
$layout.find('.acf-tab-wrap').each(function(){
|
672 |
|
674 |
|
675 |
var $content = $wrap.closest('.acf-fields');
|
676 |
|
677 |
+
var tabs = [];
|
678 |
$.each($wrap.find('li a'), function(){
|
679 |
|
680 |
tabs.push($(this));
|
689 |
|
690 |
var $this = $(this);
|
691 |
|
692 |
+
if($this.attr('data-key') !== $current_tab.attr('data-key'))
|
693 |
return;
|
694 |
|
695 |
$current_tab.find('> .acf-input').append($this);
|
assets/acf-extended-fc-modal-select.js
CHANGED
@@ -35,6 +35,21 @@
|
|
35 |
array: [],
|
36 |
html: ''
|
37 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
// Get Categories
|
40 |
$(layouts).find('li a span').each(function(){
|
@@ -45,32 +60,15 @@
|
|
45 |
return true;
|
46 |
|
47 |
var category = $link.data('acfe-flexible-category');
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
var cats = category.split('|');
|
53 |
-
|
54 |
-
$(cats).each(function(i, c){
|
55 |
-
|
56 |
-
if(categories.array.indexOf(c) != -1)
|
57 |
-
return true;
|
58 |
-
|
59 |
-
categories.array.push(c);
|
60 |
-
|
61 |
-
});
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
// Without pipes
|
66 |
-
else{
|
67 |
-
|
68 |
-
if(categories.array.indexOf(category) != -1)
|
69 |
return true;
|
70 |
-
|
71 |
-
categories.array.push(
|
72 |
-
|
73 |
-
}
|
74 |
|
75 |
});
|
76 |
|
@@ -199,36 +197,18 @@
|
|
199 |
|
200 |
// Hide All
|
201 |
$span.closest('li').hide();
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
$(cats).each(function(i, c){
|
209 |
-
|
210 |
-
if(selected_category === c){
|
211 |
-
|
212 |
-
$span.closest('li').show();
|
213 |
-
|
214 |
-
return false;
|
215 |
-
|
216 |
-
}
|
217 |
-
|
218 |
-
});
|
219 |
-
|
220 |
-
}
|
221 |
-
|
222 |
-
// Without pipes
|
223 |
-
else{
|
224 |
-
|
225 |
-
if(selected_category === category){
|
226 |
-
|
227 |
$span.closest('li').show();
|
228 |
-
|
|
|
|
|
229 |
}
|
230 |
-
|
231 |
-
}
|
232 |
|
233 |
}
|
234 |
|
35 |
array: [],
|
36 |
html: ''
|
37 |
};
|
38 |
+
|
39 |
+
function SearchArray(element, array){
|
40 |
+
|
41 |
+
var len = array.length,
|
42 |
+
str = element.toString().toLowerCase();
|
43 |
+
|
44 |
+
for(var i = 0; i < len; i++){
|
45 |
+
if(array[i].toLowerCase() === str){
|
46 |
+
return i;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
return -1;
|
51 |
+
|
52 |
+
}
|
53 |
|
54 |
// Get Categories
|
55 |
$(layouts).find('li a span').each(function(){
|
60 |
return true;
|
61 |
|
62 |
var category = $link.data('acfe-flexible-category');
|
63 |
+
|
64 |
+
$.each(category, function(i, c){
|
65 |
+
|
66 |
+
if(SearchArray(c, categories.array) !== -1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
return true;
|
68 |
+
|
69 |
+
categories.array.push(c);
|
70 |
+
|
71 |
+
});
|
72 |
|
73 |
});
|
74 |
|
197 |
|
198 |
// Hide All
|
199 |
$span.closest('li').hide();
|
200 |
+
|
201 |
+
$.each(category, function(i, c){
|
202 |
+
|
203 |
+
if(selected_category.toLowerCase() === c.toLowerCase()){
|
204 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
$span.closest('li').show();
|
206 |
+
|
207 |
+
return false;
|
208 |
+
|
209 |
}
|
210 |
+
|
211 |
+
});
|
212 |
|
213 |
}
|
214 |
|
assets/acf-extended-fc.css
CHANGED
@@ -214,6 +214,7 @@ body:not(.acf-admin-5-3) .layout > .acfe-fc-placeholder > a span{
|
|
214 |
border-top:1px solid #e1e1e1;
|
215 |
padding:12px;
|
216 |
text-align:right;
|
|
|
217 |
}
|
218 |
|
219 |
/*
|
214 |
border-top:1px solid #e1e1e1;
|
215 |
padding:12px;
|
216 |
text-align:right;
|
217 |
+
clear:both;
|
218 |
}
|
219 |
|
220 |
/*
|
assets/acf-extended-fg.css
CHANGED
@@ -2,6 +2,9 @@
|
|
2 |
.acf-field-setting-acfe_settings > .acf-input > .acf-fields,
|
3 |
.acf-field-setting-acfe_validate > .acf-input > .acf-fields,
|
4 |
.acf-field-setting-acfe_update > .acf-input > .acf-fields,
|
|
|
|
|
|
|
5 |
|
6 |
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields,
|
7 |
.acf-field-setting-acfe_settings > .acf-input > .acf-fields > .acf-field.acf-field-acfe-settings-rules-or,
|
@@ -14,14 +17,40 @@
|
|
14 |
.acf-field-setting-acfe_permissions > .acf-input > .acf-fields > .acf-field,
|
15 |
.acf-field-setting-acfe_settings > .acf-input > .acf-fields > .acf-field,
|
16 |
.acf-field-setting-acfe_validate > .acf-input > .acf-fields > .acf-field,
|
17 |
-
.acf-field-setting-acfe_update > .acf-input > .acf-fields > .acf-field
|
|
|
|
|
18 |
padding:0;
|
19 |
}
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
.acf-field-setting-acfe_field_data{
|
22 |
display:none;
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields > .acf-field.acf-field-acfe-bidirectional-enabled > .acf-label,
|
26 |
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields > .acf-field.acf-field-acfe-bidirectional-related > .acf-label,
|
27 |
.acf-field-setting-acfe_settings > .acf-input > .acf-fields > .acf-field.acf-field-acfe-settings-activate > .acf-label,
|
2 |
.acf-field-setting-acfe_settings > .acf-input > .acf-fields,
|
3 |
.acf-field-setting-acfe_validate > .acf-input > .acf-fields,
|
4 |
.acf-field-setting-acfe_update > .acf-input > .acf-fields,
|
5 |
+
.acf-field-setting-acfe_google_map_zooms > .acf-input > .acf-fields,
|
6 |
+
.acf-field-setting-acfe_hide > .acf-input > .acf-fields,
|
7 |
+
.acf-field-setting-acfe_wysiwyg_toolbar_buttons > .acf-input > .acf-fields,
|
8 |
|
9 |
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields,
|
10 |
.acf-field-setting-acfe_settings > .acf-input > .acf-fields > .acf-field.acf-field-acfe-settings-rules-or,
|
17 |
.acf-field-setting-acfe_permissions > .acf-input > .acf-fields > .acf-field,
|
18 |
.acf-field-setting-acfe_settings > .acf-input > .acf-fields > .acf-field,
|
19 |
.acf-field-setting-acfe_validate > .acf-input > .acf-fields > .acf-field,
|
20 |
+
.acf-field-setting-acfe_update > .acf-input > .acf-fields > .acf-field,
|
21 |
+
.acf-field-setting-acfe_google_map_zooms > .acf-input > .acf-fields > .acf-field,
|
22 |
+
.acf-field-setting-acfe_hide > .acf-input > .acf-fields > .acf-field{
|
23 |
padding:0;
|
24 |
}
|
25 |
|
26 |
+
|
27 |
+
.acf-field-setting-acfe_wysiwyg_toolbar_buttons > .acf-input > .acf-fields{
|
28 |
+
margin-left:-12px;
|
29 |
+
margin-right:-12px;
|
30 |
+
}
|
31 |
+
|
32 |
+
.acf-field-setting-acfe_wysiwyg_toolbar_buttons > .acf-input > .acf-fields .acf-actions{
|
33 |
+
text-align:left;
|
34 |
+
}
|
35 |
+
|
36 |
+
.acf-field-setting-acfe_wysiwyg_toolbar_buttons > .acf-input > .acf-fields > .acf-field{
|
37 |
+
padding-top:0;
|
38 |
+
padding-bottom:0;
|
39 |
+
border:0;
|
40 |
+
}
|
41 |
+
|
42 |
.acf-field-setting-acfe_field_data{
|
43 |
display:none;
|
44 |
}
|
45 |
|
46 |
+
.acf-field-setting-acfe_google_map_zooms > .acf-input > .acf-fields > .acf-field{
|
47 |
+
border-left:0;
|
48 |
+
}
|
49 |
+
|
50 |
+
.acf-field-hide-front.acfe_width_auto{
|
51 |
+
margin-right:30px;
|
52 |
+
}
|
53 |
+
|
54 |
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields > .acf-field.acf-field-acfe-bidirectional-enabled > .acf-label,
|
55 |
.acf-field-setting-acfe_bidirectional > .acf-input > .acf-fields > .acf-field.acf-field-acfe-bidirectional-related > .acf-label,
|
56 |
.acf-field-setting-acfe_settings > .acf-input > .acf-fields > .acf-field.acf-field-acfe-settings-activate > .acf-label,
|
assets/acf-extended-fg.js
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
if(typeof acf === 'undefined')
|
4 |
return;
|
5 |
-
|
6 |
-
|
7 |
* ACF Extended: 0.8.4.5
|
8 |
* Field Flexible Content: Fix duplicated "layout_settings" & "layout_title"
|
9 |
*/
|
@@ -16,9 +16,25 @@
|
|
16 |
field.delete();
|
17 |
|
18 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
$(function(){
|
21 |
-
|
|
|
|
|
|
|
22 |
$('.button.edit-field').each(function(k, v){
|
23 |
|
24 |
var tbody = $(this).closest('tbody');
|
@@ -42,12 +58,11 @@
|
|
42 |
});
|
43 |
|
44 |
});
|
45 |
-
|
|
|
|
|
|
|
46 |
$('.acf-field[data-name="active"]').after($('.acf-field[data-name="acfe_form"]'));
|
47 |
-
|
48 |
-
$('.acf-field-setting-acfe_settings > .acf-input > .acf-repeater .acf-actions .acf-button').removeClass('button-primary');
|
49 |
-
$('.acf-field-setting-acfe_validate > .acf-input > .acf-repeater .acf-actions .acf-button').removeClass('button-primary');
|
50 |
-
$('.acf-field-acfe-meta > .acf-input > .acf-repeater .acf-actions .acf-button').removeClass('button-primary');
|
51 |
|
52 |
});
|
53 |
|
2 |
|
3 |
if(typeof acf === 'undefined')
|
4 |
return;
|
5 |
+
|
6 |
+
/*
|
7 |
* ACF Extended: 0.8.4.5
|
8 |
* Field Flexible Content: Fix duplicated "layout_settings" & "layout_title"
|
9 |
*/
|
16 |
field.delete();
|
17 |
|
18 |
});
|
19 |
+
|
20 |
+
/*
|
21 |
+
* Field: WYSIWYG
|
22 |
+
*/
|
23 |
+
var acfe_repeater_remove_primary_class = function(field){
|
24 |
+
|
25 |
+
field.$('.acf-button').removeClass('button-primary');
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
acf.addAction('new_field/name=acfe_meta', acfe_repeater_remove_primary_class);
|
30 |
+
acf.addAction('new_field/name=acfe_settings', acfe_repeater_remove_primary_class);
|
31 |
+
acf.addAction('new_field/name=acfe_validate', acfe_repeater_remove_primary_class);
|
32 |
|
33 |
$(function(){
|
34 |
+
|
35 |
+
/*
|
36 |
+
* Field Setting: Data
|
37 |
+
*/
|
38 |
$('.button.edit-field').each(function(k, v){
|
39 |
|
40 |
var tbody = $(this).closest('tbody');
|
58 |
});
|
59 |
|
60 |
});
|
61 |
+
|
62 |
+
/*
|
63 |
+
* Field Group: Advanced Settings
|
64 |
+
*/
|
65 |
$('.acf-field[data-name="active"]').after($('.acf-field[data-name="acfe_form"]'));
|
|
|
|
|
|
|
|
|
66 |
|
67 |
});
|
68 |
|
assets/acf-extended-fields.js
CHANGED
@@ -22,97 +22,97 @@ function acfe_recaptcha(){
|
|
22 |
|
23 |
if(typeof acf === 'undefined')
|
24 |
return;
|
25 |
-
|
26 |
/**
|
27 |
* Field: reCaptcha
|
28 |
*/
|
29 |
var reCaptcha = acf.Field.extend({
|
30 |
-
|
31 |
type: 'acfe_recaptcha',
|
32 |
-
|
33 |
actions: {
|
34 |
'validation_failure' : 'validationFailure'
|
35 |
},
|
36 |
-
|
37 |
$control: function(){
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
version: function(){
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
render: function(){
|
58 |
-
|
59 |
var field = this;
|
60 |
-
|
61 |
if(this.version() === 'v2'){
|
62 |
-
|
63 |
-
this.recaptcha = grecaptcha.render(
|
64 |
-
'sitekey':
|
65 |
-
'theme':
|
66 |
-
'size':
|
67 |
-
|
68 |
-
|
69 |
'callback': function(response){
|
70 |
-
|
71 |
field.$input().val(response).change();
|
72 |
field.$input().closest('.acf-input').find('> .acf-notice.-error').hide();
|
73 |
-
|
74 |
},
|
75 |
-
|
76 |
'error-callback': function(){
|
77 |
-
|
78 |
field.$input().val('error').change();
|
79 |
-
|
80 |
},
|
81 |
-
|
82 |
'expired-callback': function(){
|
83 |
-
|
84 |
field.$input().val('expired').change();
|
85 |
-
|
86 |
}
|
87 |
});
|
88 |
-
|
89 |
}
|
90 |
-
|
91 |
else if(this.version() === 'v3'){
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
field.$input().closest('.acf-input').find('> .acf-notice.-error').hide();
|
100 |
-
|
101 |
-
});
|
102 |
});
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
}
|
107 |
-
|
108 |
},
|
109 |
-
|
110 |
validationFailure: function($form){
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
-
|
116 |
});
|
117 |
|
118 |
acf.registerFieldType(reCaptcha);
|
@@ -156,10 +156,12 @@ function acfe_recaptcha(){
|
|
156 |
|
157 |
initialize: function(){
|
158 |
|
159 |
-
this.rows = this.$
|
|
|
|
|
160 |
this.mode = this.$control().data('mode');
|
161 |
this.lines = this.$control().data('lines');
|
162 |
-
this.indentUnit = this.$control().data('
|
163 |
|
164 |
var codeEditor = [];
|
165 |
|
@@ -195,9 +197,19 @@ function acfe_recaptcha(){
|
|
195 |
// Init WP Code Editor
|
196 |
this.editor = wp.codeEditor.initialize(this.input(), codeEditor);
|
197 |
|
198 |
-
if(this.rows){
|
199 |
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
this.editor.codemirror.refresh();
|
203 |
|
@@ -208,6 +220,7 @@ function acfe_recaptcha(){
|
|
208 |
this.editor.codemirror.on('change', function(){
|
209 |
|
210 |
field.editor.codemirror.save();
|
|
|
211 |
|
212 |
});
|
213 |
|
@@ -234,6 +247,113 @@ function acfe_recaptcha(){
|
|
234 |
acf.registerConditionForFieldType('hasValue', 'acfe_code_editor');
|
235 |
acf.registerConditionForFieldType('hasNoValue', 'acfe_code_editor');
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
/**
|
238 |
* Field: Textarea
|
239 |
*/
|
@@ -406,9 +526,7 @@ function acfe_recaptcha(){
|
|
406 |
},
|
407 |
|
408 |
initialize: function(){
|
409 |
-
|
410 |
-
this.on('change', '.input-post', this.onPostChange);
|
411 |
-
|
412 |
},
|
413 |
|
414 |
getValue: function(){
|
@@ -419,6 +537,7 @@ function acfe_recaptcha(){
|
|
419 |
title: this.$('.input-title').val(),
|
420 |
url: this.$('.input-url').val(),
|
421 |
post: this.$('.input-post :selected').text(),
|
|
|
422 |
target: this.$('.input-target').is(':checked')
|
423 |
};
|
424 |
|
@@ -426,6 +545,10 @@ function acfe_recaptcha(){
|
|
426 |
|
427 |
data.url = data.post;
|
428 |
|
|
|
|
|
|
|
|
|
429 |
}
|
430 |
|
431 |
return data;
|
@@ -468,6 +591,7 @@ function acfe_recaptcha(){
|
|
468 |
this.$('.input-target').prop('checked', false);
|
469 |
this.$('.input-url').val('').trigger('change');
|
470 |
this.$('.input-post').val('').trigger('change');
|
|
|
471 |
|
472 |
}
|
473 |
|
@@ -509,18 +633,48 @@ function acfe_recaptcha(){
|
|
509 |
this.setValue(val);
|
510 |
|
511 |
},
|
512 |
-
|
513 |
-
onPostChange: function(e){
|
514 |
-
|
515 |
-
var $el = $(this);
|
516 |
-
var model = acf.getInstance($el.closest('.acf-field-acfe-advanced-link'));
|
517 |
-
|
518 |
-
},
|
519 |
|
520 |
});
|
521 |
|
522 |
acf.registerFieldType(ACFE_Advanced_Link);
|
523 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
/**
|
525 |
* Field: Group
|
526 |
*/
|
@@ -709,10 +863,7 @@ function acfe_recaptcha(){
|
|
709 |
/**
|
710 |
* Field: Taxonomy Terms - Ajax
|
711 |
*/
|
712 |
-
acf.addFilter('select2_ajax_data', function(ajaxData, data, $el, field, select){
|
713 |
-
|
714 |
-
if(ajaxData.action !== 'acfe/fields/taxonomy_terms/allow_query')
|
715 |
-
return ajaxData;
|
716 |
|
717 |
// Taxonomies
|
718 |
var $taxonomies = $el.closest('.acf-field-settings').find('> .acf-field-setting-taxonomy > .acf-input > select > option:selected');
|
@@ -735,70 +886,206 @@ function acfe_recaptcha(){
|
|
735 |
});
|
736 |
|
737 |
/**
|
738 |
-
* Field:
|
739 |
*/
|
740 |
-
acf.
|
741 |
-
|
742 |
-
if(field.get('key') !== 'post' || field.get('type') !== 'post_object')
|
743 |
-
return ajaxData;
|
744 |
|
745 |
-
|
|
|
|
|
|
|
746 |
|
747 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
748 |
|
749 |
-
|
750 |
|
751 |
});
|
752 |
|
753 |
/**
|
754 |
-
* Field:
|
755 |
*/
|
756 |
-
acf.addFilter('select2_args', function(options, $select,
|
757 |
-
|
758 |
-
if(field.get('type') !== 'post_object' || !field.get('acfeAllowCustom'))
|
759 |
-
return options;
|
760 |
-
|
761 |
-
options.tags = true;
|
762 |
|
763 |
-
|
764 |
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
|
784 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
785 |
|
786 |
-
|
787 |
-
|
|
|
|
|
|
|
|
|
788 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
}
|
|
|
|
|
790 |
|
791 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
792 |
|
793 |
-
|
794 |
-
|
|
|
795 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
796 |
}
|
797 |
|
798 |
return options;
|
799 |
|
800 |
});
|
801 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
802 |
/**
|
803 |
* Field: Forms
|
804 |
*/
|
@@ -879,8 +1166,8 @@ function acfe_recaptcha(){
|
|
879 |
|
880 |
var name = field.get('name');
|
881 |
var $layout = field.$el.closest('.layout');
|
882 |
-
var $message = $layout.find('.acf-field[data-name="' + name + '_message"] > .acf-input');
|
883 |
-
|
884 |
var selected = field.$input().find('option:selected').text();
|
885 |
|
886 |
if(selected.length){
|
@@ -888,148 +1175,43 @@ function acfe_recaptcha(){
|
|
888 |
}
|
889 |
|
890 |
field.$input().on('change', function(){
|
891 |
-
|
892 |
-
|
|
|
|
|
|
|
893 |
|
894 |
});
|
895 |
|
896 |
};
|
897 |
|
898 |
-
acf.addAction('new_field/name=acfe_form_post_map_target',
|
899 |
-
acf.addAction('new_field/name=acfe_form_post_map_post_type',
|
900 |
-
acf.addAction('new_field/name=acfe_form_post_map_post_status',
|
901 |
-
acf.addAction('new_field/name=acfe_form_post_map_post_title',
|
902 |
-
acf.addAction('new_field/name=acfe_form_post_map_post_name',
|
903 |
acf.addAction('new_field/name=acfe_form_post_map_post_content', acfe_form_map_fields);
|
904 |
-
acf.addAction('new_field/name=acfe_form_post_map_post_author',
|
905 |
-
acf.addAction('new_field/name=acfe_form_post_map_post_parent',
|
906 |
-
acf.addAction('new_field/name=acfe_form_post_map_post_terms',
|
907 |
|
908 |
-
acf.addAction('new_field/name=acfe_form_user_map_email',
|
909 |
-
acf.addAction('new_field/name=acfe_form_user_map_username',
|
910 |
-
acf.addAction('new_field/name=acfe_form_user_map_password',
|
911 |
-
acf.addAction('new_field/name=acfe_form_user_map_first_name',
|
912 |
-
acf.addAction('new_field/name=acfe_form_user_map_last_name',
|
913 |
-
acf.addAction('new_field/name=acfe_form_user_map_nickname',
|
914 |
acf.addAction('new_field/name=acfe_form_user_map_display_name', acfe_form_map_fields);
|
915 |
-
acf.addAction('new_field/name=acfe_form_user_map_website',
|
916 |
-
acf.addAction('new_field/name=acfe_form_user_map_description',
|
917 |
-
acf.addAction('new_field/name=acfe_form_user_map_role',
|
918 |
|
919 |
-
acf.addAction('new_field/name=acfe_form_term_map_name',
|
920 |
-
acf.addAction('new_field/name=acfe_form_term_map_slug',
|
921 |
-
acf.addAction('new_field/name=acfe_form_term_map_taxonomy',
|
922 |
-
acf.addAction('new_field/name=acfe_form_term_map_parent',
|
923 |
-
acf.addAction('new_field/name=acfe_form_term_map_description',
|
924 |
|
925 |
-
var parseString = function( val ){
|
926 |
-
return val ? '' + val : '';
|
927 |
-
};
|
928 |
-
|
929 |
-
var inArray = function( v1, array ){
|
930 |
-
|
931 |
-
// cast all values as string
|
932 |
-
array = array.map(function(v2){
|
933 |
-
return parseString(v2);
|
934 |
-
});
|
935 |
-
|
936 |
-
return (array.indexOf( v1 ) > -1);
|
937 |
-
}
|
938 |
-
|
939 |
-
/**
|
940 |
-
* Select2: Args Variations
|
941 |
-
*/
|
942 |
-
acf.addFilter('select2_args', function(options, $select, data, field, instance){
|
943 |
-
|
944 |
-
options = acf.applyFilters('select2_args/type=' + field.get('type'), options, $select, data, field, instance);
|
945 |
-
options = acf.applyFilters('select2_args/name=' + field.get('name'), options, $select, data, field, instance);
|
946 |
-
options = acf.applyFilters('select2_args/key=' + field.get('key'), options, $select, data, field, instance);
|
947 |
-
|
948 |
-
return options;
|
949 |
-
|
950 |
-
});
|
951 |
-
|
952 |
-
/**
|
953 |
-
* Select2: Init Variations
|
954 |
-
*/
|
955 |
-
acf.addAction('select2_init', function($select, options, data, field, instance){
|
956 |
-
|
957 |
-
acf.doAction('select2_init/type=' + field.get('type'), $select, options, data, field, instance);
|
958 |
-
acf.doAction('select2_init/name=' + field.get('name'), $select, options, data, field, instance);
|
959 |
-
acf.doAction('select2_init/key=' + field.get('key'), $select, options, data, field, instance);
|
960 |
-
|
961 |
-
});
|
962 |
-
|
963 |
-
/**
|
964 |
-
* Select2: Ajax Data Variations
|
965 |
-
*/
|
966 |
-
acf.addFilter('select2_ajax_data', function(ajaxData, data, $el, field, instance){
|
967 |
-
|
968 |
-
ajaxData = acf.applyFilters('select2_ajax_data/type=' + field.get('type'), ajaxData, data, $el, field, instance);
|
969 |
-
ajaxData = acf.applyFilters('select2_ajax_data/name=' + field.get('name'), ajaxData, data, $el, field, instance);
|
970 |
-
ajaxData = acf.applyFilters('select2_ajax_data/key=' + field.get('key'), ajaxData, data, $el, field, instance);
|
971 |
-
|
972 |
-
return ajaxData;
|
973 |
-
|
974 |
-
});
|
975 |
-
|
976 |
-
/**
|
977 |
-
* Module: Dynamic Forms - Select2 Allow tags
|
978 |
-
*/
|
979 |
-
function acfe_form_select_allow_tags(options, $select, data, field, instance){
|
980 |
-
|
981 |
-
options.tags = true;
|
982 |
-
|
983 |
-
options.createTag = function (params){
|
984 |
-
|
985 |
-
var term = $.trim(params.term);
|
986 |
-
|
987 |
-
if(term === '')
|
988 |
-
return null;
|
989 |
-
|
990 |
-
return {
|
991 |
-
id: term,
|
992 |
-
text: term,
|
993 |
-
newTag: true
|
994 |
-
}
|
995 |
-
|
996 |
-
};
|
997 |
-
|
998 |
-
options.insertTag = function(data, tag){
|
999 |
-
|
1000 |
-
var found = false;
|
1001 |
-
|
1002 |
-
$.each(data, function(index, value){
|
1003 |
-
|
1004 |
-
if($.trim(tag.text).toUpperCase() === $.trim(value.text).toUpperCase()){
|
1005 |
-
|
1006 |
-
found = true;
|
1007 |
-
return false;
|
1008 |
-
|
1009 |
-
}
|
1010 |
-
|
1011 |
-
});
|
1012 |
-
|
1013 |
-
if(!found)
|
1014 |
-
data.unshift(tag);
|
1015 |
-
|
1016 |
-
}
|
1017 |
-
|
1018 |
-
return options;
|
1019 |
-
|
1020 |
-
}
|
1021 |
-
|
1022 |
-
// Post
|
1023 |
-
acf.addFilter('select2_args/name=acfe_form_post_save_target', acfe_form_select_allow_tags);
|
1024 |
-
acf.addFilter('select2_args/name=acfe_form_post_load_source', acfe_form_select_allow_tags);
|
1025 |
-
|
1026 |
-
// Term
|
1027 |
-
acf.addFilter('select2_args/name=acfe_form_term_save_target', acfe_form_select_allow_tags);
|
1028 |
-
acf.addFilter('select2_args/name=acfe_form_term_load_source', acfe_form_select_allow_tags);
|
1029 |
-
|
1030 |
-
// User
|
1031 |
-
acf.addFilter('select2_args/name=acfe_form_user_save_target', acfe_form_select_allow_tags);
|
1032 |
-
acf.addFilter('select2_args/name=acfe_form_user_load_source', acfe_form_select_allow_tags);
|
1033 |
|
1034 |
/**
|
1035 |
* Module: Dynamic Forms - Select2 Ajax Data
|
@@ -1057,17 +1239,69 @@ function acfe_recaptcha(){
|
|
1057 |
/**
|
1058 |
* Module: Dynamic Forms (actions)
|
1059 |
*/
|
1060 |
-
acf.addAction('new_field/
|
1061 |
|
1062 |
-
|
1063 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1064 |
|
1065 |
-
|
1066 |
|
1067 |
$('body').find('.acf-fc-popup').addClass('acfe-fc-popup-grey');
|
1068 |
|
1069 |
});
|
1070 |
|
1071 |
});
|
1072 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1073 |
})(jQuery);
|
22 |
|
23 |
if(typeof acf === 'undefined')
|
24 |
return;
|
25 |
+
|
26 |
/**
|
27 |
* Field: reCaptcha
|
28 |
*/
|
29 |
var reCaptcha = acf.Field.extend({
|
30 |
+
|
31 |
type: 'acfe_recaptcha',
|
32 |
+
|
33 |
actions: {
|
34 |
'validation_failure' : 'validationFailure'
|
35 |
},
|
36 |
+
|
37 |
$control: function(){
|
38 |
+
return this.$('.acfe-field-recaptcha');
|
39 |
+
},
|
40 |
+
|
41 |
+
$input: function(){
|
42 |
+
return this.$('input[type="hidden"]');
|
43 |
+
},
|
44 |
+
|
45 |
+
$selector: function(){
|
46 |
+
return this.$control().find('> div');
|
47 |
+
},
|
48 |
+
|
49 |
+
selector: function(){
|
50 |
+
return this.$selector()[0];
|
51 |
+
},
|
52 |
+
|
53 |
version: function(){
|
54 |
+
return this.get('version');
|
55 |
+
},
|
56 |
+
|
57 |
render: function(){
|
58 |
+
|
59 |
var field = this;
|
60 |
+
|
61 |
if(this.version() === 'v2'){
|
62 |
+
|
63 |
+
this.recaptcha = grecaptcha.render(field.selector(), {
|
64 |
+
'sitekey': field.$control().data('site-key'),
|
65 |
+
'theme': field.$control().data('theme'),
|
66 |
+
'size': field.$control().data('size'),
|
67 |
+
|
68 |
+
|
69 |
'callback': function(response){
|
70 |
+
|
71 |
field.$input().val(response).change();
|
72 |
field.$input().closest('.acf-input').find('> .acf-notice.-error').hide();
|
73 |
+
|
74 |
},
|
75 |
+
|
76 |
'error-callback': function(){
|
77 |
+
|
78 |
field.$input().val('error').change();
|
79 |
+
|
80 |
},
|
81 |
+
|
82 |
'expired-callback': function(){
|
83 |
+
|
84 |
field.$input().val('expired').change();
|
85 |
+
|
86 |
}
|
87 |
});
|
88 |
+
|
89 |
}
|
90 |
+
|
91 |
else if(this.version() === 'v3'){
|
92 |
+
|
93 |
+
grecaptcha.ready(function(){
|
94 |
+
grecaptcha.execute(field.$control().data('site-key'), {action: 'homepage'}).then(function(response){
|
95 |
+
|
96 |
+
field.$input().val(response).change();
|
97 |
+
field.$input().closest('.acf-input').find('> .acf-notice.-error').hide();
|
98 |
+
|
|
|
|
|
|
|
99 |
});
|
100 |
+
});
|
101 |
+
|
|
|
102 |
}
|
103 |
+
|
104 |
},
|
105 |
+
|
106 |
validationFailure: function($form){
|
107 |
+
|
108 |
+
if(this.version() === 'v2'){
|
109 |
+
|
110 |
+
grecaptcha.reset(this.recaptcha);
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
}
|
115 |
+
|
116 |
});
|
117 |
|
118 |
acf.registerFieldType(reCaptcha);
|
156 |
|
157 |
initialize: function(){
|
158 |
|
159 |
+
this.rows = this.$control().data('rows');
|
160 |
+
this.max_rows = this.$control().data('max-rows');
|
161 |
+
|
162 |
this.mode = this.$control().data('mode');
|
163 |
this.lines = this.$control().data('lines');
|
164 |
+
this.indentUnit = this.$control().data('indent-unit');
|
165 |
|
166 |
var codeEditor = [];
|
167 |
|
197 |
// Init WP Code Editor
|
198 |
this.editor = wp.codeEditor.initialize(this.input(), codeEditor);
|
199 |
|
200 |
+
if(this.rows || this.max_rows){
|
201 |
|
202 |
+
if(this.rows){
|
203 |
+
|
204 |
+
this.editor.codemirror.getScrollerElement().style.minHeight = this.rows * 18.5 + 'px';
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
if(this.max_rows){
|
209 |
+
|
210 |
+
this.editor.codemirror.getScrollerElement().style.maxHeight = this.max_rows * 18.5 + 'px';
|
211 |
+
|
212 |
+
}
|
213 |
|
214 |
this.editor.codemirror.refresh();
|
215 |
|
220 |
this.editor.codemirror.on('change', function(){
|
221 |
|
222 |
field.editor.codemirror.save();
|
223 |
+
field.$input().change();
|
224 |
|
225 |
});
|
226 |
|
247 |
acf.registerConditionForFieldType('hasValue', 'acfe_code_editor');
|
248 |
acf.registerConditionForFieldType('hasNoValue', 'acfe_code_editor');
|
249 |
|
250 |
+
/*
|
251 |
+
var preCodeMirror = new acf.Model({
|
252 |
+
codemirror: false,
|
253 |
+
data: {
|
254 |
+
type: 'pre',
|
255 |
+
mode: 'htmlmixed',
|
256 |
+
codemirror: false,
|
257 |
+
},
|
258 |
+
actions: {
|
259 |
+
'new_field': 'new_field',
|
260 |
+
},
|
261 |
+
new_field: function(field){
|
262 |
+
|
263 |
+
var self = this;
|
264 |
+
|
265 |
+
field.$('pre[data-codemirror]:visible, code[data-codemirror]:visible').each(function(){
|
266 |
+
|
267 |
+
self.setup(this);
|
268 |
+
|
269 |
+
});
|
270 |
+
|
271 |
+
},
|
272 |
+
setup: function(el){
|
273 |
+
|
274 |
+
this.$el = $(el);
|
275 |
+
|
276 |
+
this.set('type', this.$el.prop('tagName').toLowerCase());
|
277 |
+
this.set('mode', this.$el.attr('data-codemirror'));
|
278 |
+
|
279 |
+
if(this.get('mode') === 'php'){
|
280 |
+
|
281 |
+
this.set('mode', 'application/x-httpd-php');
|
282 |
+
|
283 |
+
}else if(this.get('mode') === 'php-plain'){
|
284 |
+
|
285 |
+
this.set('mode', 'text/x-php');
|
286 |
+
|
287 |
+
}else if(this.get('mode') === 'html'){
|
288 |
+
|
289 |
+
this.set('mode', 'text/html');
|
290 |
+
|
291 |
+
}else if(this.get('mode') === 'javascript'){
|
292 |
+
|
293 |
+
this.set('mode', 'javascript');
|
294 |
+
|
295 |
+
}else if(this.get('mode') === 'css'){
|
296 |
+
|
297 |
+
this.set('mode', 'css');
|
298 |
+
|
299 |
+
}
|
300 |
+
|
301 |
+
this.render();
|
302 |
+
|
303 |
+
this.getClosestField();
|
304 |
+
|
305 |
+
},
|
306 |
+
initialize: function(){
|
307 |
+
// ...
|
308 |
+
},
|
309 |
+
render: function(){
|
310 |
+
|
311 |
+
var $code = this.$el.html();
|
312 |
+
var $div = $('<div class="' + this.get('type') + '-codemirror" />').insertAfter(this.$el);
|
313 |
+
var $unescaped = this.$el.html($code).text();
|
314 |
+
|
315 |
+
this.codemirror = wp.CodeMirror($div[0], {
|
316 |
+
value: $unescaped,
|
317 |
+
mode: this.get('mode'),
|
318 |
+
lineNumbers: false,
|
319 |
+
lineWrapping: false,
|
320 |
+
styleActiveLine: false,
|
321 |
+
continueComments: true,
|
322 |
+
indentUnit: 4,
|
323 |
+
tabSize: 1,
|
324 |
+
readOnly: true,
|
325 |
+
});
|
326 |
+
|
327 |
+
this.$el.remove();
|
328 |
+
|
329 |
+
},
|
330 |
+
refresh: function(){
|
331 |
+
|
332 |
+
if(this.codemirror)
|
333 |
+
this.codemirror.refresh();
|
334 |
+
|
335 |
+
},
|
336 |
+
getClosestField: function(){
|
337 |
+
|
338 |
+
var self = this;
|
339 |
+
|
340 |
+
field = acf.getClosestField(this.$el);
|
341 |
+
|
342 |
+
if(field){
|
343 |
+
|
344 |
+
field.on('showField', function(){
|
345 |
+
|
346 |
+
self.refresh();
|
347 |
+
|
348 |
+
});
|
349 |
+
|
350 |
+
}
|
351 |
+
|
352 |
+
}
|
353 |
+
|
354 |
+
});
|
355 |
+
*/
|
356 |
+
|
357 |
/**
|
358 |
* Field: Textarea
|
359 |
*/
|
526 |
},
|
527 |
|
528 |
initialize: function(){
|
529 |
+
// ...
|
|
|
|
|
530 |
},
|
531 |
|
532 |
getValue: function(){
|
537 |
title: this.$('.input-title').val(),
|
538 |
url: this.$('.input-url').val(),
|
539 |
post: this.$('.input-post :selected').text(),
|
540 |
+
term: this.$('.input-term :selected').text(),
|
541 |
target: this.$('.input-target').is(':checked')
|
542 |
};
|
543 |
|
545 |
|
546 |
data.url = data.post;
|
547 |
|
548 |
+
}else if(data.type === 'term'){
|
549 |
+
|
550 |
+
data.url = data.term;
|
551 |
+
|
552 |
}
|
553 |
|
554 |
return data;
|
591 |
this.$('.input-target').prop('checked', false);
|
592 |
this.$('.input-url').val('').trigger('change');
|
593 |
this.$('.input-post').val('').trigger('change');
|
594 |
+
this.$('.input-term').val('').trigger('change');
|
595 |
|
596 |
}
|
597 |
|
633 |
this.setValue(val);
|
634 |
|
635 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
636 |
|
637 |
});
|
638 |
|
639 |
acf.registerFieldType(ACFE_Advanced_Link);
|
640 |
|
641 |
+
/**
|
642 |
+
* Field: Advanced Link - Post Object Ajax
|
643 |
+
*/
|
644 |
+
acf.addFilter('select2_ajax_data/type=post_object', function(ajaxData, data, $el, field, select){
|
645 |
+
|
646 |
+
if(field.get('key') !== 'post')
|
647 |
+
return ajaxData;
|
648 |
+
|
649 |
+
var advanced_link = acf.getInstance($el.closest('.acf-field-acfe-advanced-link'));
|
650 |
+
|
651 |
+
if(advanced_link){
|
652 |
+
|
653 |
+
ajaxData.field_key = advanced_link.get('key');
|
654 |
+
|
655 |
+
}
|
656 |
+
|
657 |
+
return ajaxData;
|
658 |
+
|
659 |
+
});
|
660 |
+
|
661 |
+
/*
|
662 |
+
* Field: Advanced Link - Error
|
663 |
+
*/
|
664 |
+
acf.addAction('invalid_field', function(field){
|
665 |
+
|
666 |
+
var $advanced_link = field.$el.closest('.acf-field-acfe-advanced-link').not('.acf-error');
|
667 |
+
|
668 |
+
if($advanced_link.length){
|
669 |
+
|
670 |
+
var advanced_link_field = acf.getInstance($advanced_link);
|
671 |
+
|
672 |
+
advanced_link_field.showError(field.notice.get('text'));
|
673 |
+
|
674 |
+
}
|
675 |
+
|
676 |
+
});
|
677 |
+
|
678 |
/**
|
679 |
* Field: Group
|
680 |
*/
|
863 |
/**
|
864 |
* Field: Taxonomy Terms - Ajax
|
865 |
*/
|
866 |
+
acf.addFilter('select2_ajax_data/action=acfe/fields/taxonomy_terms/allow_query', function(ajaxData, data, $el, field, select){
|
|
|
|
|
|
|
867 |
|
868 |
// Taxonomies
|
869 |
var $taxonomies = $el.closest('.acf-field-settings').find('> .acf-field-setting-taxonomy > .acf-input > select > option:selected');
|
886 |
});
|
887 |
|
888 |
/**
|
889 |
+
* Field: Select - Placeholder
|
890 |
*/
|
891 |
+
acf.addAction('select2_init', function($select, options, data, field, instance){
|
|
|
|
|
|
|
892 |
|
893 |
+
// Search Placeholder
|
894 |
+
if(field.get('acfeSearchPlaceholder')){
|
895 |
+
|
896 |
+
var search_placeholder = field.get('acfeSearchPlaceholder');
|
897 |
|
898 |
+
$select.on('select2:open', function(e){
|
899 |
+
|
900 |
+
if(field.get('multiple')){
|
901 |
+
|
902 |
+
if(!$select.val()){
|
903 |
+
|
904 |
+
field.$('.select2-search__field').attr('placeholder', search_placeholder);
|
905 |
+
|
906 |
+
}
|
907 |
+
|
908 |
+
}else{
|
909 |
+
|
910 |
+
$('.select2-search.select2-search--dropdown > .select2-search__field').attr('placeholder', search_placeholder);
|
911 |
+
|
912 |
+
}
|
913 |
+
|
914 |
+
});
|
915 |
+
|
916 |
+
if(field.get('multiple')){
|
917 |
+
|
918 |
+
$select.on('select2:close', function(e){
|
919 |
+
|
920 |
+
if(!$select.val()){
|
921 |
+
|
922 |
+
field.$('.select2-search__field').attr('placeholder', field.get('placeholder'));
|
923 |
+
|
924 |
+
}
|
925 |
+
|
926 |
+
});
|
927 |
+
|
928 |
+
}
|
929 |
|
930 |
+
}
|
931 |
|
932 |
});
|
933 |
|
934 |
/**
|
935 |
+
* Field: Select - Allow Custom
|
936 |
*/
|
937 |
+
acf.addFilter('select2_args', function(options, $select, fieldData, field, instance){
|
|
|
|
|
|
|
|
|
|
|
938 |
|
939 |
+
if(field.get('acfeAllowCustom')){
|
940 |
|
941 |
+
options.tags = true;
|
942 |
+
|
943 |
+
options.createTag = function(params){
|
944 |
+
|
945 |
+
var term = $.trim(params.term);
|
946 |
+
|
947 |
+
if(term === '')
|
948 |
+
return null;
|
949 |
+
|
950 |
+
var optionsMatch = false;
|
951 |
+
|
952 |
+
this.$element.find('option').each(function(){
|
953 |
+
|
954 |
+
if(this.value.toLowerCase() === term.toLowerCase()){
|
955 |
+
optionsMatch = true;
|
956 |
+
}
|
957 |
+
|
958 |
+
});
|
959 |
+
|
960 |
+
if(optionsMatch)
|
961 |
+
return null;
|
962 |
+
|
963 |
+
return {
|
964 |
+
id: term,
|
965 |
+
text: term
|
966 |
+
};
|
967 |
|
968 |
+
};
|
969 |
+
|
970 |
+
|
971 |
+
options.insertTag = function(data, tag){
|
972 |
+
|
973 |
+
var found = false;
|
974 |
+
|
975 |
+
$.each(data, function(index, value){
|
976 |
|
977 |
+
if($.trim(tag.text).toUpperCase() === $.trim(value.text).toUpperCase()){
|
978 |
+
|
979 |
+
found = true;
|
980 |
+
return false;
|
981 |
+
|
982 |
+
}
|
983 |
|
984 |
+
});
|
985 |
+
|
986 |
+
if(!found)
|
987 |
+
data.unshift(tag);
|
988 |
+
|
989 |
+
}
|
990 |
+
|
991 |
+
options.templateSelection = function(state){
|
992 |
+
|
993 |
+
if(!state.id){
|
994 |
+
return state.text;
|
995 |
}
|
996 |
+
|
997 |
+
var text = state.text;
|
998 |
|
999 |
+
var match_field = /{field:(.*)}/g;
|
1000 |
+
var match_fields = /{fields}/g;
|
1001 |
+
var match_get_field = /{get_field:(.*)}/g;
|
1002 |
+
var match_query_var = /{query_var:(.*)}/g;
|
1003 |
+
var match_current = /{current:(.*)}/g;
|
1004 |
+
|
1005 |
+
text = text.replace(match_field, "<code style='font-size:12px;padding:3px;vertical-align: 1px;line-height: 12px;'>{field:$1}</code>");
|
1006 |
+
text = text.replace(match_fields, "<code style='font-size:12px;padding:3px;vertical-align: 1px;line-height: 12px;'>{fields}</code>");
|
1007 |
+
text = text.replace(match_current, "<code style='font-size:12px;padding:3px;vertical-align: 1px;line-height: 12px;'>{current:$1}</code>");
|
1008 |
+
text = text.replace(match_get_field, "<code style='font-size:12px;padding:3px;vertical-align: 1px;line-height: 12px;'>{get_field:$1}</code>");
|
1009 |
+
text = text.replace(match_query_var, "<code style='font-size:12px;padding:3px;vertical-align: 1px;line-height: 12px;'>{query_var:$1}</code>");
|
1010 |
+
|
1011 |
|
1012 |
+
return text;
|
1013 |
+
|
1014 |
+
};
|
1015 |
|
1016 |
+
options.templateResult = function(state){
|
1017 |
+
|
1018 |
+
if(!state.id){
|
1019 |
+
return state.text;
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
var text = state.text;
|
1023 |
+
|
1024 |
+
var match_field = /{field:(.*?)}/g;
|
1025 |
+
var match_fields = /{fields}/g;
|
1026 |
+
var match_get_field = /{get_field:(.*?)}/g;
|
1027 |
+
var match_query_var = /{query_var:(.*?)}/g;
|
1028 |
+
var match_current = /{current:(.*?)}/g;
|
1029 |
+
|
1030 |
+
text = text.replace(match_field, "<code style='font-size:12px;'>{field:$1}</code>");
|
1031 |
+
text = text.replace(match_fields, "<code style='font-size:12px;'>{fields}</code>");
|
1032 |
+
text = text.replace(match_get_field, "<code style='font-size:12px;'>{get_field:$1}</code>");
|
1033 |
+
text = text.replace(match_query_var, "<code style='font-size:12px;'>{query_var:$1}</code>");
|
1034 |
+
text = text.replace(match_current, "<code style='font-size:12px;'>{current:$1}</code>");
|
1035 |
+
|
1036 |
+
return text;
|
1037 |
+
|
1038 |
+
};
|
1039 |
+
|
1040 |
}
|
1041 |
|
1042 |
return options;
|
1043 |
|
1044 |
});
|
1045 |
|
1046 |
+
/**
|
1047 |
+
* Field: Select2 - Args Variations
|
1048 |
+
*/
|
1049 |
+
acf.addFilter('select2_args', function(options, $select, data, field, instance){
|
1050 |
+
|
1051 |
+
options = acf.applyFilters('select2_args/type=' + field.get('type'), options, $select, data, field, instance);
|
1052 |
+
options = acf.applyFilters('select2_args/name=' + field.get('name'), options, $select, data, field, instance);
|
1053 |
+
options = acf.applyFilters('select2_args/key=' + field.get('key'), options, $select, data, field, instance);
|
1054 |
+
|
1055 |
+
return options;
|
1056 |
+
|
1057 |
+
});
|
1058 |
+
|
1059 |
+
/**
|
1060 |
+
* Field: Select2 - Init Variations
|
1061 |
+
*/
|
1062 |
+
acf.addAction('select2_init', function($select, options, data, field, instance){
|
1063 |
+
|
1064 |
+
acf.doAction('select2_init/type=' + field.get('type'), $select, options, data, field, instance);
|
1065 |
+
acf.doAction('select2_init/name=' + field.get('name'), $select, options, data, field, instance);
|
1066 |
+
acf.doAction('select2_init/key=' + field.get('key'), $select, options, data, field, instance);
|
1067 |
+
|
1068 |
+
});
|
1069 |
+
|
1070 |
+
/**
|
1071 |
+
* Field: Select2 - Ajax Data Variations
|
1072 |
+
*/
|
1073 |
+
acf.addFilter('select2_ajax_data', function(ajaxData, data, $el, field, instance){
|
1074 |
+
|
1075 |
+
ajaxData = acf.applyFilters('select2_ajax_data/type=' + field.get('type'), ajaxData, data, $el, field, instance);
|
1076 |
+
ajaxData = acf.applyFilters('select2_ajax_data/name=' + field.get('name'), ajaxData, data, $el, field, instance);
|
1077 |
+
ajaxData = acf.applyFilters('select2_ajax_data/key=' + field.get('key'), ajaxData, data, $el, field, instance);
|
1078 |
+
|
1079 |
+
if(ajaxData.action){
|
1080 |
+
|
1081 |
+
ajaxData = acf.applyFilters('select2_ajax_data/action=' + ajaxData.action, ajaxData, data, $el, field, instance);
|
1082 |
+
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
return ajaxData;
|
1086 |
+
|
1087 |
+
});
|
1088 |
+
|
1089 |
/**
|
1090 |
* Field: Forms
|
1091 |
*/
|
1166 |
|
1167 |
var name = field.get('name');
|
1168 |
var $layout = field.$el.closest('.layout');
|
1169 |
+
var $message = $layout.find('> .acf-fields > .acf-field[data-name="' + name + '_message"] > .acf-input');
|
1170 |
+
|
1171 |
var selected = field.$input().find('option:selected').text();
|
1172 |
|
1173 |
if(selected.length){
|
1175 |
}
|
1176 |
|
1177 |
field.$input().on('change', function(){
|
1178 |
+
|
1179 |
+
// Message
|
1180 |
+
var text = $(this).find('option:selected').text();
|
1181 |
+
|
1182 |
+
$message.html(text);
|
1183 |
|
1184 |
});
|
1185 |
|
1186 |
};
|
1187 |
|
1188 |
+
acf.addAction('new_field/name=acfe_form_post_map_target', acfe_form_map_fields);
|
1189 |
+
acf.addAction('new_field/name=acfe_form_post_map_post_type', acfe_form_map_fields);
|
1190 |
+
acf.addAction('new_field/name=acfe_form_post_map_post_status', acfe_form_map_fields);
|
1191 |
+
acf.addAction('new_field/name=acfe_form_post_map_post_title', acfe_form_map_fields);
|
1192 |
+
acf.addAction('new_field/name=acfe_form_post_map_post_name', acfe_form_map_fields);
|
1193 |
acf.addAction('new_field/name=acfe_form_post_map_post_content', acfe_form_map_fields);
|
1194 |
+
acf.addAction('new_field/name=acfe_form_post_map_post_author', acfe_form_map_fields);
|
1195 |
+
acf.addAction('new_field/name=acfe_form_post_map_post_parent', acfe_form_map_fields);
|
1196 |
+
acf.addAction('new_field/name=acfe_form_post_map_post_terms', acfe_form_map_fields);
|
1197 |
|
1198 |
+
acf.addAction('new_field/name=acfe_form_user_map_email', acfe_form_map_fields);
|
1199 |
+
acf.addAction('new_field/name=acfe_form_user_map_username', acfe_form_map_fields);
|
1200 |
+
acf.addAction('new_field/name=acfe_form_user_map_password', acfe_form_map_fields);
|
1201 |
+
acf.addAction('new_field/name=acfe_form_user_map_first_name', acfe_form_map_fields);
|
1202 |
+
acf.addAction('new_field/name=acfe_form_user_map_last_name', acfe_form_map_fields);
|
1203 |
+
acf.addAction('new_field/name=acfe_form_user_map_nickname', acfe_form_map_fields);
|
1204 |
acf.addAction('new_field/name=acfe_form_user_map_display_name', acfe_form_map_fields);
|
1205 |
+
acf.addAction('new_field/name=acfe_form_user_map_website', acfe_form_map_fields);
|
1206 |
+
acf.addAction('new_field/name=acfe_form_user_map_description', acfe_form_map_fields);
|
1207 |
+
acf.addAction('new_field/name=acfe_form_user_map_role', acfe_form_map_fields);
|
1208 |
|
1209 |
+
acf.addAction('new_field/name=acfe_form_term_map_name', acfe_form_map_fields);
|
1210 |
+
acf.addAction('new_field/name=acfe_form_term_map_slug', acfe_form_map_fields);
|
1211 |
+
acf.addAction('new_field/name=acfe_form_term_map_taxonomy', acfe_form_map_fields);
|
1212 |
+
acf.addAction('new_field/name=acfe_form_term_map_parent', acfe_form_map_fields);
|
1213 |
+
acf.addAction('new_field/name=acfe_form_term_map_description', acfe_form_map_fields);
|
1214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1215 |
|
1216 |
/**
|
1217 |
* Module: Dynamic Forms - Select2 Ajax Data
|
1239 |
/**
|
1240 |
* Module: Dynamic Forms (actions)
|
1241 |
*/
|
1242 |
+
acf.addAction('new_field/name=acfe_form_actions', function(field){
|
1243 |
|
1244 |
+
var $tab = $('a[data-key=field_acfe_form_tab_actions]');
|
1245 |
+
|
1246 |
+
var $layouts = field.$layouts();
|
1247 |
+
|
1248 |
+
$tab.html('Actions <span class="acfe-tab-badge">' + $layouts.length + '</span>');
|
1249 |
+
|
1250 |
+
field.on('change', function(){
|
1251 |
+
|
1252 |
+
var $layouts = field.$layouts();
|
1253 |
+
|
1254 |
+
$tab.html('Actions <span class="acfe-tab-badge">' + $layouts.length + '</span>');
|
1255 |
+
|
1256 |
+
});
|
1257 |
|
1258 |
+
field.on('click', '[data-name="add-layout"]', function(e){
|
1259 |
|
1260 |
$('body').find('.acf-fc-popup').addClass('acfe-fc-popup-grey');
|
1261 |
|
1262 |
});
|
1263 |
|
1264 |
});
|
1265 |
+
|
1266 |
+
var acfe_tab_forget_tab_preference = function(field){
|
1267 |
+
|
1268 |
+
var $tabs = field.findTabs();
|
1269 |
+
var tabs = acf.getInstances($tabs);
|
1270 |
+
var key = field.get('key');
|
1271 |
+
|
1272 |
+
if(tabs.length){
|
1273 |
+
|
1274 |
+
var preference = acf.getPreference('this.tabs');
|
1275 |
+
|
1276 |
+
if(!preference)
|
1277 |
+
return;
|
1278 |
+
|
1279 |
+
$.each(tabs, function(){
|
1280 |
+
|
1281 |
+
var group = this;
|
1282 |
+
var groupIndex = group.get('index');
|
1283 |
+
|
1284 |
+
if(group.data.key === key){
|
1285 |
+
preference[groupIndex] = 0;
|
1286 |
+
}
|
1287 |
+
|
1288 |
+
});
|
1289 |
+
|
1290 |
+
// update
|
1291 |
+
acf.setPreference('this.tabs', preference);
|
1292 |
+
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
};
|
1296 |
+
|
1297 |
+
acf.addAction('prepare_field/key=field_acfe_form_custom_action_tab_action', acfe_tab_forget_tab_preference);
|
1298 |
+
acf.addAction('prepare_field/key=field_acfe_form_email_tab_action', acfe_tab_forget_tab_preference);
|
1299 |
+
acf.addAction('prepare_field/key=field_acfe_form_post_tab_action', acfe_tab_forget_tab_preference);
|
1300 |
+
acf.addAction('prepare_field/key=field_acfe_form_term_tab_action', acfe_tab_forget_tab_preference);
|
1301 |
+
acf.addAction('prepare_field/key=field_acfe_form_user_tab_action', acfe_tab_forget_tab_preference);
|
1302 |
+
|
1303 |
+
acf.addAction('show_postbox', function(postbox){
|
1304 |
+
postbox.$el.removeClass('acfe-postbox-left');
|
1305 |
+
});
|
1306 |
+
|
1307 |
})(jQuery);
|
assets/acf-extended-form.js
CHANGED
@@ -13,6 +13,52 @@
|
|
13 |
|
14 |
});
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
// Datepicker: Add field class
|
17 |
acf.addAction('new_field/type=date_picker', function(field){
|
18 |
|
13 |
|
14 |
});
|
15 |
|
16 |
+
// Allow conditions to work within wrapped div
|
17 |
+
acf.newCondition = function( rule, conditions ){
|
18 |
+
|
19 |
+
// currently setting up conditions for fieldX, this field is the 'target'
|
20 |
+
var target = conditions.get('field');
|
21 |
+
|
22 |
+
// use the 'target' to find the 'trigger' field.
|
23 |
+
// - this field is used to setup the conditional logic events
|
24 |
+
|
25 |
+
// before: var field = target.getField( rule.field );
|
26 |
+
var field = acf.getField( rule.field );
|
27 |
+
|
28 |
+
// bail ealry if no target or no field (possible if field doesn't exist due to HTML error)
|
29 |
+
if( !target || !field ) {
|
30 |
+
return false;
|
31 |
+
}
|
32 |
+
|
33 |
+
// vars
|
34 |
+
var args = {
|
35 |
+
rule: rule,
|
36 |
+
target: target,
|
37 |
+
conditions: conditions,
|
38 |
+
field: field
|
39 |
+
};
|
40 |
+
|
41 |
+
// vars
|
42 |
+
var fieldType = field.get('type');
|
43 |
+
var operator = rule.operator;
|
44 |
+
|
45 |
+
// get avaibale conditions
|
46 |
+
var conditionTypes = acf.getConditionTypes({
|
47 |
+
fieldType: fieldType,
|
48 |
+
operator: operator,
|
49 |
+
});
|
50 |
+
|
51 |
+
// instantiate
|
52 |
+
var model = conditionTypes[0] || acf.Condition;
|
53 |
+
|
54 |
+
// instantiate
|
55 |
+
var condition = new model( args );
|
56 |
+
|
57 |
+
// return
|
58 |
+
return condition;
|
59 |
+
|
60 |
+
};
|
61 |
+
|
62 |
// Datepicker: Add field class
|
63 |
acf.addAction('new_field/type=date_picker', function(field){
|
64 |
|
assets/acf-extended-modal.css
CHANGED
@@ -518,9 +518,28 @@ body.block-editor-page .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper
|
|
518 |
max-height: calc(100vh - 88px);
|
519 |
}
|
520 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
@media only screen and (max-width: 1080px) {
|
522 |
body.block-editor-page .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper{
|
523 |
-
margin-top:
|
524 |
}
|
525 |
}
|
526 |
|
@@ -558,12 +577,18 @@ body.block-editor-page.folded .edit-post-layout.is-sidebar-opened .acfe-modal.-o
|
|
558 |
max-width: calc(100vw - 316px);
|
559 |
}
|
560 |
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
body.block-editor-page .acfe-modal-overlay{
|
562 |
display:none;
|
563 |
}
|
564 |
|
565 |
/*
|
566 |
-
* ACFE Modal: Attachment Single Fix
|
567 |
*/
|
568 |
body.wp-admin.upload-php.acfe-modal-opened > div:not([style*="display: none;"]) > .media-modal.wp-core-ui:not(.acf-media-modal):before{
|
569 |
content:"";
|
518 |
max-height: calc(100vh - 88px);
|
519 |
}
|
520 |
|
521 |
+
body.block-editor-page .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields.-left {
|
522 |
+
height:100%;
|
523 |
+
}
|
524 |
+
|
525 |
+
body.block-editor-page .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper > .acfe-modal-content > .acf-fields.-left:before {
|
526 |
+
content: "";
|
527 |
+
display: block;
|
528 |
+
position: absolute;
|
529 |
+
z-index: 0;
|
530 |
+
background: #F9F9F9;
|
531 |
+
border-color: #E1E1E1;
|
532 |
+
border-style: solid;
|
533 |
+
border-width: 0 1px 0 0;
|
534 |
+
top: 0;
|
535 |
+
bottom: 0;
|
536 |
+
left: 0;
|
537 |
+
width: 20%;
|
538 |
+
}
|
539 |
+
|
540 |
@media only screen and (max-width: 1080px) {
|
541 |
body.block-editor-page .edit-post-layout .acfe-modal.-open > .acfe-modal-wrapper{
|
542 |
+
margin-top: 88px;
|
543 |
}
|
544 |
}
|
545 |
|
577 |
max-width: calc(100vw - 316px);
|
578 |
}
|
579 |
|
580 |
+
@media (min-width: 600px){
|
581 |
+
body.block-editor-page.acfe-modal-opened .edit-post-layout__content {
|
582 |
+
overflow-y: hidden;
|
583 |
+
}
|
584 |
+
}
|
585 |
+
|
586 |
body.block-editor-page .acfe-modal-overlay{
|
587 |
display:none;
|
588 |
}
|
589 |
|
590 |
/*
|
591 |
+
* ACFE Modal: Attachment Single Fix
|
592 |
*/
|
593 |
body.wp-admin.upload-php.acfe-modal-opened > div:not([style*="display: none;"]) > .media-modal.wp-core-ui:not(.acf-media-modal):before{
|
594 |
content:"";
|
assets/acf-extended.css
CHANGED
@@ -34,6 +34,15 @@ body.-loading *{
|
|
34 |
.acf-field.acfe-no-label > .acf-label > p.description{
|
35 |
margin-bottom:10px;
|
36 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
/*
|
39 |
* ACF Field: Hidden
|
@@ -291,6 +300,46 @@ tr.acf-field.acf-field-clone[data-acfe-clone-modal="1"] > .acf-input > .acfe-mod
|
|
291 |
position:relative;
|
292 |
}
|
293 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
/*
|
295 |
* ACFE Form
|
296 |
*/
|
@@ -298,6 +347,10 @@ form.acfe-form.is-invalid[data-hide-error="1"] > .acf-error-message.-dismiss{
|
|
298 |
display:none;
|
299 |
}
|
300 |
|
|
|
|
|
|
|
|
|
301 |
form.acfe-form.is-invalid[data-errors-position="below"] .acf-field .acf-notice{
|
302 |
margin:15px 0 0;
|
303 |
}
|
@@ -368,4 +421,276 @@ form.acfe-form.is-invalid[data-errors-position="below"] .acf-field .acf-notice{
|
|
368 |
.acf-fields > .acf-field.acf-field-acfe-column[data-columns="6/6"] {
|
369 |
width: 100%;
|
370 |
border-right:0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
}
|
34 |
.acf-field.acfe-no-label > .acf-label > p.description{
|
35 |
margin-bottom:10px;
|
36 |
}
|
37 |
+
|
38 |
+
/*
|
39 |
+
* ACF: Tooltip
|
40 |
+
*/
|
41 |
+
.acfe-field-tooltip{
|
42 |
+
float:right;
|
43 |
+
font-size:16px;
|
44 |
+
color:#999;
|
45 |
+
}
|
46 |
|
47 |
/*
|
48 |
* ACF Field: Hidden
|
300 |
position:relative;
|
301 |
}
|
302 |
|
303 |
+
/*
|
304 |
+
* ACF Field: Google Map
|
305 |
+
*/
|
306 |
+
.acf-range-wrap input[type="number"]{
|
307 |
+
min-width: 3.5em;
|
308 |
+
}
|
309 |
+
|
310 |
+
/*
|
311 |
+
* ACF Field: Advanced Link
|
312 |
+
*/
|
313 |
+
.acf-link.-value .acfe-modal-footer .button{
|
314 |
+
display:unset;
|
315 |
+
}
|
316 |
+
|
317 |
+
/*
|
318 |
+
* ACF Field: Editor
|
319 |
+
*/
|
320 |
+
.acf-field-wysiwyg[data-acfe-wysiwyg-transparent="1"] .acf-editor-wrap .wp-editor-container,
|
321 |
+
.acf-field-wysiwyg[data-acfe-wysiwyg-transparent="1"] .acf-editor-wrap .mce-tinymce,
|
322 |
+
.acf-field-wysiwyg[data-acfe-wysiwyg-transparent="1"] .acf-editor-wrap .mce-edit-area{
|
323 |
+
background:transparent;
|
324 |
+
}
|
325 |
+
|
326 |
+
.acf-editor-wrap iframe{
|
327 |
+
min-height:60px;
|
328 |
+
}
|
329 |
+
|
330 |
+
.acf-editor-wrap .mce-top-part::before{
|
331 |
+
box-shadow:none;
|
332 |
+
}
|
333 |
+
|
334 |
+
.acf-editor-wrap div.mce-statusbar{
|
335 |
+
border:0;
|
336 |
+
}
|
337 |
+
|
338 |
+
.acf-editor-wrap .mce-path-item,
|
339 |
+
.acf-editor-wrap .mce-divider{
|
340 |
+
color:#aaa;
|
341 |
+
}
|
342 |
+
|
343 |
/*
|
344 |
* ACFE Form
|
345 |
*/
|
347 |
display:none;
|
348 |
}
|
349 |
|
350 |
+
form.acfe-form.is-valid[data-hide-revalidation="1"] > .acf-notice.-success{
|
351 |
+
display:none;
|
352 |
+
}
|
353 |
+
|
354 |
form.acfe-form.is-invalid[data-errors-position="below"] .acf-field .acf-notice{
|
355 |
margin:15px 0 0;
|
356 |
}
|
421 |
.acf-fields > .acf-field.acf-field-acfe-column[data-columns="6/6"] {
|
422 |
width: 100%;
|
423 |
border-right:0;
|
424 |
+
}
|
425 |
+
|
426 |
+
/*
|
427 |
+
* ACFE Form: WP Media Modal
|
428 |
+
*/
|
429 |
+
.acf-media-modal .screen-reader-text,
|
430 |
+
.acf-media-modal .screen-reader-text span,
|
431 |
+
.acf-media-modal .ui-helper-hidden-accessible {
|
432 |
+
border: 0;
|
433 |
+
clip: rect(1px,1px,1px,1px);
|
434 |
+
-webkit-clip-path: inset(50%);
|
435 |
+
clip-path: inset(50%);
|
436 |
+
height: 1px;
|
437 |
+
margin: -1px;
|
438 |
+
overflow: hidden;
|
439 |
+
padding: 0;
|
440 |
+
position: absolute;
|
441 |
+
width: 1px;
|
442 |
+
word-wrap: normal!important;
|
443 |
+
}
|
444 |
+
|
445 |
+
/*
|
446 |
+
* ACFE Datepicker
|
447 |
+
*/
|
448 |
+
.acf-ui-datepicker .ui-datepicker {
|
449 |
+
padding: 0;
|
450 |
+
border-color: #7e8993 !important;
|
451 |
+
-webkit-border-radius: 4px;
|
452 |
+
-moz-border-radius: 4px;
|
453 |
+
border-radius: 4px;
|
454 |
+
box-sizing: border-box;
|
455 |
+
background:#fff;
|
456 |
+
}
|
457 |
+
|
458 |
+
.acf-ui-datepicker select{
|
459 |
+
font-size:14px;
|
460 |
+
cursor: pointer;
|
461 |
+
vertical-align: middle;
|
462 |
+
line-height: 2;
|
463 |
+
color: #32373c;
|
464 |
+
border-color: #7e8993;
|
465 |
+
box-shadow: none;
|
466 |
+
border-radius: 3px;
|
467 |
+
padding: 0 24px 0 8px;
|
468 |
+
min-height: 30px;
|
469 |
+
max-width: 25rem;
|
470 |
+
-webkit-appearance: none;
|
471 |
+
background: #fff url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E') no-repeat right 5px top 55%;
|
472 |
+
background-size: 16px 16px;
|
473 |
+
}
|
474 |
+
.acf-ui-datepicker .ui-datepicker table {
|
475 |
+
font-size: 13px;
|
476 |
+
margin: 0;
|
477 |
+
margin-bottom:7px;
|
478 |
+
}
|
479 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-header {
|
480 |
+
border: none;
|
481 |
+
background: #F9F9F9;
|
482 |
+
color: #222;
|
483 |
+
font-weight: normal;
|
484 |
+
-webkit-border-radius: 4px 4px 0;
|
485 |
+
-moz-border-radius: 4px 4px 0;
|
486 |
+
border-radius: 4px 4px 0;
|
487 |
+
}
|
488 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-header .ui-state-hover {
|
489 |
+
background: #F9F9F9;
|
490 |
+
cursor: pointer;
|
491 |
+
-webkit-border-radius: 0;
|
492 |
+
-moz-border-radius: 0;
|
493 |
+
border-radius: 0;
|
494 |
+
border:0;
|
495 |
+
}
|
496 |
+
.acf-ui-datepicker .ui-datepicker thead {
|
497 |
+
background: #F9F9F9;
|
498 |
+
color: #222;
|
499 |
+
}
|
500 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-title {
|
501 |
+
margin-top: .4em;
|
502 |
+
margin-bottom: .3em;
|
503 |
+
color: #222;
|
504 |
+
font-size: 14px;
|
505 |
+
}
|
506 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-prev-hover,
|
507 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-next-hover,
|
508 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-next,
|
509 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-prev {
|
510 |
+
height:20px;
|
511 |
+
width:20px;
|
512 |
+
border: none;
|
513 |
+
overflow: hidden;
|
514 |
+
margin-top:15px;
|
515 |
+
top:0;
|
516 |
+
}
|
517 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-prev-hover,
|
518 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-next-hover{
|
519 |
+
background:none !important;
|
520 |
+
color:#007cba !important;
|
521 |
+
}
|
522 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-next{
|
523 |
+
right:7px;
|
524 |
+
}
|
525 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-prev{
|
526 |
+
left:7px;
|
527 |
+
}
|
528 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-next span,
|
529 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-prev span {
|
530 |
+
height:20px;
|
531 |
+
width:20px;
|
532 |
+
background:none;
|
533 |
+
position: relative;
|
534 |
+
margin: 0;
|
535 |
+
left: unset;
|
536 |
+
top: unset;
|
537 |
+
font-size:1px;
|
538 |
+
}
|
539 |
+
|
540 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-next span:before,
|
541 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-prev span:before {
|
542 |
+
display:block;
|
543 |
+
font-family: dashicons;
|
544 |
+
line-height: 1;
|
545 |
+
font-weight: 400;
|
546 |
+
text-indent:0;
|
547 |
+
font-style: normal;
|
548 |
+
speak: none;
|
549 |
+
text-decoration: inherit;
|
550 |
+
text-transform: none;
|
551 |
+
text-rendering: auto;
|
552 |
+
-webkit-font-smoothing: antialiased;
|
553 |
+
-moz-osx-font-smoothing: grayscale;
|
554 |
+
width: 20px;
|
555 |
+
height: 20px;
|
556 |
+
font-size: 16px;
|
557 |
+
vertical-align: top;
|
558 |
+
text-align: center;
|
559 |
+
}
|
560 |
+
|
561 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-next span:before{
|
562 |
+
content: "\f345";
|
563 |
+
}
|
564 |
+
|
565 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-prev span:before{
|
566 |
+
content: "\f341";
|
567 |
+
}
|
568 |
+
|
569 |
+
.acf-ui-datepicker .ui-datepicker .ui-datepicker-title select{
|
570 |
+
margin:0 3px;
|
571 |
+
}
|
572 |
+
.acf-ui-datepicker .ui-datepicker th {
|
573 |
+
padding: 0.75em 0;
|
574 |
+
color: #222;
|
575 |
+
font-weight: normal;
|
576 |
+
border: none;
|
577 |
+
border-bottom: 1px solid #E1E1E1;
|
578 |
+
background: #F9F9F9;
|
579 |
+
}
|
580 |
+
.acf-ui-datepicker .ui-datepicker td {
|
581 |
+
background: #fff;
|
582 |
+
border: none;
|
583 |
+
padding: 0;
|
584 |
+
}
|
585 |
+
.acf-ui-datepicker .ui-datepicker td .ui-state-default {
|
586 |
+
background: transparent;
|
587 |
+
border: none;
|
588 |
+
text-align: center;
|
589 |
+
padding: .5em;
|
590 |
+
margin: 0;
|
591 |
+
font-weight: normal;
|
592 |
+
color: #333;
|
593 |
+
}
|
594 |
+
.acf-ui-datepicker .ui-datepicker td .ui-state-active,
|
595 |
+
.acf-ui-datepicker .ui-datepicker td .ui-state-hover {
|
596 |
+
background: #007cba;
|
597 |
+
color: #fff;
|
598 |
+
box-shadow:none;
|
599 |
+
}
|
600 |
+
.acf-ui-datepicker .ui-datepicker td.ui-state-disabled,
|
601 |
+
.acf-ui-datepicker .ui-datepicker td.ui-state-disabled .ui-state-default {
|
602 |
+
opacity: 1;
|
603 |
+
color: #999;
|
604 |
+
}
|
605 |
+
.acf-ui-datepicker .ui-datepicker-today .ui-state-highlight {
|
606 |
+
border: none !important;
|
607 |
+
background: #eee !important;
|
608 |
+
font-weight: normal !important;
|
609 |
+
color: #222 !important;
|
610 |
+
}
|
611 |
+
.acf-ui-datepicker .ui-state-highlight.ui-state-active,
|
612 |
+
.acf-ui-datepicker .ui-state-highlight.ui-state-hover {
|
613 |
+
border: none !important;
|
614 |
+
background: #007cba !important;
|
615 |
+
font-weight: normal !important;
|
616 |
+
color: #ffffff !important;
|
617 |
+
}
|
618 |
+
|
619 |
+
.acf-ui-datepicker .ui-state-highlight.ui-state-hover.ui-state-active{
|
620 |
+
background: #007cba !important;
|
621 |
+
}
|
622 |
+
|
623 |
+
.acf-ui-datepicker .ui-timepicker-div{
|
624 |
+
padding:10px 7px !important;
|
625 |
+
}
|
626 |
+
|
627 |
+
.acf-ui-datepicker .ui-timepicker-div .ui-widget-header{
|
628 |
+
background:none !important;
|
629 |
+
border:0 !important;
|
630 |
+
display:none !important;
|
631 |
+
}
|
632 |
+
.acf-ui-datepicker .ui-timepicker-div .ui-widget-header .ui-datepicker-title{
|
633 |
+
font-size:13px !important;
|
634 |
+
font-weight:600 !important;
|
635 |
+
}
|
636 |
+
|
637 |
+
.acf-ui-datepicker .ui-timepicker-div dl{
|
638 |
+
margin:0;
|
639 |
+
text-align:center !important;
|
640 |
+
}
|
641 |
+
|
642 |
+
.acf-ui-datepicker .ui-timepicker-div .ui_tpicker_time_label{
|
643 |
+
display:none !important;
|
644 |
+
}
|
645 |
+
|
646 |
+
.acf-ui-datepicker .ui-timepicker-div select{
|
647 |
+
background: #fff url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E') no-repeat right 5px top 55% !important;
|
648 |
+
background-size: 16px 16px !important;
|
649 |
+
color: #32373c !important;
|
650 |
+
border-color: #7e8993 !important;
|
651 |
+
}
|
652 |
+
|
653 |
+
.acf-ui-datepicker .ui-datepicker-buttonpane{
|
654 |
+
border:0 !important;
|
655 |
+
padding:7px !important;
|
656 |
+
margin:0 !important;
|
657 |
+
background:#f9f9f9 !important;
|
658 |
+
border-top:1px solid #e1e1e1 !important;
|
659 |
+
border-radius:0 0 4px 4px !important;
|
660 |
+
}
|
661 |
+
.acf-ui-datepicker .ui-datepicker-buttonpane:after{
|
662 |
+
content:'';
|
663 |
+
display:block;
|
664 |
+
clear:both;
|
665 |
+
}
|
666 |
+
.acf-ui-datepicker .ui-datepicker-buttonpane button{
|
667 |
+
display: inline-block;
|
668 |
+
text-decoration: none;
|
669 |
+
font-size: 13px !important;
|
670 |
+
line-height: 2.15384615;
|
671 |
+
min-height: 30px;
|
672 |
+
margin: 0 !important;
|
673 |
+
padding: 0 10px !important;
|
674 |
+
cursor: pointer !important;
|
675 |
+
border-width: 1px !important;
|
676 |
+
border-style: solid !important;
|
677 |
+
-webkit-appearance: none;
|
678 |
+
border-radius: 3px;
|
679 |
+
font-weight: normal !important;
|
680 |
+
white-space: nowrap;
|
681 |
+
box-sizing: border-box;
|
682 |
+
color: #0071a1 !important;
|
683 |
+
border-color: #0071a1 !important;
|
684 |
+
background: #f3f5f6 !important;
|
685 |
+
vertical-align: top;
|
686 |
+
box-shadow:none !important;
|
687 |
+
outline: none !important;
|
688 |
+
opacity: unset !important;
|
689 |
+
filter: unset !important;
|
690 |
+
}
|
691 |
+
|
692 |
+
.acf-ui-datepicker .ui-datepicker-buttonpane button:hover{
|
693 |
+
background: #f1f1f1 !important;
|
694 |
+
border-color: #016087 !important;
|
695 |
+
color: #016087 !important;
|
696 |
}
|
assets/acf-extended.js
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
// init
|
4 |
var acfe = {};
|
5 |
-
|
6 |
-
|
7 |
|
8 |
acfe.modal = {
|
9 |
|
@@ -187,13 +187,20 @@
|
|
187 |
if(!field.has('acfeInstructionsTooltip'))
|
188 |
return;
|
189 |
|
190 |
-
var $label = field.$
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
}
|
|
|
197 |
|
198 |
});
|
199 |
|
@@ -221,8 +228,6 @@
|
|
221 |
|
222 |
acf.addAction('new_field/name=acfe_form_email_content', acfe_form_move_instructions_below);
|
223 |
|
224 |
-
acf.addAction('new_field/name=acfe_form_custom_action', acfe_form_move_instructions_below);
|
225 |
-
|
226 |
acf.addAction('new_field/name=acfe_form_post_save_target', acfe_form_move_instructions_below);
|
227 |
acf.addAction('new_field/name=acfe_form_post_load_source', acfe_form_move_instructions_below);
|
228 |
|
@@ -238,4 +243,10 @@
|
|
238 |
|
239 |
});
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
})(jQuery);
|
2 |
|
3 |
// init
|
4 |
var acfe = {};
|
5 |
+
|
6 |
+
window.acfe = acfe;
|
7 |
|
8 |
acfe.modal = {
|
9 |
|
187 |
if(!field.has('acfeInstructionsTooltip'))
|
188 |
return;
|
189 |
|
190 |
+
var $label = field.$labelWrap().find('> label');
|
191 |
+
var $instructions = field.$labelWrap().find('> .description');
|
192 |
+
var instructions_html = $instructions.html();
|
193 |
+
var instructions_html_2 = field.get('acfeInstructionsTooltip');
|
194 |
+
|
195 |
+
var instructions = instructions_html_2;
|
196 |
+
|
197 |
+
if($instructions.length){
|
198 |
+
|
199 |
+
$instructions.remove();
|
200 |
+
instructions = instructions_html;
|
201 |
+
|
202 |
}
|
203 |
+
$label.before('<span class="acfe-field-tooltip acf-js-tooltip dashicons dashicons-info" title="' + _.escape(instructions) + '"></span>');
|
204 |
|
205 |
});
|
206 |
|
228 |
|
229 |
acf.addAction('new_field/name=acfe_form_email_content', acfe_form_move_instructions_below);
|
230 |
|
|
|
|
|
231 |
acf.addAction('new_field/name=acfe_form_post_save_target', acfe_form_move_instructions_below);
|
232 |
acf.addAction('new_field/name=acfe_form_post_load_source', acfe_form_move_instructions_below);
|
233 |
|
243 |
|
244 |
});
|
245 |
|
246 |
+
acf.addAction('new_field/name=acfe_form_email_files_static', function(field){
|
247 |
+
|
248 |
+
field.$el.find('> .acf-input > .acf-repeater > .acf-actions > .acf-button').removeClass('button-primary');
|
249 |
+
|
250 |
+
});
|
251 |
+
|
252 |
})(jQuery);
|
includes/admin/tools/dbt-export.php
CHANGED
@@ -44,8 +44,8 @@ class ACFE_Admin_Tool_Export_DBT extends ACF_Admin_Tool{
|
|
44 |
|
45 |
// vars
|
46 |
$choices = array();
|
47 |
-
|
48 |
-
|
49 |
|
50 |
if($dynamic_block_types){
|
51 |
|
@@ -315,8 +315,9 @@ class ACFE_Admin_Tool_Export_DBT extends ACF_Admin_Tool{
|
|
315 |
|
316 |
if(!$selected)
|
317 |
return false;
|
318 |
-
|
319 |
-
|
|
|
320 |
if(empty($dynamic_block_types))
|
321 |
return false;
|
322 |
|
44 |
|
45 |
// vars
|
46 |
$choices = array();
|
47 |
+
|
48 |
+
$dynamic_block_types = acfe_settings('modules.dynamic_block_type.data');
|
49 |
|
50 |
if($dynamic_block_types){
|
51 |
|
315 |
|
316 |
if(!$selected)
|
317 |
return false;
|
318 |
+
|
319 |
+
$dynamic_block_types = acfe_settings('modules.dynamic_block_type.data');
|
320 |
+
|
321 |
if(empty($dynamic_block_types))
|
322 |
return false;
|
323 |
|
includes/admin/tools/dbt-import.php
CHANGED
@@ -72,8 +72,8 @@ class ACFE_Admin_Tool_Import_DBT extends ACF_Admin_Tool{
|
|
72 |
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
73 |
|
74 |
$ids = array();
|
75 |
-
|
76 |
-
|
77 |
|
78 |
// Loop over json
|
79 |
foreach($json as $block_type_name => $args){
|
@@ -181,7 +181,7 @@ class ACFE_Admin_Tool_Import_DBT extends ACF_Admin_Tool{
|
|
181 |
ksort($dynamic_block_types);
|
182 |
|
183 |
// Update ACFE option
|
184 |
-
|
185 |
|
186 |
// append message
|
187 |
$ids[] = $post_id;
|
72 |
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
73 |
|
74 |
$ids = array();
|
75 |
+
|
76 |
+
$dynamic_block_types = acfe_settings('modules.dynamic_block_type.data');
|
77 |
|
78 |
// Loop over json
|
79 |
foreach($json as $block_type_name => $args){
|
181 |
ksort($dynamic_block_types);
|
182 |
|
183 |
// Update ACFE option
|
184 |
+
acfe_settings('modules.dynamic_block_type.data', $dynamic_block_types, true);
|
185 |
|
186 |
// append message
|
187 |
$ids[] = $post_id;
|
includes/admin/tools/dop-export.php
CHANGED
@@ -44,8 +44,8 @@ class ACFE_Admin_Tool_Export_DOP extends ACF_Admin_Tool{
|
|
44 |
|
45 |
// vars
|
46 |
$choices = array();
|
47 |
-
|
48 |
-
|
49 |
|
50 |
if($dynamic_options_pages){
|
51 |
foreach($dynamic_options_pages as $options_page_name => $args){
|
@@ -314,8 +314,8 @@ class ACFE_Admin_Tool_Export_DOP extends ACF_Admin_Tool{
|
|
314 |
|
315 |
if(!$selected)
|
316 |
return false;
|
317 |
-
|
318 |
-
|
319 |
if(empty($dynamic_options_pages))
|
320 |
return false;
|
321 |
|
44 |
|
45 |
// vars
|
46 |
$choices = array();
|
47 |
+
|
48 |
+
$dynamic_options_pages = acfe_settings('modules.dynamic_option.data');
|
49 |
|
50 |
if($dynamic_options_pages){
|
51 |
foreach($dynamic_options_pages as $options_page_name => $args){
|
314 |
|
315 |
if(!$selected)
|
316 |
return false;
|
317 |
+
$dynamic_options_pages = acfe_settings('modules.dynamic_option.data');
|
318 |
+
|
319 |
if(empty($dynamic_options_pages))
|
320 |
return false;
|
321 |
|
includes/admin/tools/dop-import.php
CHANGED
@@ -72,8 +72,8 @@ class ACFE_Admin_Tool_Import_DOP extends ACF_Admin_Tool{
|
|
72 |
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
73 |
|
74 |
$ids = array();
|
75 |
-
|
76 |
-
|
77 |
|
78 |
$dynamic_options_sub_pages = array();
|
79 |
|
@@ -130,7 +130,7 @@ class ACFE_Admin_Tool_Import_DOP extends ACF_Admin_Tool{
|
|
130 |
ksort($dynamic_options_pages);
|
131 |
|
132 |
// Update ACFE option
|
133 |
-
|
134 |
|
135 |
// Append message
|
136 |
$ids[] = $post_id;
|
72 |
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
73 |
|
74 |
$ids = array();
|
75 |
+
|
76 |
+
$dynamic_options_pages = acfe_settings('modules.dynamic_option.data');
|
77 |
|
78 |
$dynamic_options_sub_pages = array();
|
79 |
|
130 |
ksort($dynamic_options_pages);
|
131 |
|
132 |
// Update ACFE option
|
133 |
+
acfe_settings('modules.dynamic_option.data', $dynamic_options_pages, true);
|
134 |
|
135 |
// Append message
|
136 |
$ids[] = $post_id;
|
includes/admin/tools/dpt-export.php
CHANGED
@@ -44,8 +44,8 @@ class ACFE_Admin_Tool_Export_DPT extends ACF_Admin_Tool{
|
|
44 |
|
45 |
// vars
|
46 |
$choices = array();
|
47 |
-
|
48 |
-
|
49 |
|
50 |
if($dynamic_post_types){
|
51 |
foreach($dynamic_post_types as $post_type_name => $args){
|
@@ -309,8 +309,9 @@ class ACFE_Admin_Tool_Export_DPT extends ACF_Admin_Tool{
|
|
309 |
|
310 |
if(!$selected)
|
311 |
return false;
|
312 |
-
|
313 |
-
|
|
|
314 |
if(empty($dynamic_post_types))
|
315 |
return false;
|
316 |
|
44 |
|
45 |
// vars
|
46 |
$choices = array();
|
47 |
+
|
48 |
+
$dynamic_post_types = acfe_settings('modules.dynamic_post_type.data');
|
49 |
|
50 |
if($dynamic_post_types){
|
51 |
foreach($dynamic_post_types as $post_type_name => $args){
|
309 |
|
310 |
if(!$selected)
|
311 |
return false;
|
312 |
+
|
313 |
+
$dynamic_post_types = acfe_settings('modules.dynamic_post_type.data');
|
314 |
+
|
315 |
if(empty($dynamic_post_types))
|
316 |
return false;
|
317 |
|
includes/admin/tools/dpt-import.php
CHANGED
@@ -72,8 +72,8 @@ class ACFE_Admin_Tool_Import_DPT extends ACF_Admin_Tool{
|
|
72 |
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
73 |
|
74 |
$ids = array();
|
75 |
-
|
76 |
-
|
77 |
|
78 |
// Loop over json
|
79 |
foreach($json as $post_type_name => $args){
|
@@ -202,7 +202,7 @@ class ACFE_Admin_Tool_Import_DPT extends ACF_Admin_Tool{
|
|
202 |
ksort($dynamic_post_types);
|
203 |
|
204 |
// Update ACFE option
|
205 |
-
|
206 |
|
207 |
// append message
|
208 |
$ids[] = $post_id;
|
72 |
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
73 |
|
74 |
$ids = array();
|
75 |
+
|
76 |
+
$dynamic_post_types = acfe_settings('modules.dynamic_post_type.data');
|
77 |
|
78 |
// Loop over json
|
79 |
foreach($json as $post_type_name => $args){
|
202 |
ksort($dynamic_post_types);
|
203 |
|
204 |
// Update ACFE option
|
205 |
+
acfe_settings('modules.dynamic_post_type.data', $dynamic_post_types, true);
|
206 |
|
207 |
// append message
|
208 |
$ids[] = $post_id;
|
includes/admin/tools/dt-export.php
CHANGED
@@ -44,8 +44,8 @@ class ACFE_Admin_Tool_Export_DT extends ACF_Admin_Tool{
|
|
44 |
|
45 |
// vars
|
46 |
$choices = array();
|
47 |
-
|
48 |
-
|
49 |
|
50 |
if($dynamic_taxonomies){
|
51 |
foreach($dynamic_taxonomies as $taxonomy_name => $args){
|
@@ -321,8 +321,9 @@ class ACFE_Admin_Tool_Export_DT extends ACF_Admin_Tool{
|
|
321 |
|
322 |
if(!$selected)
|
323 |
return false;
|
|
|
|
|
324 |
|
325 |
-
$dynamic_taxonomies = get_option('acfe_dynamic_taxonomies', array());
|
326 |
if(empty($dynamic_taxonomies))
|
327 |
return false;
|
328 |
|
44 |
|
45 |
// vars
|
46 |
$choices = array();
|
47 |
+
|
48 |
+
$dynamic_taxonomies = acfe_settings('modules.dynamic_taxonomy.data');
|
49 |
|
50 |
if($dynamic_taxonomies){
|
51 |
foreach($dynamic_taxonomies as $taxonomy_name => $args){
|
321 |
|
322 |
if(!$selected)
|
323 |
return false;
|
324 |
+
|
325 |
+
$dynamic_taxonomies = acfe_settings('modules.dynamic_taxonomy.data');
|
326 |
|
|
|
327 |
if(empty($dynamic_taxonomies))
|
328 |
return false;
|
329 |
|
includes/admin/tools/dt-import.php
CHANGED
@@ -72,8 +72,8 @@ class ACFE_Admin_Tool_Import_DT extends ACF_Admin_Tool{
|
|
72 |
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
73 |
|
74 |
$ids = array();
|
75 |
-
|
76 |
-
|
77 |
|
78 |
// Loop over json
|
79 |
foreach($json as $taxonomy_name => $args){
|
@@ -200,7 +200,7 @@ class ACFE_Admin_Tool_Import_DT extends ACF_Admin_Tool{
|
|
200 |
ksort($dynamic_taxonomies);
|
201 |
|
202 |
// Update ACFE option
|
203 |
-
|
204 |
|
205 |
// append message
|
206 |
$ids[] = $post_id;
|
72 |
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
73 |
|
74 |
$ids = array();
|
75 |
+
|
76 |
+
$dynamic_taxonomies = acfe_settings('modules.dynamic_taxonomy.data');
|
77 |
|
78 |
// Loop over json
|
79 |
foreach($json as $taxonomy_name => $args){
|
200 |
ksort($dynamic_taxonomies);
|
201 |
|
202 |
// Update ACFE option
|
203 |
+
acfe_settings('modules.dynamic_taxonomy.data', $dynamic_taxonomies, true);
|
204 |
|
205 |
// append message
|
206 |
$ids[] = $post_id;
|
includes/admin/tools/form-export.php
CHANGED
@@ -137,9 +137,9 @@ class ACFE_Admin_Tool_Export_Form extends ACF_Admin_Tool{
|
|
137 |
return acf_add_admin_notice(__('No forms selected'), 'warning');
|
138 |
|
139 |
$keys = array();
|
140 |
-
foreach($this->data as $
|
141 |
|
142 |
-
$keys[] = $
|
143 |
|
144 |
}
|
145 |
|
@@ -189,7 +189,7 @@ class ACFE_Admin_Tool_Export_Form extends ACF_Admin_Tool{
|
|
189 |
continue;
|
190 |
|
191 |
// add to data array
|
192 |
-
$data[
|
193 |
|
194 |
}
|
195 |
|
137 |
return acf_add_admin_notice(__('No forms selected'), 'warning');
|
138 |
|
139 |
$keys = array();
|
140 |
+
foreach($this->data as $args){
|
141 |
|
142 |
+
$keys[] = $args['acfe_form_name'];
|
143 |
|
144 |
}
|
145 |
|
189 |
continue;
|
190 |
|
191 |
// add to data array
|
192 |
+
$data[] = array_merge(array('title' => get_the_title($form->ID)), get_fields($form->ID, false));
|
193 |
|
194 |
}
|
195 |
|
includes/admin/tools/form-import.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
<?php
|
2 |
|
3 |
if(!defined('ABSPATH'))
|
4 |
-
|
5 |
|
6 |
// Check setting
|
7 |
if(!acf_get_setting('acfe/modules/dynamic_forms'))
|
8 |
-
|
9 |
|
10 |
if(!class_exists('ACFE_Admin_Tool_Import_Form')):
|
11 |
|
12 |
class ACFE_Admin_Tool_Import_Form extends ACF_Admin_Tool{
|
13 |
-
|
14 |
function initialize(){
|
15 |
|
16 |
// vars
|
@@ -24,21 +24,21 @@ class ACFE_Admin_Tool_Import_Form extends ACF_Admin_Tool{
|
|
24 |
|
25 |
?>
|
26 |
<p><?php _e('Import Forms', 'acf'); ?></p>
|
27 |
-
|
28 |
<div class="acf-fields">
|
29 |
-
<?php
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
</div>
|
41 |
-
|
42 |
<p class="acf-submit">
|
43 |
<button type="submit" name="action" class="button button-primary"><?php _e('Import File'); ?></button>
|
44 |
</p>
|
@@ -49,96 +49,378 @@ class ACFE_Admin_Tool_Import_Form extends ACF_Admin_Tool{
|
|
49 |
function submit(){
|
50 |
|
51 |
// Check file size.
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
|
79 |
// Check if already exists
|
80 |
-
if(get_page_by_path($
|
81 |
|
82 |
acf_add_admin_notice(__("Form {$args['title']} already exists. Import aborted."), 'warning');
|
|
|
83 |
continue;
|
84 |
|
85 |
}
|
86 |
|
87 |
-
//
|
88 |
-
$
|
89 |
-
$name = $form_name;
|
90 |
-
|
91 |
-
// Insert post
|
92 |
-
$post_id = wp_insert_post(array(
|
93 |
-
'post_title' => $title,
|
94 |
-
'post_name' => $name,
|
95 |
-
'post_type' => 'acfe-form',
|
96 |
-
'post_status' => 'publish'
|
97 |
-
));
|
98 |
|
99 |
// Insert error
|
100 |
-
if(
|
|
|
|
|
101 |
|
102 |
-
acf_add_admin_notice(__("Something went wrong with the form {$title}. Import aborted."), 'warning');
|
103 |
continue;
|
104 |
|
105 |
}
|
106 |
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
115 |
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
|
125 |
-
$text = sprintf(_n('1 form imported', '%s forms imported', $total, 'acf'), $total);
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
-
|
|
|
132 |
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
// Add notice
|
138 |
-
acf_add_admin_notice($text, 'success');
|
139 |
|
140 |
-
|
141 |
-
flush_rewrite_rules();
|
142 |
|
143 |
}
|
144 |
|
@@ -146,4 +428,32 @@ class ACFE_Admin_Tool_Import_Form extends ACF_Admin_Tool{
|
|
146 |
|
147 |
acf_register_admin_tool('ACFE_Admin_Tool_Import_Form');
|
148 |
|
149 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
|
3 |
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
|
6 |
// Check setting
|
7 |
if(!acf_get_setting('acfe/modules/dynamic_forms'))
|
8 |
+
return;
|
9 |
|
10 |
if(!class_exists('ACFE_Admin_Tool_Import_Form')):
|
11 |
|
12 |
class ACFE_Admin_Tool_Import_Form extends ACF_Admin_Tool{
|
13 |
+
|
14 |
function initialize(){
|
15 |
|
16 |
// vars
|
24 |
|
25 |
?>
|
26 |
<p><?php _e('Import Forms', 'acf'); ?></p>
|
27 |
+
|
28 |
<div class="acf-fields">
|
29 |
+
<?php
|
30 |
+
|
31 |
+
acf_render_field_wrap(array(
|
32 |
+
'label' => __('Select File', 'acf'),
|
33 |
+
'type' => 'file',
|
34 |
+
'name' => 'acf_import_file',
|
35 |
+
'value' => false,
|
36 |
+
'uploader' => 'basic',
|
37 |
+
));
|
38 |
+
|
39 |
+
?>
|
40 |
</div>
|
41 |
+
|
42 |
<p class="acf-submit">
|
43 |
<button type="submit" name="action" class="button button-primary"><?php _e('Import File'); ?></button>
|
44 |
</p>
|
49 |
function submit(){
|
50 |
|
51 |
// Check file size.
|
52 |
+
if(empty($_FILES['acf_import_file']['size']))
|
53 |
+
return acf_add_admin_notice(__("No file selected", 'acf'), 'warning');
|
54 |
+
|
55 |
+
// Get file data.
|
56 |
+
$file = $_FILES['acf_import_file'];
|
57 |
+
|
58 |
+
// Check errors.
|
59 |
+
if($file['error'])
|
60 |
+
return acf_add_admin_notice(__("Error uploading file. Please try again", 'acf'), 'warning');
|
61 |
+
|
62 |
+
// Check file type.
|
63 |
+
if(pathinfo($file['name'], PATHINFO_EXTENSION) !== 'json')
|
64 |
+
return acf_add_admin_notice(__("Incorrect file type", 'acf'), 'warning');
|
65 |
+
|
66 |
+
// Read JSON.
|
67 |
+
$json = file_get_contents($file['tmp_name']);
|
68 |
+
$json = json_decode($json, true);
|
69 |
+
|
70 |
+
// Check if empty.
|
71 |
+
if(!$json || !is_array($json))
|
72 |
+
return acf_add_admin_notice(__("Import file empty", 'acf'), 'warning');
|
73 |
+
|
74 |
+
$ids = array();
|
75 |
+
|
76 |
+
// Loop over json
|
77 |
+
foreach($json as $args){
|
78 |
|
79 |
// Check if already exists
|
80 |
+
if(get_page_by_path($args['acfe_form_name'], OBJECT, 'acfe-form')){
|
81 |
|
82 |
acf_add_admin_notice(__("Form {$args['title']} already exists. Import aborted."), 'warning');
|
83 |
+
|
84 |
continue;
|
85 |
|
86 |
}
|
87 |
|
88 |
+
// Import
|
89 |
+
$post_id = $this->import($args);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
// Insert error
|
92 |
+
if(!$post_id){
|
93 |
+
|
94 |
+
acf_add_admin_notice(__("Something went wrong with the form {$args['title']}. Import aborted."), 'warning');
|
95 |
|
|
|
96 |
continue;
|
97 |
|
98 |
}
|
99 |
|
100 |
+
// append message
|
101 |
+
$ids[] = $post_id;
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
if(empty($ids))
|
106 |
+
return false;
|
107 |
+
|
108 |
+
// Count total
|
109 |
+
$total = count($ids);
|
110 |
+
|
111 |
+
// Generate text
|
112 |
+
$text = sprintf(_n('1 form imported', '%s forms imported', $total, 'acf'), $total);
|
113 |
+
|
114 |
+
// Add links to text
|
115 |
+
$links = array();
|
116 |
+
foreach($ids as $id){
|
117 |
+
|
118 |
+
$links[] = '<a href="' . get_edit_post_link($id) . '">' . get_the_title($id) . '</a>';
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
$text .= ': ' . implode(', ', $links);
|
123 |
+
|
124 |
+
// Add notice
|
125 |
+
acf_add_admin_notice($text, 'success');
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
function import($args){
|
130 |
+
|
131 |
+
// Vars
|
132 |
+
$title = acf_extract_var($args, 'title');
|
133 |
+
$name = $args['acfe_form_name'];
|
134 |
+
|
135 |
+
// Insert post
|
136 |
+
$post_id = wp_insert_post(array(
|
137 |
+
'post_title' => $title,
|
138 |
+
'post_name' => $name,
|
139 |
+
'post_type' => 'acfe-form',
|
140 |
+
'post_status' => 'publish'
|
141 |
+
));
|
142 |
+
|
143 |
+
// Insert error
|
144 |
+
if(is_wp_error($post_id))
|
145 |
+
return false;
|
146 |
+
|
147 |
+
acf_enable_filter('local');
|
148 |
+
|
149 |
+
// Import Compatibility
|
150 |
+
$args = $this->import_compatibility($args);
|
151 |
+
|
152 |
+
// Update Values
|
153 |
+
acf_update_values($args, $post_id);
|
154 |
+
|
155 |
+
acf_disable_filter('local');
|
156 |
+
|
157 |
+
return $post_id;
|
158 |
+
|
159 |
+
}
|
160 |
+
|
161 |
+
function import_compatibility($args){
|
162 |
+
|
163 |
+
// ACF Extended: 0.8.5 Compatibility - Step 1
|
164 |
+
// Groups upgrade
|
165 |
+
$has_upgraded = false;
|
166 |
+
|
167 |
+
$rules = array(
|
168 |
+
|
169 |
+
// Post: title
|
170 |
+
array(
|
171 |
+
'group' => 'field_acfe_form_post_save_post_title_group',
|
172 |
+
'sub_field' => 'field_acfe_form_post_save_post_title',
|
173 |
+
'sub_field_custom' => 'field_acfe_form_post_save_post_title_custom',
|
174 |
+
),
|
175 |
+
|
176 |
+
// Post: name
|
177 |
+
array(
|
178 |
+
'group' => 'field_acfe_form_post_save_post_name_group',
|
179 |
+
'sub_field' => 'field_acfe_form_post_save_post_name',
|
180 |
+
'sub_field_custom' => 'field_acfe_form_post_save_post_name_custom',
|
181 |
+
),
|
182 |
+
|
183 |
+
// Term: name
|
184 |
+
array(
|
185 |
+
'group' => 'field_acfe_form_term_save_name_group',
|
186 |
+
'sub_field' => 'field_acfe_form_term_save_name',
|
187 |
+
'sub_field_custom' => 'field_acfe_form_term_save_name_custom',
|
188 |
+
),
|
189 |
|
190 |
+
// Term: slug
|
191 |
+
array(
|
192 |
+
'group' => 'field_acfe_form_term_save_slug_group',
|
193 |
+
'sub_field' => 'field_acfe_form_term_save_slug',
|
194 |
+
'sub_field_custom' => 'field_acfe_form_term_save_slug_custom',
|
195 |
+
),
|
196 |
|
197 |
+
// User: e-mail
|
198 |
+
array(
|
199 |
+
'group' => 'field_acfe_form_user_save_email_group',
|
200 |
+
'sub_field' => 'field_acfe_form_user_save_email',
|
201 |
+
'sub_field_custom' => 'field_acfe_form_user_save_email_custom',
|
202 |
+
),
|
203 |
|
204 |
+
// User: username
|
205 |
+
array(
|
206 |
+
'group' => 'field_acfe_form_user_save_username_group',
|
207 |
+
'sub_field' => 'field_acfe_form_user_save_username',
|
208 |
+
'sub_field_custom' => 'field_acfe_form_user_save_username_custom',
|
209 |
+
),
|
210 |
|
211 |
+
// User: password
|
212 |
+
array(
|
213 |
+
'group' => 'field_acfe_form_user_save_password_group',
|
214 |
+
'sub_field' => 'field_acfe_form_user_save_password',
|
215 |
+
'sub_field_custom' => 'field_acfe_form_user_save_password_custom',
|
216 |
+
),
|
217 |
+
|
218 |
+
// User: first name
|
219 |
+
array(
|
220 |
+
'group' => 'field_acfe_form_user_save_first_name_group',
|
221 |
+
'sub_field' => 'field_acfe_form_user_save_first_name',
|
222 |
+
'sub_field_custom' => 'field_acfe_form_user_save_first_name_custom',
|
223 |
+
),
|
224 |
+
|
225 |
+
// User: last name
|
226 |
+
array(
|
227 |
+
'group' => 'field_acfe_form_user_save_last_name_group',
|
228 |
+
'sub_field' => 'field_acfe_form_user_save_last_name',
|
229 |
+
'sub_field_custom' => 'field_acfe_form_user_save_last_name_custom',
|
230 |
+
),
|
231 |
+
|
232 |
+
// User: nickname
|
233 |
+
array(
|
234 |
+
'group' => 'field_acfe_form_user_save_nickname_group',
|
235 |
+
'sub_field' => 'field_acfe_form_user_save_nickname',
|
236 |
+
'sub_field_custom' => 'field_acfe_form_user_save_nickname_custom',
|
237 |
+
),
|
238 |
+
|
239 |
+
// User: display name
|
240 |
+
array(
|
241 |
+
'group' => 'field_acfe_form_user_save_display_name_group',
|
242 |
+
'sub_field' => 'field_acfe_form_user_save_display_name',
|
243 |
+
'sub_field_custom' => 'field_acfe_form_user_save_display_name_custom',
|
244 |
+
),
|
245 |
+
|
246 |
+
// User: website
|
247 |
+
array(
|
248 |
+
'group' => 'field_acfe_form_user_save_website_group',
|
249 |
+
'sub_field' => 'field_acfe_form_user_save_website',
|
250 |
+
'sub_field_custom' => 'field_acfe_form_user_save_website_custom',
|
251 |
+
),
|
252 |
|
253 |
+
);
|
254 |
+
|
255 |
+
foreach($args['acfe_form_actions'] as &$row){
|
256 |
+
|
257 |
+
foreach($rules as $rule){
|
258 |
+
|
259 |
+
if(!acf_maybe_get($row, $rule['group']))
|
260 |
+
continue;
|
261 |
+
|
262 |
+
$value = null;
|
263 |
+
$group = $row[$rule['group']];
|
264 |
+
|
265 |
+
if(acf_maybe_get($group, $rule['sub_field']) === 'custom'){
|
266 |
+
|
267 |
+
$value = acf_maybe_get($group, $rule['sub_field_custom']);
|
268 |
+
|
269 |
+
}else{
|
270 |
+
|
271 |
+
$value = acf_maybe_get($group, $rule['sub_field']);
|
272 |
+
|
273 |
+
}
|
274 |
+
|
275 |
+
unset($row[$rule['group']]);
|
276 |
+
|
277 |
+
$row[$rule['sub_field']] = $value;
|
278 |
+
|
279 |
+
$has_upgraded = true;
|
280 |
+
|
281 |
+
}
|
282 |
+
|
283 |
+
}
|
284 |
+
|
285 |
+
// ACF Extended: 0.8.5 Compatibility - Step 2
|
286 |
+
// Field mapping upgrade
|
287 |
+
if($has_upgraded){
|
288 |
+
|
289 |
+
// Rules
|
290 |
+
$rules = array(
|
291 |
+
|
292 |
+
array(
|
293 |
+
'load_values' => 'field_acfe_form_post_load_values',
|
294 |
+
'fields' => array(
|
295 |
+
'field_acfe_form_post_map_post_type' => 'field_acfe_form_post_save_post_type',
|
296 |
+
'field_acfe_form_post_map_post_status' => 'field_acfe_form_post_save_post_status',
|
297 |
+
'field_acfe_form_post_map_post_title' => 'field_acfe_form_post_save_post_title',
|
298 |
+
'field_acfe_form_post_map_post_name' => 'field_acfe_form_post_save_post_name',
|
299 |
+
'field_acfe_form_post_map_post_content' => 'field_acfe_form_post_save_post_content',
|
300 |
+
'field_acfe_form_post_map_post_author' => 'field_acfe_form_post_save_post_author',
|
301 |
+
'field_acfe_form_post_map_post_parent' => 'field_acfe_form_post_save_post_parent',
|
302 |
+
'field_acfe_form_post_map_post_terms' => 'field_acfe_form_post_save_post_terms',
|
303 |
+
)
|
304 |
+
),
|
305 |
+
|
306 |
+
array(
|
307 |
+
'load_values' => 'field_acfe_form_term_load_values',
|
308 |
+
'fields' => array(
|
309 |
+
'field_acfe_form_term_map_name' => 'field_acfe_form_term_save_name',
|
310 |
+
'field_acfe_form_term_map_slug' => 'field_acfe_form_term_save_slug',
|
311 |
+
'field_acfe_form_term_map_taxonomy' => 'field_acfe_form_term_save_taxonomy',
|
312 |
+
'field_acfe_form_term_map_parent' => 'field_acfe_form_term_save_parent',
|
313 |
+
'field_acfe_form_term_map_description' => 'field_acfe_form_term_save_description',
|
314 |
+
)
|
315 |
+
),
|
316 |
+
|
317 |
+
array(
|
318 |
+
'load_values' => 'field_acfe_form_user_load_values',
|
319 |
+
'fields' => array(
|
320 |
+
'field_acfe_form_user_map_email' => 'field_acfe_form_user_save_email',
|
321 |
+
'field_acfe_form_user_map_username' => 'field_acfe_form_user_save_username',
|
322 |
+
'field_acfe_form_user_map_password' => 'field_acfe_form_user_save_password',
|
323 |
+
'field_acfe_form_user_map_first_name' => 'field_acfe_form_user_save_first_name',
|
324 |
+
'field_acfe_form_user_map_last_name' => 'field_acfe_form_user_save_last_name',
|
325 |
+
'field_acfe_form_user_map_nickname' => 'field_acfe_form_user_save_nickname',
|
326 |
+
'field_acfe_form_user_map_display_name' => 'field_acfe_form_user_save_display_name',
|
327 |
+
'field_acfe_form_user_map_website' => 'field_acfe_form_user_save_website',
|
328 |
+
'field_acfe_form_user_map_description' => 'field_acfe_form_user_save_description',
|
329 |
+
'field_acfe_form_user_map_role' => 'field_acfe_form_user_save_role',
|
330 |
+
)
|
331 |
+
),
|
332 |
+
|
333 |
+
);
|
334 |
+
|
335 |
+
foreach($args['acfe_form_actions'] as &$row){
|
336 |
+
|
337 |
+
foreach($rules as $rule){
|
338 |
+
|
339 |
+
$load_values = acf_maybe_get($row, $rule['load_values']);
|
340 |
+
$fields = $rule['fields'];
|
341 |
+
|
342 |
+
if(!empty($load_values))
|
343 |
+
continue;
|
344 |
+
|
345 |
+
foreach($fields as $map => $save){
|
346 |
+
|
347 |
+
$map_value = acf_maybe_get($row, $map);
|
348 |
+
|
349 |
+
if(empty($map_value))
|
350 |
+
continue;
|
351 |
+
|
352 |
+
if($save === 'field_acfe_form_post_save_post_content'){
|
353 |
+
|
354 |
+
$row['field_acfe_form_post_save_post_content_group'][$save] = $map_value;
|
355 |
+
|
356 |
+
}
|
357 |
+
|
358 |
+
elseif($save === 'field_acfe_form_term_save_description'){
|
359 |
|
360 |
+
$row['field_acfe_form_term_save_description_group'][$save] = $map_value;
|
|
|
361 |
|
362 |
+
}
|
363 |
+
|
364 |
+
elseif($save === 'field_acfe_form_user_save_description'){
|
365 |
+
|
366 |
+
$row['field_acfe_form_user_save_description_group'][$save] = $map_value;
|
367 |
+
|
368 |
+
}
|
369 |
+
|
370 |
+
else{
|
371 |
+
|
372 |
+
$row[$save] = $map_value;
|
373 |
+
|
374 |
+
}
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
}
|
379 |
+
|
380 |
+
}
|
381 |
+
|
382 |
+
}
|
383 |
+
|
384 |
+
return $args;
|
385 |
+
|
386 |
+
}
|
387 |
+
|
388 |
+
function import_external($data){
|
389 |
+
|
390 |
+
$ids = array();
|
391 |
+
|
392 |
+
// Loop over args
|
393 |
+
foreach($data as $args){
|
394 |
|
395 |
+
// Check if already exists
|
396 |
+
$form_exists = get_page_by_path($args['acfe_form_name'], OBJECT, 'acfe-form');
|
397 |
|
398 |
+
if($form_exists)
|
399 |
+
continue;
|
400 |
+
|
401 |
+
// Import
|
402 |
+
$post_id = $this->import($args);
|
403 |
+
|
404 |
+
// Insert error
|
405 |
+
if(!$post_id)
|
406 |
+
continue;
|
407 |
+
|
408 |
+
$name = get_field('acfe_form_name', $post_id);
|
409 |
+
|
410 |
+
$return = array(
|
411 |
+
'id' => $post_id,
|
412 |
+
'name' => $name,
|
413 |
+
);
|
414 |
+
|
415 |
+
// append message
|
416 |
+
$ids[] = $return;
|
417 |
+
|
418 |
+
}
|
419 |
|
420 |
+
if(empty($ids))
|
421 |
+
return false;
|
|
|
|
|
422 |
|
423 |
+
return $ids;
|
|
|
424 |
|
425 |
}
|
426 |
|
428 |
|
429 |
acf_register_admin_tool('ACFE_Admin_Tool_Import_Form');
|
430 |
|
431 |
+
endif;
|
432 |
+
|
433 |
+
/*
|
434 |
+
* ACFE: Import Dynamic Form
|
435 |
+
*
|
436 |
+
* $args: Accepts array() or json
|
437 |
+
* return: A list of form_id & form_name
|
438 |
+
*/
|
439 |
+
function acfe_import_dynamic_form($args = false){
|
440 |
+
|
441 |
+
if(!$args)
|
442 |
+
return false;
|
443 |
+
|
444 |
+
// json
|
445 |
+
if(is_string($args)){
|
446 |
+
|
447 |
+
$args = json_decode($args, true);
|
448 |
+
|
449 |
+
}
|
450 |
+
|
451 |
+
if(!is_array($args) || empty($args))
|
452 |
+
return false;
|
453 |
+
|
454 |
+
// Tool
|
455 |
+
$tool = acf()->admin_tools->get_tool('ACFE_Admin_Tool_Import_Form');
|
456 |
+
|
457 |
+
return $tool->import_external($args);
|
458 |
+
|
459 |
+
}
|
includes/core/compatibility.php
CHANGED
@@ -50,11 +50,15 @@ class acfe_compatibility{
|
|
50 |
add_filter('wpseo_metabox_prio', array($this, 'yoast_metaboxes_priority'));
|
51 |
|
52 |
}
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
58 |
function field_group_location_list($field_group){
|
59 |
|
60 |
if(!acf_maybe_get($field_group, 'location'))
|
@@ -90,11 +94,15 @@ class acfe_compatibility{
|
|
90 |
return $field_group;
|
91 |
|
92 |
}
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
98 |
function field_acfe_update($field){
|
99 |
|
100 |
if(!acf_maybe_get($field, 'acfe_update'))
|
@@ -105,14 +113,18 @@ class acfe_compatibility{
|
|
105 |
return $field;
|
106 |
|
107 |
}
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
113 |
function field_seamless_style($field){
|
114 |
|
115 |
-
if($seamless = acf_maybe_get($field, '
|
116 |
|
117 |
$field['acfe_seamless_style'] = $seamless;
|
118 |
|
@@ -121,11 +133,16 @@ class acfe_compatibility{
|
|
121 |
return $field;
|
122 |
|
123 |
}
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
129 |
function field_flexible_settings_title($fields, $parent){
|
130 |
|
131 |
// Check if is tool screen
|
@@ -149,12 +166,18 @@ class acfe_compatibility{
|
|
149 |
return $fields;
|
150 |
|
151 |
}
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
function pto_acf_field_group($ignore, $orderby, $query){
|
159 |
|
160 |
if(is_admin() && $query->is_main_query() && $query->get('post_type') === 'acf-field-group')
|
@@ -196,12 +219,17 @@ class acfe_compatibility{
|
|
196 |
return 'default';
|
197 |
|
198 |
}
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
|
|
|
|
|
|
|
|
|
|
205 |
function polylang($post_types, $is_settings){
|
206 |
|
207 |
if($is_settings){
|
50 |
add_filter('wpseo_metabox_prio', array($this, 'yoast_metaboxes_priority'));
|
51 |
|
52 |
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* ACF Extended: 0.8
|
56 |
+
* Field Group Location: Archive renamed to List
|
57 |
+
*
|
58 |
+
* @param $field_group
|
59 |
+
*
|
60 |
+
* @return mixed
|
61 |
+
*/
|
62 |
function field_group_location_list($field_group){
|
63 |
|
64 |
if(!acf_maybe_get($field_group, 'location'))
|
94 |
return $field_group;
|
95 |
|
96 |
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* ACF Extended: 0.8
|
100 |
+
* Field Filter Value: Removed from this version
|
101 |
+
*
|
102 |
+
* @param $field
|
103 |
+
*
|
104 |
+
* @return mixed
|
105 |
+
*/
|
106 |
function field_acfe_update($field){
|
107 |
|
108 |
if(!acf_maybe_get($field, 'acfe_update'))
|
113 |
return $field;
|
114 |
|
115 |
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* ACF Extended: 0.8.5
|
119 |
+
* Field Group/Clone: Fixed typo "Seamless"
|
120 |
+
*
|
121 |
+
* @param $field
|
122 |
+
*
|
123 |
+
* @return mixed
|
124 |
+
*/
|
125 |
function field_seamless_style($field){
|
126 |
|
127 |
+
if($seamless = acf_maybe_get($field, 'acfe_seemless_style', false)){
|
128 |
|
129 |
$field['acfe_seamless_style'] = $seamless;
|
130 |
|
133 |
return $field;
|
134 |
|
135 |
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* ACF Extended: 0.8.4.5
|
139 |
+
* Field Flexible Content: Fix duplicated "layout_settings" & "layout_title"
|
140 |
+
*
|
141 |
+
* @param $fields
|
142 |
+
* @param $parent
|
143 |
+
*
|
144 |
+
* @return mixed
|
145 |
+
*/
|
146 |
function field_flexible_settings_title($fields, $parent){
|
147 |
|
148 |
// Check if is tool screen
|
166 |
return $fields;
|
167 |
|
168 |
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Plugin: Post Types Order
|
172 |
+
* https://wordpress.org/plugins/post-types-order/
|
173 |
+
* The plugin apply custom order to 'acf-field-group' Post Type. We have to fix this
|
174 |
+
*
|
175 |
+
* @param $ignore
|
176 |
+
* @param $orderby
|
177 |
+
* @param $query
|
178 |
+
*
|
179 |
+
* @return bool
|
180 |
+
*/
|
181 |
function pto_acf_field_group($ignore, $orderby, $query){
|
182 |
|
183 |
if(is_admin() && $query->is_main_query() && $query->get('post_type') === 'acf-field-group')
|
219 |
return 'default';
|
220 |
|
221 |
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* ACF Extended: 0.8.3
|
225 |
+
* Modules: Enable PolyLang Translation for Modules Post Types
|
226 |
+
* https://polylang.pro/doc/filter-reference/
|
227 |
+
*
|
228 |
+
* @param $post_types
|
229 |
+
* @param $is_settings
|
230 |
+
*
|
231 |
+
* @return mixed
|
232 |
+
*/
|
233 |
function polylang($post_types, $is_settings){
|
234 |
|
235 |
if($is_settings){
|
includes/core/helpers.php
CHANGED
@@ -341,6 +341,40 @@ function acfe_get_field_group_from_field($field){
|
|
341 |
|
342 |
}
|
343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
/**
|
345 |
* Add custom key to fields and all sub fields
|
346 |
*/
|
@@ -833,6 +867,42 @@ function acfe_number_suffix($num){
|
|
833 |
|
834 |
}
|
835 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
836 |
function acfe_get_acf_screen_id($page = ''){
|
837 |
|
838 |
$prefix = sanitize_title( __("Custom Fields", 'acf') );
|
@@ -882,4 +952,16 @@ function acfe_is_admin_screen($modules = false){
|
|
882 |
|
883 |
return false;
|
884 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
885 |
}
|
341 |
|
342 |
}
|
343 |
|
344 |
+
/**
|
345 |
+
* Add fields isntructions tooltip
|
346 |
+
*/
|
347 |
+
function acfe_add_fields_instructions_tooltip(&$field){
|
348 |
+
|
349 |
+
$instructions = '';
|
350 |
+
|
351 |
+
if(acf_maybe_get($field, 'instructions'))
|
352 |
+
$instructions = acf_esc_html($field['instructions']);
|
353 |
+
|
354 |
+
if(isset($field['sub_fields'])){
|
355 |
+
|
356 |
+
foreach($field['sub_fields'] as &$sub_field){
|
357 |
+
|
358 |
+
acfe_add_fields_instructions_tooltip($sub_field);
|
359 |
+
|
360 |
+
}
|
361 |
+
|
362 |
+
}
|
363 |
+
|
364 |
+
elseif(isset($field['layouts'])){
|
365 |
+
|
366 |
+
foreach($field['layouts'] as &$layout){
|
367 |
+
|
368 |
+
acfe_add_fields_instructions_tooltip($layout);
|
369 |
+
|
370 |
+
}
|
371 |
+
|
372 |
+
}
|
373 |
+
|
374 |
+
$field['acfe_instructions_tooltip'] = $instructions;
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
/**
|
379 |
* Add custom key to fields and all sub fields
|
380 |
*/
|
867 |
|
868 |
}
|
869 |
|
870 |
+
function acfe_array_to_string($array = array()){
|
871 |
+
|
872 |
+
if(!is_array($array))
|
873 |
+
return $array;
|
874 |
+
|
875 |
+
if(empty($array))
|
876 |
+
return false;
|
877 |
+
|
878 |
+
if(acf_is_sequential_array($array)){
|
879 |
+
|
880 |
+
foreach($array as $k => $v){
|
881 |
+
|
882 |
+
if(!is_string($v))
|
883 |
+
continue;
|
884 |
+
|
885 |
+
return $v;
|
886 |
+
|
887 |
+
}
|
888 |
+
|
889 |
+
}elseif(acf_is_associative_array($array)){
|
890 |
+
|
891 |
+
foreach($array as $k => $v){
|
892 |
+
|
893 |
+
if(!is_string($v))
|
894 |
+
continue;
|
895 |
+
|
896 |
+
return $v;
|
897 |
+
|
898 |
+
}
|
899 |
+
|
900 |
+
}
|
901 |
+
|
902 |
+
return false;
|
903 |
+
|
904 |
+
}
|
905 |
+
|
906 |
function acfe_get_acf_screen_id($page = ''){
|
907 |
|
908 |
$prefix = sanitize_title( __("Custom Fields", 'acf') );
|
952 |
|
953 |
return false;
|
954 |
|
955 |
+
}
|
956 |
+
|
957 |
+
function acfe_is_dev(){
|
958 |
+
|
959 |
+
return acf_get_setting('acfe/dev', false) || (defined('ACFE_dev') && ACFE_dev);
|
960 |
+
|
961 |
+
}
|
962 |
+
|
963 |
+
function acfe_is_super_dev(){
|
964 |
+
|
965 |
+
return acf_get_setting('acfe/super_dev', false) || (defined('ACFE_super_dev') && ACFE_super_dev);
|
966 |
+
|
967 |
}
|
includes/core/settings.php
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
acf_register_store('acfe/settings');
|
4 |
+
|
5 |
+
if(!class_exists('acfe_settings')):
|
6 |
+
|
7 |
+
class acfe_settings{
|
8 |
+
|
9 |
+
public $settings = array();
|
10 |
+
|
11 |
+
public $model = array(
|
12 |
+
|
13 |
+
// Version
|
14 |
+
'version' => ACFE_VERSION,
|
15 |
+
|
16 |
+
// Modules
|
17 |
+
'modules' => array(
|
18 |
+
|
19 |
+
'author' => array(
|
20 |
+
'active' => true,
|
21 |
+
),
|
22 |
+
|
23 |
+
'dev' => array(
|
24 |
+
'active' => false,
|
25 |
+
),
|
26 |
+
|
27 |
+
'meta' => array(
|
28 |
+
'active' => false,
|
29 |
+
),
|
30 |
+
|
31 |
+
'option' => array(
|
32 |
+
'active' => true,
|
33 |
+
),
|
34 |
+
|
35 |
+
'taxonomy' => array(
|
36 |
+
'active' => true,
|
37 |
+
),
|
38 |
+
|
39 |
+
'dynamic_block_type' => array(
|
40 |
+
'active' => true,
|
41 |
+
'settings' => array(),
|
42 |
+
'data' => array()
|
43 |
+
),
|
44 |
+
|
45 |
+
'dynamic_form' => array(
|
46 |
+
'active' => true,
|
47 |
+
'settings' => array(),
|
48 |
+
'data' => array()
|
49 |
+
),
|
50 |
+
|
51 |
+
'dynamic_option' => array(
|
52 |
+
'active' => true,
|
53 |
+
'settings' => array(),
|
54 |
+
'data' => array()
|
55 |
+
),
|
56 |
+
|
57 |
+
'dynamic_post_type' => array(
|
58 |
+
'active' => true,
|
59 |
+
'settings' => array(),
|
60 |
+
'data' => array()
|
61 |
+
),
|
62 |
+
|
63 |
+
'dynamic_taxonomy' => array(
|
64 |
+
'active' => true,
|
65 |
+
'settings' => array(),
|
66 |
+
'data' => array()
|
67 |
+
),
|
68 |
+
|
69 |
+
),
|
70 |
+
|
71 |
+
// Upgrades
|
72 |
+
'upgrades' => array(
|
73 |
+
'0_8_5' => true,
|
74 |
+
),
|
75 |
+
);
|
76 |
+
|
77 |
+
function __construct(){
|
78 |
+
|
79 |
+
$option = get_option('acfe', array());
|
80 |
+
|
81 |
+
$this->settings = acf_get_store('acfe/settings');
|
82 |
+
|
83 |
+
if(!empty($option)){
|
84 |
+
|
85 |
+
$this->settings->set($option);
|
86 |
+
|
87 |
+
$this->version();
|
88 |
+
|
89 |
+
}else{
|
90 |
+
|
91 |
+
$this->reset();
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
function get($selector = false){
|
98 |
+
|
99 |
+
return $this->array_get($this->settings->get(), $selector);
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
function set($selector = false, $value = null, $update = true, $append = false){
|
104 |
+
|
105 |
+
if($value === null)
|
106 |
+
return false;
|
107 |
+
|
108 |
+
$rows = $this->settings->get();
|
109 |
+
|
110 |
+
if($append){
|
111 |
+
|
112 |
+
$this->array_append($rows, $selector, $value);
|
113 |
+
|
114 |
+
}else{
|
115 |
+
|
116 |
+
$this->array_set($rows, $selector, $value);
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
$this->settings->set($rows);
|
121 |
+
|
122 |
+
if($update)
|
123 |
+
$this->update();
|
124 |
+
|
125 |
+
return $this;
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
function clear($selector = false, $update = true){
|
130 |
+
|
131 |
+
$rows = $this->settings->get();
|
132 |
+
|
133 |
+
$this->array_clear($rows, $selector);
|
134 |
+
|
135 |
+
$this->settings->set($rows);
|
136 |
+
|
137 |
+
if($update)
|
138 |
+
$this->update();
|
139 |
+
|
140 |
+
return $this;
|
141 |
+
|
142 |
+
}
|
143 |
+
|
144 |
+
function delete($selector = false, $update = true){
|
145 |
+
|
146 |
+
// Single
|
147 |
+
if(strpos($selector, '.') === false){
|
148 |
+
|
149 |
+
$this->settings->remove($selector);
|
150 |
+
|
151 |
+
// Array
|
152 |
+
}else{
|
153 |
+
|
154 |
+
$rows = $this->settings->get();
|
155 |
+
|
156 |
+
$this->array_remove($rows, $selector);
|
157 |
+
|
158 |
+
$this->settings->set($rows);
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
if($update)
|
163 |
+
$this->update();
|
164 |
+
|
165 |
+
return $this;
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
function append($selector = false, $value = null, $update = true){
|
170 |
+
|
171 |
+
if($selector === false && $value === null)
|
172 |
+
return false;
|
173 |
+
|
174 |
+
// Allow simple append without selector
|
175 |
+
if($value === null){
|
176 |
+
|
177 |
+
$value = $selector;
|
178 |
+
$selector = false;
|
179 |
+
|
180 |
+
}
|
181 |
+
|
182 |
+
return $this->set($selector, $value, $update, true);
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
function array_get($array, $key, $default = null) {
|
187 |
+
|
188 |
+
if(empty($key))
|
189 |
+
return $array;
|
190 |
+
|
191 |
+
if(!is_array($key))
|
192 |
+
$key = explode('.', $key);
|
193 |
+
|
194 |
+
$count = count($key);
|
195 |
+
$i=-1;
|
196 |
+
|
197 |
+
foreach($key as $segment){
|
198 |
+
|
199 |
+
$i++;
|
200 |
+
|
201 |
+
if(!isset($array[$segment]))
|
202 |
+
continue;
|
203 |
+
|
204 |
+
if($i+1 === $count){
|
205 |
+
|
206 |
+
return $array[$segment];
|
207 |
+
|
208 |
+
}
|
209 |
+
|
210 |
+
unset($key[$i]);
|
211 |
+
|
212 |
+
return $this->array_get($array[$segment], $key, $default);
|
213 |
+
|
214 |
+
|
215 |
+
}
|
216 |
+
|
217 |
+
return $default;
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
function array_set(&$array, $key, $value){
|
222 |
+
|
223 |
+
if(empty($key))
|
224 |
+
return $array = $value;
|
225 |
+
|
226 |
+
$keys = explode('.', $key);
|
227 |
+
|
228 |
+
while(count($keys) > 1){
|
229 |
+
|
230 |
+
$key = array_shift($keys);
|
231 |
+
|
232 |
+
if(!isset($array[$key]) || !is_array($array[$key])){
|
233 |
+
|
234 |
+
$array[$key] = array();
|
235 |
+
|
236 |
+
}
|
237 |
+
|
238 |
+
$array =& $array[$key];
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
$array[array_shift($keys)] = $value;
|
243 |
+
|
244 |
+
return $array;
|
245 |
+
|
246 |
+
}
|
247 |
+
|
248 |
+
function array_append(&$array, $key, $value){
|
249 |
+
|
250 |
+
$get = $this->array_get($array, $key);
|
251 |
+
|
252 |
+
$old = acf_get_array($get);
|
253 |
+
$value = acf_get_array($value);
|
254 |
+
|
255 |
+
$value = array_merge($old, $value);
|
256 |
+
|
257 |
+
$this->array_set($array, $key, $value);
|
258 |
+
|
259 |
+
return $array;
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
function array_clear(&$array, $key){
|
264 |
+
|
265 |
+
$get = $this->array_get($array, $key);
|
266 |
+
|
267 |
+
if($get === null)
|
268 |
+
return $array;
|
269 |
+
|
270 |
+
$value = null;
|
271 |
+
|
272 |
+
if(is_array($get))
|
273 |
+
$value = array();
|
274 |
+
|
275 |
+
$this->array_set($array, $key, $value);
|
276 |
+
|
277 |
+
return $array;
|
278 |
+
|
279 |
+
}
|
280 |
+
|
281 |
+
function array_remove(&$array, $keys){
|
282 |
+
|
283 |
+
$original =& $array;
|
284 |
+
|
285 |
+
foreach((array)$keys as $key){
|
286 |
+
|
287 |
+
$parts = explode('.', $key);
|
288 |
+
|
289 |
+
while(count($parts) > 1){
|
290 |
+
|
291 |
+
$part = array_shift($parts);
|
292 |
+
|
293 |
+
if(isset($array[$part]) && is_array($array[$part])){
|
294 |
+
|
295 |
+
$array =& $array[$part];
|
296 |
+
|
297 |
+
}
|
298 |
+
|
299 |
+
}
|
300 |
+
|
301 |
+
unset($array[array_shift($parts)]);
|
302 |
+
|
303 |
+
// clean up after each pass
|
304 |
+
$array =& $original;
|
305 |
+
|
306 |
+
}
|
307 |
+
|
308 |
+
}
|
309 |
+
|
310 |
+
function reset(){
|
311 |
+
|
312 |
+
$this->set('', $this->model, true);
|
313 |
+
|
314 |
+
}
|
315 |
+
|
316 |
+
function version(){
|
317 |
+
|
318 |
+
$version = $this->get('version');
|
319 |
+
|
320 |
+
if(!$version || acf_version_compare($version, '<', ACFE_VERSION)){
|
321 |
+
|
322 |
+
$data = $this->get();
|
323 |
+
$model = $this->model;
|
324 |
+
|
325 |
+
$new_model = $this->parse_args_r($data, $model);
|
326 |
+
|
327 |
+
$new_model['version'] = ACFE_VERSION;
|
328 |
+
|
329 |
+
$this->set('', $new_model, true);
|
330 |
+
|
331 |
+
}
|
332 |
+
|
333 |
+
}
|
334 |
+
|
335 |
+
function update(){
|
336 |
+
|
337 |
+
$settings = $this->settings->get();
|
338 |
+
|
339 |
+
update_option('acfe', $settings, 'true');
|
340 |
+
|
341 |
+
}
|
342 |
+
|
343 |
+
function parse_args_r(&$a, $b){
|
344 |
+
|
345 |
+
$a = (array) $a;
|
346 |
+
$b = (array) $b;
|
347 |
+
$r = $b;
|
348 |
+
|
349 |
+
foreach($a as $k => &$v){
|
350 |
+
|
351 |
+
if(is_array($v) && isset($r[ $k ])){
|
352 |
+
$r[$k] = $this->parse_args_r($v, $r[ $k ]);
|
353 |
+
}else{
|
354 |
+
$r[$k] = $v;
|
355 |
+
}
|
356 |
+
|
357 |
+
}
|
358 |
+
|
359 |
+
return $r;
|
360 |
+
|
361 |
+
}
|
362 |
+
|
363 |
+
}
|
364 |
+
|
365 |
+
endif;
|
366 |
+
|
367 |
+
function acfe_settings($selector = null, $value = null, $update = true){
|
368 |
+
|
369 |
+
$instance = acf_get_instance('acfe_settings');
|
370 |
+
|
371 |
+
// Set
|
372 |
+
if($selector !== null && $value !== null){
|
373 |
+
|
374 |
+
return $instance->set($selector, $value, $update);
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
// Get
|
379 |
+
elseif($selector !== null && $value === null){
|
380 |
+
|
381 |
+
return $instance->get($selector);
|
382 |
+
|
383 |
+
}
|
384 |
+
|
385 |
+
return $instance;
|
386 |
+
|
387 |
+
}
|
includes/core/upgrades.php
ADDED
@@ -0,0 +1,564 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!class_exists('acfe_upgrades')):
|
4 |
+
|
5 |
+
class acfe_upgrades{
|
6 |
+
|
7 |
+
function __construct(){
|
8 |
+
|
9 |
+
$upgrades = acfe_settings('upgrades');
|
10 |
+
|
11 |
+
if(empty($upgrades))
|
12 |
+
return;
|
13 |
+
|
14 |
+
// ACF Extended: 0.8.5
|
15 |
+
add_action('acf/init', array($this, 'upgrade_0_8_5'), 999);
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
function upgrade_0_8_5(){
|
20 |
+
|
21 |
+
$todo = acfe_settings('upgrades.0_8_5');
|
22 |
+
|
23 |
+
if(!$todo)
|
24 |
+
return;
|
25 |
+
|
26 |
+
$tasks = array(
|
27 |
+
'dynamic_form',
|
28 |
+
'dynamic_post_type',
|
29 |
+
'dynamic_taxonomy',
|
30 |
+
'dynamic_block_type',
|
31 |
+
'dynamic_option',
|
32 |
+
);
|
33 |
+
|
34 |
+
foreach($tasks as $task){
|
35 |
+
|
36 |
+
/*
|
37 |
+
* Forms
|
38 |
+
*/
|
39 |
+
if($task === 'dynamic_form'){
|
40 |
+
|
41 |
+
acf_log('[ACF Extended] 0.8.5 Upgrade: Dynamic Forms');
|
42 |
+
|
43 |
+
// Retrieve all forms posts
|
44 |
+
$get_forms = get_posts(array(
|
45 |
+
'post_type' => 'acfe-form',
|
46 |
+
'posts_per_page' => -1,
|
47 |
+
'fields' => 'ids',
|
48 |
+
'post_status' => 'any'
|
49 |
+
));
|
50 |
+
|
51 |
+
// Bail early if no form found
|
52 |
+
if(empty($get_forms)){
|
53 |
+
|
54 |
+
// Upgrade done
|
55 |
+
continue;
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
$flexible = acf_get_field_type('flexible_content');
|
60 |
+
$field = acf_get_field('acfe_form_actions');
|
61 |
+
|
62 |
+
global $wpdb;
|
63 |
+
|
64 |
+
foreach($get_forms as $post_id){
|
65 |
+
|
66 |
+
// init
|
67 |
+
$wp_meta = array();
|
68 |
+
$acf_meta = array();
|
69 |
+
|
70 |
+
// Retrieve meta
|
71 |
+
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d ", $post_id));
|
72 |
+
|
73 |
+
// Sort
|
74 |
+
usort($get_meta, function($a, $b){
|
75 |
+
return strcmp($a->meta_key, $b->meta_key);
|
76 |
+
});
|
77 |
+
|
78 |
+
// Store
|
79 |
+
foreach($get_meta as $meta){
|
80 |
+
|
81 |
+
$wp_meta[$meta->meta_key] = $meta->meta_value;
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
// Check if is acf meta
|
86 |
+
foreach($wp_meta as $key => $value){
|
87 |
+
|
88 |
+
// ACF Meta
|
89 |
+
if(isset($wp_meta["_$key"])){
|
90 |
+
|
91 |
+
$acf_meta[] = array(
|
92 |
+
'key' => $key,
|
93 |
+
'value' => $wp_meta[$key],
|
94 |
+
);
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
+
/*
|
101 |
+
* Step 1: Upgrade old group fields
|
102 |
+
*/
|
103 |
+
$prefix = 'acfe_form_actions';
|
104 |
+
|
105 |
+
// Define script rules
|
106 |
+
$rules = array(
|
107 |
+
|
108 |
+
// Post: title
|
109 |
+
array(
|
110 |
+
'group' => 'acfe_form_post_save_post_title_group',
|
111 |
+
'sub_field' => 'acfe_form_post_save_post_title_group_acfe_form_post_save_post_title',
|
112 |
+
'sub_field_custom' => 'acfe_form_post_save_post_title_group_acfe_form_post_save_post_title_custom',
|
113 |
+
'new_field' => 'acfe_form_post_save_post_title',
|
114 |
+
),
|
115 |
+
|
116 |
+
// Post: name
|
117 |
+
array(
|
118 |
+
'group' => 'acfe_form_post_save_post_name_group',
|
119 |
+
'sub_field' => 'acfe_form_post_save_post_name_group_acfe_form_post_save_post_name',
|
120 |
+
'sub_field_custom' => 'acfe_form_post_save_post_name_group_acfe_form_post_save_post_name_custom',
|
121 |
+
'new_field' => 'acfe_form_post_save_post_name',
|
122 |
+
),
|
123 |
+
|
124 |
+
// Term: name
|
125 |
+
array(
|
126 |
+
'group' => 'acfe_form_term_save_name_group',
|
127 |
+
'sub_field' => 'acfe_form_term_save_name_group_acfe_form_term_save_name',
|
128 |
+
'sub_field_custom' => 'acfe_form_term_save_name_group_acfe_form_term_save_name_custom',
|
129 |
+
'new_field' => 'acfe_form_term_save_name',
|
130 |
+
),
|
131 |
+
|
132 |
+
// Term: slug
|
133 |
+
array(
|
134 |
+
'group' => 'acfe_form_term_save_slug_group',
|
135 |
+
'sub_field' => 'acfe_form_term_save_slug_group_acfe_form_term_save_slug',
|
136 |
+
'sub_field_custom' => 'acfe_form_term_save_slug_group_acfe_form_term_save_slug_custom',
|
137 |
+
'new_field' => 'acfe_form_term_save_slug',
|
138 |
+
),
|
139 |
+
|
140 |
+
// User: e-mail
|
141 |
+
array(
|
142 |
+
'group' => 'acfe_form_user_save_email_group',
|
143 |
+
'sub_field' => 'acfe_form_user_save_email_group_acfe_form_user_save_email',
|
144 |
+
'sub_field_custom' => 'acfe_form_user_save_email_group_acfe_form_user_save_email_custom',
|
145 |
+
'new_field' => 'acfe_form_user_save_email',
|
146 |
+
),
|
147 |
+
|
148 |
+
// User: username
|
149 |
+
array(
|
150 |
+
'group' => 'acfe_form_user_save_username_group',
|
151 |
+
'sub_field' => 'acfe_form_user_save_username_group_acfe_form_user_save_username',
|
152 |
+
'sub_field_custom' => 'acfe_form_user_save_username_group_acfe_form_user_save_username_custom',
|
153 |
+
'new_field' => 'acfe_form_user_save_username',
|
154 |
+
),
|
155 |
+
|
156 |
+
// User: password
|
157 |
+
array(
|
158 |
+
'group' => 'acfe_form_user_save_password_group',
|
159 |
+
'sub_field' => 'acfe_form_user_save_password_group_acfe_form_user_save_password',
|
160 |
+
'sub_field_custom' => 'acfe_form_user_save_password_group_acfe_form_user_save_password_custom',
|
161 |
+
'new_field' => 'acfe_form_user_save_password',
|
162 |
+
),
|
163 |
+
|
164 |
+
// User: first name
|
165 |
+
array(
|
166 |
+
'group' => 'acfe_form_user_save_first_name_group',
|
167 |
+
'sub_field' => 'acfe_form_user_save_first_name_group_acfe_form_user_save_first_name',
|
168 |
+
'sub_field_custom' => 'acfe_form_user_save_first_name_group_acfe_form_user_save_first_name_custom',
|
169 |
+
'new_field' => 'acfe_form_user_save_first_name',
|
170 |
+
),
|
171 |
+
|
172 |
+
// User: last name
|
173 |
+
array(
|
174 |
+
'group' => 'acfe_form_user_save_last_name_group',
|
175 |
+
'sub_field' => 'acfe_form_user_save_last_name_group_acfe_form_user_save_last_name',
|
176 |
+
'sub_field_custom' => 'acfe_form_user_save_last_name_group_acfe_form_user_save_last_name_custom',
|
177 |
+
'new_field' => 'acfe_form_user_save_last_name',
|
178 |
+
),
|
179 |
+
|
180 |
+
// User: nickname
|
181 |
+
array(
|
182 |
+
'group' => 'acfe_form_user_save_nickname_group',
|
183 |
+
'sub_field' => 'acfe_form_user_save_nickname_group_acfe_form_user_save_nickname',
|
184 |
+
'sub_field_custom' => 'acfe_form_user_save_nickname_group_acfe_form_user_save_nickname_custom',
|
185 |
+
'new_field' => 'acfe_form_user_save_nickname',
|
186 |
+
),
|
187 |
+
|
188 |
+
// User: display name
|
189 |
+
array(
|
190 |
+
'group' => 'acfe_form_user_save_display_name_group',
|
191 |
+
'sub_field' => 'acfe_form_user_save_display_name_group_acfe_form_user_save_display_name',
|
192 |
+
'sub_field_custom' => 'acfe_form_user_save_display_name_group_acfe_form_user_save_display_name_custom',
|
193 |
+
'new_field' => 'acfe_form_user_save_display_name',
|
194 |
+
),
|
195 |
+
|
196 |
+
// User: website
|
197 |
+
array(
|
198 |
+
'group' => 'acfe_form_user_save_website_group',
|
199 |
+
'sub_field' => 'acfe_form_user_save_website_group_acfe_form_user_save_website',
|
200 |
+
'sub_field_custom' => 'acfe_form_user_save_website_group_acfe_form_user_save_website_custom',
|
201 |
+
'new_field' => 'acfe_form_user_save_website',
|
202 |
+
),
|
203 |
+
|
204 |
+
);
|
205 |
+
|
206 |
+
// Process rules
|
207 |
+
foreach($rules as $rule){
|
208 |
+
|
209 |
+
$updates = array();
|
210 |
+
|
211 |
+
foreach($acf_meta as $acf){
|
212 |
+
|
213 |
+
// Bail early if doesn't starts with 'acfe_form_actions'
|
214 |
+
if(strpos($acf['key'], $prefix) !== 0)
|
215 |
+
continue;
|
216 |
+
|
217 |
+
// Regex: 'acfe_form_actions_2_acfe_form_post_save_post_title_group'
|
218 |
+
// Match: '2'
|
219 |
+
if(preg_match('/^' . $prefix . '_([0-9]+)_' . $rule['group'] . '$/', $acf['key'], $match)){
|
220 |
+
|
221 |
+
$updates[$rule['new_field']][$match[1]]['group'] = array(
|
222 |
+
'key' => $acf['key'],
|
223 |
+
'value' => $acf['value'],
|
224 |
+
);
|
225 |
+
|
226 |
+
// Regex: 'acfe_form_post_2_save_post_title_group_acfe_form_post_save_post_title'
|
227 |
+
// Match: '2'
|
228 |
+
}elseif(preg_match('/^' . $prefix . '_([0-9]+)_' . $rule['sub_field'] . '$/', $acf['key'], $match)){
|
229 |
+
|
230 |
+
$updates[$rule['new_field']][$match[1]]['sub_field'] = array(
|
231 |
+
'key' => $acf['key'],
|
232 |
+
'value' => $acf['value'],
|
233 |
+
);
|
234 |
+
|
235 |
+
// Regex: 'acfe_form_post_2_save_post_title_group_acfe_form_post_save_post_title_custom'
|
236 |
+
// Match: '2'
|
237 |
+
}elseif(preg_match('/^' . $prefix . '_([0-9]+)_' . $rule['sub_field_custom'] . '$/', $acf['key'], $match)){
|
238 |
+
|
239 |
+
// Generate: array[acfe_form_post_save_post_title][2]['sub_field_custom']
|
240 |
+
$updates[$rule['new_field']][$match[1]]['sub_field_custom'] = array(
|
241 |
+
'key' => $acf['key'],
|
242 |
+
'value' => $acf['value'],
|
243 |
+
);
|
244 |
+
|
245 |
+
}
|
246 |
+
|
247 |
+
}
|
248 |
+
|
249 |
+
if(!empty($updates)){
|
250 |
+
|
251 |
+
// Update meta
|
252 |
+
foreach($updates as $new_field => $data){
|
253 |
+
|
254 |
+
foreach($data as $i => $row){
|
255 |
+
|
256 |
+
$group = acf_maybe_get($row, 'group');
|
257 |
+
$sub_field = acf_maybe_get($row, 'sub_field');
|
258 |
+
$sub_field_custom = acf_maybe_get($row, 'sub_field_custom');
|
259 |
+
|
260 |
+
if($sub_field){
|
261 |
+
|
262 |
+
$new_field_name = "{$prefix}_{$i}_{$new_field}";
|
263 |
+
|
264 |
+
// update field
|
265 |
+
if($sub_field['value'] === 'custom'){
|
266 |
+
|
267 |
+
update_post_meta($post_id, $new_field_name, $sub_field_custom['value']);
|
268 |
+
|
269 |
+
}else{
|
270 |
+
|
271 |
+
update_post_meta($post_id, $new_field_name, $sub_field['value']);
|
272 |
+
|
273 |
+
}
|
274 |
+
|
275 |
+
// update reference
|
276 |
+
update_post_meta($post_id, '_' . $new_field_name, 'field_' . $new_field);
|
277 |
+
|
278 |
+
}
|
279 |
+
|
280 |
+
// Delete old group
|
281 |
+
delete_post_meta($post_id, $group['key']);
|
282 |
+
delete_post_meta($post_id, $sub_field['key']);
|
283 |
+
delete_post_meta($post_id, $sub_field_custom['key']);
|
284 |
+
|
285 |
+
}
|
286 |
+
|
287 |
+
}
|
288 |
+
|
289 |
+
}
|
290 |
+
|
291 |
+
}
|
292 |
+
|
293 |
+
/*
|
294 |
+
* Step 2: Upgrade map fields which now require "Load values" to be enabled
|
295 |
+
*/
|
296 |
+
if(have_rows('acfe_form_actions', $post_id)):
|
297 |
+
while(have_rows('acfe_form_actions', $post_id)): the_row();
|
298 |
+
|
299 |
+
$layout = get_row_layout();
|
300 |
+
$row = get_row_index();
|
301 |
+
$i = $row-1;
|
302 |
+
|
303 |
+
// Post Action
|
304 |
+
if($layout === 'post'){
|
305 |
+
|
306 |
+
$load_values = get_sub_field('acfe_form_post_load_values');
|
307 |
+
|
308 |
+
$fields = array(
|
309 |
+
'field_acfe_form_post_save_post_type' => get_sub_field('acfe_form_post_map_post_type', false),
|
310 |
+
'field_acfe_form_post_save_post_status' => get_sub_field('acfe_form_post_map_post_status', false),
|
311 |
+
'field_acfe_form_post_save_post_title' => get_sub_field('acfe_form_post_map_post_title', false),
|
312 |
+
'field_acfe_form_post_save_post_name' => get_sub_field('acfe_form_post_map_post_name', false),
|
313 |
+
'field_acfe_form_post_save_post_content' => get_sub_field('acfe_form_post_map_post_content', false),
|
314 |
+
'field_acfe_form_post_save_post_author' => get_sub_field('acfe_form_post_map_post_author', false),
|
315 |
+
'field_acfe_form_post_save_post_parent' => get_sub_field('acfe_form_post_map_post_parent', false),
|
316 |
+
'field_acfe_form_post_save_post_terms' => get_sub_field('acfe_form_post_map_post_terms', false),
|
317 |
+
);
|
318 |
+
|
319 |
+
if(!$load_values){
|
320 |
+
|
321 |
+
foreach($fields as $field_key => $field_value){
|
322 |
+
|
323 |
+
// Bail early if map field has no value
|
324 |
+
if(empty($field_value))
|
325 |
+
continue;
|
326 |
+
|
327 |
+
// args
|
328 |
+
$update = array();
|
329 |
+
$update['acf_fc_layout'] = $layout;
|
330 |
+
|
331 |
+
// Post content inside group
|
332 |
+
if($field_key === 'field_acfe_form_post_save_post_content'){
|
333 |
+
|
334 |
+
$update['field_acfe_form_post_save_post_content_group'] = array(
|
335 |
+
'field_acfe_form_post_save_post_content' => $field_value
|
336 |
+
);
|
337 |
+
|
338 |
+
}else{
|
339 |
+
|
340 |
+
$update[$field_key] = $field_value;
|
341 |
+
|
342 |
+
}
|
343 |
+
|
344 |
+
// update
|
345 |
+
$flexible->update_row($update, $i, $field, $post_id);
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
}
|
350 |
+
|
351 |
+
}
|
352 |
+
|
353 |
+
// Term Action
|
354 |
+
elseif($layout === 'term'){
|
355 |
+
|
356 |
+
$load_values = get_sub_field('acfe_form_term_load_values');
|
357 |
+
|
358 |
+
$fields = array(
|
359 |
+
'field_acfe_form_term_save_name' => get_sub_field('acfe_form_term_map_name', false),
|
360 |
+
'field_acfe_form_term_save_slug' => get_sub_field('acfe_form_term_map_slug', false),
|
361 |
+
'field_acfe_form_term_save_taxonomy' => get_sub_field('acfe_form_term_map_taxonomy', false),
|
362 |
+
'field_acfe_form_term_save_parent' => get_sub_field('acfe_form_term_map_parent', false),
|
363 |
+
'field_acfe_form_term_save_description' => get_sub_field('acfe_form_term_map_description', false),
|
364 |
+
);
|
365 |
+
|
366 |
+
if(!$load_values){
|
367 |
+
|
368 |
+
foreach($fields as $field_key => $field_value){
|
369 |
+
|
370 |
+
// Bail early if map field has no value
|
371 |
+
if(empty($field_value))
|
372 |
+
continue;
|
373 |
+
|
374 |
+
// args
|
375 |
+
$update = array();
|
376 |
+
$update['acf_fc_layout'] = $layout;
|
377 |
+
|
378 |
+
// Post content inside group
|
379 |
+
if($field_key === 'field_acfe_form_term_save_description'){
|
380 |
+
|
381 |
+
$update['field_acfe_form_term_save_description_group'] = array(
|
382 |
+
'field_acfe_form_term_save_description' => $field_value
|
383 |
+
);
|
384 |
+
|
385 |
+
}else{
|
386 |
+
|
387 |
+
$update[$field_key] = $field_value;
|
388 |
+
|
389 |
+
}
|
390 |
+
|
391 |
+
// update
|
392 |
+
$flexible->update_row($update, $i, $field, $post_id);
|
393 |
+
|
394 |
+
}
|
395 |
+
|
396 |
+
}
|
397 |
+
|
398 |
+
}
|
399 |
+
|
400 |
+
// User Action
|
401 |
+
elseif($layout === 'user'){
|
402 |
+
|
403 |
+
$load_values = get_sub_field('acfe_form_user_load_values');
|
404 |
+
|
405 |
+
$fields = array(
|
406 |
+
'field_acfe_form_user_save_email' => get_sub_field('acfe_form_user_map_email', false),
|
407 |
+
'field_acfe_form_user_save_username' => get_sub_field('acfe_form_user_map_username', false),
|
408 |
+
'field_acfe_form_user_save_password' => get_sub_field('acfe_form_user_map_password', false),
|
409 |
+
'field_acfe_form_user_save_first_name' => get_sub_field('acfe_form_user_map_first_name', false),
|
410 |
+
'field_acfe_form_user_save_last_name' => get_sub_field('acfe_form_user_map_last_name', false),
|
411 |
+
'field_acfe_form_user_save_nickname' => get_sub_field('acfe_form_user_map_nickname', false),
|
412 |
+
'field_acfe_form_user_save_display_name' => get_sub_field('acfe_form_user_map_display_name', false),
|
413 |
+
'field_acfe_form_user_save_website' => get_sub_field('acfe_form_user_map_website', false),
|
414 |
+
'field_acfe_form_user_save_description' => get_sub_field('acfe_form_user_map_description', false),
|
415 |
+
'field_acfe_form_user_save_role' => get_sub_field('acfe_form_user_map_role', false),
|
416 |
+
);
|
417 |
+
|
418 |
+
if(!$load_values){
|
419 |
+
|
420 |
+
foreach($fields as $field_key => $field_value){
|
421 |
+
|
422 |
+
// Bail early if map field has no value
|
423 |
+
if(empty($field_value))
|
424 |
+
continue;
|
425 |
+
|
426 |
+
// args
|
427 |
+
$update = array();
|
428 |
+
$update['acf_fc_layout'] = $layout;
|
429 |
+
|
430 |
+
// Post content inside group
|
431 |
+
if($field_key === 'field_acfe_form_user_save_description'){
|
432 |
+
|
433 |
+
$update['field_acfe_form_user_save_description_group'] = array(
|
434 |
+
'field_acfe_form_user_save_description' => $field_value
|
435 |
+
);
|
436 |
+
|
437 |
+
}else{
|
438 |
+
|
439 |
+
$update[$field_key] = $field_value;
|
440 |
+
|
441 |
+
}
|
442 |
+
|
443 |
+
// update
|
444 |
+
$flexible->update_row($update, $i, $field, $post_id);
|
445 |
+
|
446 |
+
}
|
447 |
+
|
448 |
+
}
|
449 |
+
|
450 |
+
}
|
451 |
+
|
452 |
+
endwhile;
|
453 |
+
endif;
|
454 |
+
|
455 |
+
}
|
456 |
+
|
457 |
+
}
|
458 |
+
|
459 |
+
/*
|
460 |
+
* Post Types
|
461 |
+
*/
|
462 |
+
elseif($task === 'dynamic_post_type'){
|
463 |
+
|
464 |
+
acf_log('[ACF Extended] 0.8.5 Upgrade: Dynamic Post Types');
|
465 |
+
|
466 |
+
// Old Post Types
|
467 |
+
$old_post_types = get_option('acfe_dynamic_post_types', array());
|
468 |
+
|
469 |
+
// New Post Types
|
470 |
+
$new_post_types = acfe_settings('modules.dynamic_post_type.data');
|
471 |
+
|
472 |
+
$merged_post_types = array_merge($old_post_types, $new_post_types);
|
473 |
+
|
474 |
+
// Update Post Types
|
475 |
+
acfe_settings('modules.dynamic_post_type.data', $merged_post_types, true);
|
476 |
+
|
477 |
+
// Delete Old Post Types
|
478 |
+
delete_option('acfe_dynamic_post_types');
|
479 |
+
|
480 |
+
}
|
481 |
+
|
482 |
+
/*
|
483 |
+
* Taxonomies
|
484 |
+
*/
|
485 |
+
elseif($task === 'dynamic_taxonomy'){
|
486 |
+
|
487 |
+
acf_log('[ACF Extended] 0.8.5 Upgrade: Dynamic Taxonomies');
|
488 |
+
|
489 |
+
// Old Taxonomies
|
490 |
+
$old_taxonomies = get_option('acfe_dynamic_taxonomies', array());
|
491 |
+
|
492 |
+
// New Taxonomies
|
493 |
+
$new_taxonomies = acfe_settings('modules.dynamic_taxonomy.data');
|
494 |
+
|
495 |
+
$merged_taxonomies = array_merge($old_taxonomies, $new_taxonomies);
|
496 |
+
|
497 |
+
// Update Taxonomies
|
498 |
+
acfe_settings('modules.dynamic_taxonomy.data', $merged_taxonomies, true);
|
499 |
+
|
500 |
+
// Delete Old Taxonomies
|
501 |
+
delete_option('acfe_dynamic_taxonomies');
|
502 |
+
|
503 |
+
}
|
504 |
+
|
505 |
+
/*
|
506 |
+
* Block Types
|
507 |
+
*/
|
508 |
+
elseif($task === 'dynamic_block_type'){
|
509 |
+
|
510 |
+
acf_log('[ACF Extended] 0.8.5 Upgrade: Dynamic Block Types');
|
511 |
+
|
512 |
+
// Old Block Types
|
513 |
+
$old_block_types = get_option('acfe_dynamic_block_types', array());
|
514 |
+
|
515 |
+
// New Block Types
|
516 |
+
$new_block_types = acfe_settings('modules.dynamic_block_type.data');
|
517 |
+
|
518 |
+
$merged_block_types = array_merge($old_block_types, $new_block_types);
|
519 |
+
|
520 |
+
// Update Block Types
|
521 |
+
acfe_settings('modules.dynamic_block_type.data', $merged_block_types, true);
|
522 |
+
|
523 |
+
// Delete Old Block Types
|
524 |
+
delete_option('acfe_dynamic_block_types');
|
525 |
+
|
526 |
+
}
|
527 |
+
|
528 |
+
/*
|
529 |
+
* Option Pages
|
530 |
+
*/
|
531 |
+
elseif($task === 'dynamic_option'){
|
532 |
+
|
533 |
+
acf_log('[ACF Extended] 0.8.5 Upgrade: Dynamic Options Pages');
|
534 |
+
|
535 |
+
// Old Options
|
536 |
+
$old_options = get_option('acfe_dynamic_options_pages', array());
|
537 |
+
|
538 |
+
// New Options
|
539 |
+
$new_options = acfe_settings('modules.dynamic_option.data');
|
540 |
+
|
541 |
+
$merged_options = array_merge($old_options, $new_options);
|
542 |
+
|
543 |
+
// Update Options
|
544 |
+
acfe_settings('modules.dynamic_option.data', $merged_options, true);
|
545 |
+
|
546 |
+
// Delete Old Options
|
547 |
+
delete_option('acfe_dynamic_options_pages');
|
548 |
+
|
549 |
+
}
|
550 |
+
|
551 |
+
}
|
552 |
+
|
553 |
+
// Done
|
554 |
+
acfe_settings()->delete('upgrades.0_8_5', true);
|
555 |
+
|
556 |
+
acf_log('[ACF Extended] 0.8.5 Upgrade: Done');
|
557 |
+
|
558 |
+
}
|
559 |
+
|
560 |
+
}
|
561 |
+
|
562 |
+
new acfe_upgrades();
|
563 |
+
|
564 |
+
endif;
|
includes/field-groups/field-group.php
CHANGED
@@ -176,7 +176,6 @@ function acfe_render_field_group_settings(){
|
|
176 |
));
|
177 |
|
178 |
// Data
|
179 |
-
|
180 |
acf_render_field_wrap(array(
|
181 |
'label' => __('Field group data'),
|
182 |
'instructions' => __('View raw field group data, for development use'),
|
@@ -278,6 +277,7 @@ function acfe_render_field_group_settings_side(){
|
|
278 |
));
|
279 |
|
280 |
if(acfe_is_field_group_json_desync($field_group)){
|
|
|
281 |
acf_render_field_wrap(array(
|
282 |
'label' => __('Json Desync'),
|
283 |
'instructions' => __('Local json file is different from this version. If you manually synchronize it, you will lose your current field group settings'),
|
@@ -286,6 +286,7 @@ function acfe_render_field_group_settings_side(){
|
|
286 |
'prefix' => 'acf_field_group',
|
287 |
'value' => $field_group['key'],
|
288 |
));
|
|
|
289 |
}
|
290 |
|
291 |
|
@@ -440,7 +441,7 @@ function acfe_render_field_acfe_sync_warnings($field){
|
|
440 |
|
441 |
// PHP
|
442 |
|
443 |
-
// Fix to load local
|
444 |
acf_enable_filters();
|
445 |
|
446 |
if(acfe_has_field_group_autosync($field_group, 'php') && !acf_get_setting('acfe/php_found')){
|
@@ -492,7 +493,7 @@ function acfe_render_field_group_data($field){
|
|
492 |
|
493 |
}
|
494 |
|
495 |
-
echo '<a href="#" class="button acfe_modal_open" data-modal-key="' . $field_group['key'] . '">' . __('Data') . '</a>';
|
496 |
echo '<div class="acfe-modal" data-modal-key="' . $field_group['key'] . '"><div style="padding:15px;"><pre style="margin-bottom:15px;">' . print_r($field_group, true) . '</pre><pre>' . print_r($field_group_raw, true) . '</pre></div></div>';
|
497 |
|
498 |
}
|
@@ -584,12 +585,36 @@ function acfe_field_group_instruction_placement($field){
|
|
584 |
add_filter('acf/validate_field_group', 'acfc_field_group_default_options');
|
585 |
function acfc_field_group_default_options($field_group){
|
586 |
|
587 |
-
//
|
588 |
if(!acf_maybe_get($field_group, 'location')){
|
589 |
-
|
|
|
590 |
$field_group['label_placement'] = 'left';
|
591 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
}
|
|
|
|
|
593 |
|
594 |
return $field_group;
|
595 |
|
176 |
));
|
177 |
|
178 |
// Data
|
|
|
179 |
acf_render_field_wrap(array(
|
180 |
'label' => __('Field group data'),
|
181 |
'instructions' => __('View raw field group data, for development use'),
|
277 |
));
|
278 |
|
279 |
if(acfe_is_field_group_json_desync($field_group)){
|
280 |
+
|
281 |
acf_render_field_wrap(array(
|
282 |
'label' => __('Json Desync'),
|
283 |
'instructions' => __('Local json file is different from this version. If you manually synchronize it, you will lose your current field group settings'),
|
286 |
'prefix' => 'acf_field_group',
|
287 |
'value' => $field_group['key'],
|
288 |
));
|
289 |
+
|
290 |
}
|
291 |
|
292 |
|
441 |
|
442 |
// PHP
|
443 |
|
444 |
+
// Fix to load local field groups
|
445 |
acf_enable_filters();
|
446 |
|
447 |
if(acfe_has_field_group_autosync($field_group, 'php') && !acf_get_setting('acfe/php_found')){
|
493 |
|
494 |
}
|
495 |
|
496 |
+
echo '<a href="#" class="acf-button button acfe_modal_open" data-modal-key="' . $field_group['key'] . '">' . __('Data') . '</a>';
|
497 |
echo '<div class="acfe-modal" data-modal-key="' . $field_group['key'] . '"><div style="padding:15px;"><pre style="margin-bottom:15px;">' . print_r($field_group, true) . '</pre><pre>' . print_r($field_group_raw, true) . '</pre></div></div>';
|
498 |
|
499 |
}
|
585 |
add_filter('acf/validate_field_group', 'acfc_field_group_default_options');
|
586 |
function acfc_field_group_default_options($field_group){
|
587 |
|
588 |
+
// Only new field groups
|
589 |
if(!acf_maybe_get($field_group, 'location')){
|
590 |
+
|
591 |
+
// Default label placement: Left
|
592 |
$field_group['label_placement'] = 'left';
|
593 |
|
594 |
+
// AutoSync
|
595 |
+
$acfe_autosync = array();
|
596 |
+
|
597 |
+
if(acf_get_setting('acfe/json_found', false)){
|
598 |
+
|
599 |
+
$acfe_autosync[] = 'json';
|
600 |
+
|
601 |
+
}
|
602 |
+
|
603 |
+
if(acf_get_setting('acfe/php_found', false)){
|
604 |
+
|
605 |
+
$acfe_autosync[] = 'php';
|
606 |
+
|
607 |
+
}
|
608 |
+
|
609 |
+
if(!empty($acfe_autosync)){
|
610 |
+
|
611 |
+
$field_group['acfe_autosync'] = $acfe_autosync;
|
612 |
+
|
613 |
+
}
|
614 |
+
|
615 |
}
|
616 |
+
|
617 |
+
|
618 |
|
619 |
return $field_group;
|
620 |
|
includes/field-groups/{field-groups-third-party.php → field-groups-local.php}
RENAMED
@@ -17,7 +17,7 @@ function acfe_field_groups_third_party_views($views){
|
|
17 |
$class = '';
|
18 |
|
19 |
// active
|
20 |
-
if(acf_maybe_get_GET('post_status') === 'acfe-
|
21 |
|
22 |
// actions
|
23 |
add_action('admin_footer', 'acfe_field_groups_third_party_footer', 5);
|
@@ -38,7 +38,7 @@ function acfe_field_groups_third_party_views($views){
|
|
38 |
}
|
39 |
|
40 |
// add view
|
41 |
-
$views['acfe-
|
42 |
|
43 |
// return
|
44 |
return $views;
|
@@ -57,7 +57,7 @@ function acfe_field_groups_third_party_footer(){
|
|
57 |
);
|
58 |
|
59 |
?>
|
60 |
-
<script type="text/html" id="tmpl-acfe-
|
61 |
<?php
|
62 |
|
63 |
foreach(acfe_get_third_party_field_groups() as $field_group ):
|
@@ -90,7 +90,7 @@ function acfe_field_groups_third_party_footer(){
|
|
90 |
|
91 |
<span class="acfe-key">
|
92 |
<span style="color:#555;">
|
93 |
-
<code style="
|
94 |
</span>
|
95 |
</span>
|
96 |
|
@@ -109,7 +109,7 @@ function acfe_field_groups_third_party_footer(){
|
|
109 |
(function($){
|
110 |
|
111 |
// update table HTML
|
112 |
-
$('#the-list').html($('#tmpl-acfe-
|
113 |
|
114 |
})(jQuery);
|
115 |
</script>
|
@@ -128,8 +128,14 @@ function acfe_get_third_party_field_groups(){
|
|
128 |
foreach($get_local_field_groups as $field_group){
|
129 |
|
130 |
// Exclude ACFE Field Groups
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
$locals[] = $field_group;
|
135 |
|
@@ -175,7 +181,7 @@ function acfe_get_db_field_groups(){
|
|
175 |
|
176 |
add_filter('bulk_actions-edit-acf-field-group', function($actions){
|
177 |
|
178 |
-
if(acf_maybe_get_GET('post_status') === 'acfe-
|
179 |
return array();
|
180 |
|
181 |
return $actions;
|
@@ -184,7 +190,7 @@ add_filter('bulk_actions-edit-acf-field-group', function($actions){
|
|
184 |
|
185 |
add_filter('manage_edit-acf-field-group_sortable_columns', function($sortable_columns){
|
186 |
|
187 |
-
if(acf_maybe_get_GET('post_status') === 'acfe-
|
188 |
return array();
|
189 |
|
190 |
return $sortable_columns;
|
17 |
$class = '';
|
18 |
|
19 |
// active
|
20 |
+
if(acf_maybe_get_GET('post_status') === 'acfe-local'){
|
21 |
|
22 |
// actions
|
23 |
add_action('admin_footer', 'acfe_field_groups_third_party_footer', 5);
|
38 |
}
|
39 |
|
40 |
// add view
|
41 |
+
$views['acfe-local'] = '<a' . $class . ' href="' . admin_url('edit.php?post_type=acf-field-group&post_status=acfe-local') . '">' . __('Local', 'acfe') . ' <span class="count">(' . $total . ')</span></a>';
|
42 |
|
43 |
// return
|
44 |
return $views;
|
57 |
);
|
58 |
|
59 |
?>
|
60 |
+
<script type="text/html" id="tmpl-acfe-local-tbody">
|
61 |
<?php
|
62 |
|
63 |
foreach(acfe_get_third_party_field_groups() as $field_group ):
|
90 |
|
91 |
<span class="acfe-key">
|
92 |
<span style="color:#555;">
|
93 |
+
<code style="font-size: 12px;"><?php echo esc_html($key); ?></code>
|
94 |
</span>
|
95 |
</span>
|
96 |
|
109 |
(function($){
|
110 |
|
111 |
// update table HTML
|
112 |
+
$('#the-list').html($('#tmpl-acfe-local-tbody').html());
|
113 |
|
114 |
})(jQuery);
|
115 |
</script>
|
128 |
foreach($get_local_field_groups as $field_group){
|
129 |
|
130 |
// Exclude ACFE Field Groups
|
131 |
+
|
132 |
+
if(!acfe_is_super_dev()){
|
133 |
+
|
134 |
+
if(stripos($field_group['key'], 'group_acfe_') === 0)
|
135 |
+
continue;
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
|
140 |
$locals[] = $field_group;
|
141 |
|
181 |
|
182 |
add_filter('bulk_actions-edit-acf-field-group', function($actions){
|
183 |
|
184 |
+
if(acf_maybe_get_GET('post_status') === 'acfe-local')
|
185 |
return array();
|
186 |
|
187 |
return $actions;
|
190 |
|
191 |
add_filter('manage_edit-acf-field-group_sortable_columns', function($sortable_columns){
|
192 |
|
193 |
+
if(acf_maybe_get_GET('post_status') === 'acfe-local')
|
194 |
return array();
|
195 |
|
196 |
return $sortable_columns;
|
includes/field-groups/field-groups.php
CHANGED
@@ -63,7 +63,7 @@ function acfe_field_groups_column($columns){
|
|
63 |
}
|
64 |
|
65 |
// Fix 'Third party' screen columns
|
66 |
-
elseif(acf_maybe_get_GET('post_status') === 'acfe-
|
67 |
|
68 |
$columns = array(
|
69 |
'title' => __('Title', 'acf'),
|
@@ -129,7 +129,7 @@ function acfe_field_groups_column_html($column, $post_id){
|
|
129 |
|
130 |
else{
|
131 |
|
132 |
-
$source =
|
133 |
|
134 |
}
|
135 |
|
@@ -257,6 +257,8 @@ function acfe_field_groups_column_html($column, $post_id){
|
|
257 |
|
258 |
}
|
259 |
|
|
|
|
|
260 |
$name = '<span class="acf-js-tooltip dashicons dashicons-' . $final[$and['param']]['icon'] . '" title="' . $final[$and['param']]['name'] . ' = ' . $final_name . '"></span>';
|
261 |
if($and['operator'] === '!=')
|
262 |
$name = '<span class="acf-js-tooltip dashicons dashicons-' . $final[$and['param']]['icon'] . '" title="' . $final[$and['param']]['name'] . ' != ' . $final_name . '" style="color:#ccc;"></span>';
|
@@ -410,7 +412,7 @@ function hwk_post_type_exemple_row_actions($actions, $post){
|
|
410 |
$actions['acfe-export-php'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=export&action=php&keys=' . $field_group['key']) . '">PHP</a>';
|
411 |
$actions['acfe-export-json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=export&action=json&keys=' . $field_group['key']) . '">Json</a>';
|
412 |
|
413 |
-
$actions['acfe-key'] = '<span style="color:#555;"><code style="
|
414 |
|
415 |
//$actions['acfe-id'] = '<span style="color:#555;">ID: ' . $field_group['ID'] . '</span>';
|
416 |
|
@@ -482,17 +484,31 @@ function acfe_field_groups_seamless($post_type, $post, $field_groups){
|
|
482 |
|
483 |
foreach($field_groups as $field_group){
|
484 |
|
485 |
-
if($field_group['style']
|
486 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
|
|
|
|
|
|
|
|
496 |
|
497 |
}
|
498 |
|
63 |
}
|
64 |
|
65 |
// Fix 'Third party' screen columns
|
66 |
+
elseif(acf_maybe_get_GET('post_status') === 'acfe-local'){
|
67 |
|
68 |
$columns = array(
|
69 |
'title' => __('Title', 'acf'),
|
129 |
|
130 |
else{
|
131 |
|
132 |
+
$source = __('Local', 'acf');
|
133 |
|
134 |
}
|
135 |
|
257 |
|
258 |
}
|
259 |
|
260 |
+
$final_name = esc_html($final_name);
|
261 |
+
|
262 |
$name = '<span class="acf-js-tooltip dashicons dashicons-' . $final[$and['param']]['icon'] . '" title="' . $final[$and['param']]['name'] . ' = ' . $final_name . '"></span>';
|
263 |
if($and['operator'] === '!=')
|
264 |
$name = '<span class="acf-js-tooltip dashicons dashicons-' . $final[$and['param']]['icon'] . '" title="' . $final[$and['param']]['name'] . ' != ' . $final_name . '" style="color:#ccc;"></span>';
|
412 |
$actions['acfe-export-php'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=export&action=php&keys=' . $field_group['key']) . '">PHP</a>';
|
413 |
$actions['acfe-export-json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=export&action=json&keys=' . $field_group['key']) . '">Json</a>';
|
414 |
|
415 |
+
$actions['acfe-key'] = '<span style="color:#555;"><code style="font-size: 12px;">' . $field_group['key'] . '</code></span>';
|
416 |
|
417 |
//$actions['acfe-id'] = '<span style="color:#555;">ID: ' . $field_group['ID'] . '</span>';
|
418 |
|
484 |
|
485 |
foreach($field_groups as $field_group){
|
486 |
|
487 |
+
if($field_group['style'] === 'seamless'){
|
488 |
+
|
489 |
+
add_filter("postbox_classes_{$post_type}_acf-{$field_group['key']}", function($classes){
|
490 |
+
|
491 |
+
$classes[] = 'acf-postbox';
|
492 |
+
$classes[] = 'seamless';
|
493 |
+
|
494 |
+
return $classes;
|
495 |
+
|
496 |
+
});
|
497 |
+
|
498 |
+
}
|
499 |
|
500 |
+
if($field_group['label_placement'] === 'left'){
|
501 |
+
|
502 |
+
add_filter("postbox_classes_{$post_type}_acf-{$field_group['key']}", function($classes){
|
503 |
+
|
504 |
+
$classes[] = 'acf-postbox';
|
505 |
+
$classes[] = 'acfe-postbox-left';
|
506 |
+
|
507 |
+
return $classes;
|
508 |
+
|
509 |
+
});
|
510 |
+
|
511 |
+
}
|
512 |
|
513 |
}
|
514 |
|
includes/fields-settings/data.php
CHANGED
@@ -1,58 +1,81 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if(!defined('ABSPATH'))
|
4 |
-
exit;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Setting: Field Data
|
8 |
-
*/
|
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;
|
16 |
-
if($field['ID'] != 'acfcloneindex')
|
17 |
-
$acfe_field_data_id = $field['ID'];
|
18 |
-
|
19 |
-
acf_render_field_setting($field, array(
|
20 |
-
'label' => false,
|
21 |
-
'instructions' => '',
|
22 |
-
'type' => 'acfe_dynamic_message',
|
23 |
-
'required' => false,
|
24 |
-
'name' => 'acfe_field_data',
|
25 |
-
'key' => 'acfe_field_data',
|
26 |
-
'value' => $acfe_field_data_id,
|
27 |
-
), true);
|
28 |
-
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Render: Field Data
|
33 |
-
*/
|
34 |
-
add_filter('acf/render_field/name=acfe_field_data', 'acfe_render_field_data');
|
35 |
-
function acfe_render_field_data($field){
|
36 |
-
|
37 |
-
$acfe_field_data_id = $field['value'];
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Setting: Field Data
|
8 |
+
*/
|
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;
|
16 |
+
if($field['ID'] != 'acfcloneindex')
|
17 |
+
$acfe_field_data_id = $field['ID'];
|
18 |
+
|
19 |
+
acf_render_field_setting($field, array(
|
20 |
+
'label' => false,
|
21 |
+
'instructions' => '',
|
22 |
+
'type' => 'acfe_dynamic_message',
|
23 |
+
'required' => false,
|
24 |
+
'name' => 'acfe_field_data',
|
25 |
+
'key' => 'acfe_field_data',
|
26 |
+
'value' => $acfe_field_data_id,
|
27 |
+
), true);
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Render: Field Data
|
33 |
+
*/
|
34 |
+
add_filter('acf/render_field/name=acfe_field_data', 'acfe_render_field_data');
|
35 |
+
function acfe_render_field_data($field){
|
36 |
+
|
37 |
+
$acfe_field_data_id = $field['value'];
|
38 |
+
|
39 |
+
if(!$acfe_field_data_id)
|
40 |
+
return;
|
41 |
+
|
42 |
+
$get_field = acf_get_field($acfe_field_data_id);
|
43 |
+
|
44 |
+
$get_field = array_map(function($value){
|
45 |
+
|
46 |
+
if(is_array($value))
|
47 |
+
return $value;
|
48 |
+
|
49 |
+
return esc_html($value);
|
50 |
+
|
51 |
+
}, $get_field);
|
52 |
+
|
53 |
+
$get_field_debug = '<pre style="margin-bottom:15px;">' . print_r($get_field, true) . '</pre>';
|
54 |
+
|
55 |
+
if(!$get_field)
|
56 |
+
$get_field_debug = '<pre>Field data unavailable</pre>';
|
57 |
+
|
58 |
+
$get_post = get_post($acfe_field_data_id, ARRAY_A);
|
59 |
+
|
60 |
+
$get_post = array_map(function($value){
|
61 |
+
|
62 |
+
if(is_array($value))
|
63 |
+
return $value;
|
64 |
+
|
65 |
+
return esc_html($value);
|
66 |
+
|
67 |
+
}, $get_post);
|
68 |
+
|
69 |
+
$get_post_debug = '<pre>' . print_r($get_post, true) . '</pre>';
|
70 |
+
|
71 |
+
if(!$get_post || $get_post['post_type'] !== 'acf-field'){
|
72 |
+
$get_post_debug = '<pre>Post object unavailable</pre>';
|
73 |
+
}
|
74 |
+
|
75 |
+
$button = '<a href="#" class="button acfe_modal_open" style="margin-left:5px;" data-modal-key="' . $acfe_field_data_id . '">' . __('Data') . '</a>';
|
76 |
+
if(!$get_field && !$get_post)
|
77 |
+
$button = '<a href="#" class="button disabled" disabled>' . __('Data') . '</a>';
|
78 |
+
|
79 |
+
echo $button . '<div class="acfe-modal" data-modal-key="' . $acfe_field_data_id . '"><div style="padding:15px;">' . $get_field_debug . $get_post_debug . '</div></div>';
|
80 |
+
|
81 |
}
|
includes/fields-settings/fields.php
CHANGED
@@ -86,24 +86,22 @@ function acfe_fields_wrapper_instructions($fields, $post_id){
|
|
86 |
|
87 |
$tooltip = false;
|
88 |
|
89 |
-
if(isset($fields[0]))
|
|
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
}
|
105 |
-
|
106 |
-
}
|
107 |
|
108 |
return $fields;
|
109 |
|
86 |
|
87 |
$tooltip = false;
|
88 |
|
89 |
+
if(!isset($fields[0]))
|
90 |
+
return $fields;
|
91 |
|
92 |
+
$field_group = acfe_get_field_group_from_field($fields[0]);
|
93 |
+
|
94 |
+
if(!$field_group)
|
95 |
+
return $fields;
|
96 |
+
|
97 |
+
if($field_group['instruction_placement'] !== 'acfe_instructions_tooltip')
|
98 |
+
return $fields;
|
99 |
+
|
100 |
+
foreach($fields as &$field){
|
101 |
+
|
102 |
+
acfe_add_fields_instructions_tooltip($field);
|
103 |
+
|
104 |
+
}
|
|
|
|
|
|
|
105 |
|
106 |
return $fields;
|
107 |
|
includes/fields-settings/settings.php
CHANGED
@@ -1,417 +1,490 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if(!defined('ABSPATH'))
|
4 |
-
exit;
|
5 |
-
|
6 |
-
if(!class_exists('acfe_field_settings')):
|
7 |
-
|
8 |
-
class acfe_field_settings{
|
9 |
-
|
10 |
-
function __construct(){
|
11 |
-
|
12 |
-
// Actions
|
13 |
-
add_action('load-post.php', array($this, 'load'));
|
14 |
-
add_action('wp_ajax_acf/field_group/render_field_settings', array($this, 'field_types_action'), 5);
|
15 |
-
|
16 |
-
// Filters
|
17 |
-
add_filter('acfe/load_field', array($this, 'load_field'));
|
18 |
-
add_filter('acf/prepare_field', array($this, 'prepare_field'));
|
19 |
-
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Load
|
24 |
-
*/
|
25 |
-
function load(){
|
26 |
-
|
27 |
-
if(!acf_is_screen('acf-field-group'))
|
28 |
-
return;
|
29 |
-
|
30 |
-
$this->field_types_action();
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
add_filter('acf/prepare_field/name=
|
36 |
-
add_filter('acf/prepare_field/name=
|
37 |
-
add_filter('acf/prepare_field/name=
|
38 |
-
add_filter('acf/prepare_field/name=
|
39 |
-
add_filter('acf/prepare_field/name=
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
'
|
233 |
-
'
|
234 |
-
'
|
235 |
-
'
|
236 |
-
'
|
237 |
-
'
|
238 |
-
'
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
'
|
245 |
-
'
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
endif;
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
if(!class_exists('acfe_field_settings')):
|
7 |
+
|
8 |
+
class acfe_field_settings{
|
9 |
+
|
10 |
+
function __construct(){
|
11 |
+
|
12 |
+
// Actions
|
13 |
+
add_action('load-post.php', array($this, 'load'));
|
14 |
+
add_action('wp_ajax_acf/field_group/render_field_settings', array($this, 'field_types_action'), 5);
|
15 |
+
|
16 |
+
// Filters
|
17 |
+
add_filter('acfe/load_field', array($this, 'load_field'));
|
18 |
+
add_filter('acf/prepare_field', array($this, 'prepare_field'));
|
19 |
+
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Load
|
24 |
+
*/
|
25 |
+
function load(){
|
26 |
+
|
27 |
+
if(!acf_is_screen('acf-field-group'))
|
28 |
+
return;
|
29 |
+
|
30 |
+
$this->field_types_action();
|
31 |
+
|
32 |
+
//add_action('acf/render_field_settings', array($this, 'quick_settings'), 998);
|
33 |
+
|
34 |
+
// Fix: Repeater
|
35 |
+
add_filter('acf/prepare_field/name=acfe_settings', array($this, 'fix_repeater'));
|
36 |
+
add_filter('acf/prepare_field/name=acfe_settings_location', array($this, 'fix_repeater'));
|
37 |
+
add_filter('acf/prepare_field/name=acfe_settings_settings', array($this, 'fix_repeater'));
|
38 |
+
add_filter('acf/prepare_field/name=acfe_settings_setting_type', array($this, 'fix_repeater'));
|
39 |
+
add_filter('acf/prepare_field/name=acfe_settings_setting_name', array($this, 'fix_repeater'));
|
40 |
+
add_filter('acf/prepare_field/name=acfe_settings_setting_operator', array($this, 'fix_repeater'));
|
41 |
+
add_filter('acf/prepare_field/name=acfe_settings_setting_value', array($this, 'fix_repeater'));
|
42 |
+
|
43 |
+
// Fix: Clone
|
44 |
+
add_filter('acf/update_field', array($this, 'fix_clone'));
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
function quick_settings($field){
|
49 |
+
|
50 |
+
$valid = false;
|
51 |
+
|
52 |
+
$field_group = acfe_get_field_group_from_field($field);
|
53 |
+
|
54 |
+
if(acf_maybe_get($field_group, 'acfe_form'))
|
55 |
+
$valid = true;
|
56 |
+
|
57 |
+
if(!$valid && acf_maybe_get($field, '_name') === 'new_field'){
|
58 |
+
|
59 |
+
$field_group_id = get_the_ID();
|
60 |
+
|
61 |
+
if($field_group_id){
|
62 |
+
|
63 |
+
$field_group = acf_get_field_group($field_group_id);
|
64 |
+
|
65 |
+
if(acf_maybe_get($field_group, 'acfe_form'))
|
66 |
+
$valid = true;
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
if(!$valid)
|
73 |
+
return;
|
74 |
+
|
75 |
+
// Hide Field
|
76 |
+
acf_render_field_setting($field, array(
|
77 |
+
'label' => __('Hide Field', 'acfe'),
|
78 |
+
'instructions' => __('Hide field on specific location'),
|
79 |
+
'prepend' => '',
|
80 |
+
'append' => '',
|
81 |
+
'type' => 'group',
|
82 |
+
'name' => 'acfe_hide',
|
83 |
+
'sub_fields' => array(
|
84 |
+
array(
|
85 |
+
'label' => '',
|
86 |
+
'name' => 'hide_front',
|
87 |
+
'key' => 'hide_front',
|
88 |
+
'type' => 'true_false',
|
89 |
+
'ui' => true,
|
90 |
+
'message' => 'Hide on front',
|
91 |
+
'default_value' => false,
|
92 |
+
'required' => false,
|
93 |
+
'wrapper' => array(
|
94 |
+
'width' => 33,
|
95 |
+
'class' => 'acfe_width_auto',
|
96 |
+
'id' => '',
|
97 |
+
),
|
98 |
+
),
|
99 |
+
array(
|
100 |
+
'label' => '',
|
101 |
+
'name' => 'hide_admin',
|
102 |
+
'key' => 'hide_admin',
|
103 |
+
'type' => 'true_false',
|
104 |
+
'ui' => true,
|
105 |
+
'message' => 'Hide on admin',
|
106 |
+
'default_value' => false,
|
107 |
+
'required' => false,
|
108 |
+
'wrapper' => array(
|
109 |
+
'width' => 33,
|
110 |
+
'class' => 'acfe_width_auto',
|
111 |
+
'id' => '',
|
112 |
+
),
|
113 |
+
),
|
114 |
+
)
|
115 |
+
));
|
116 |
+
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Get field types
|
121 |
+
*/
|
122 |
+
function field_types_action(){
|
123 |
+
|
124 |
+
// Get Fields Types
|
125 |
+
foreach(acf_get_field_types_info() as $field){
|
126 |
+
|
127 |
+
// Field type
|
128 |
+
$field_type = $field['name'];
|
129 |
+
|
130 |
+
// Exclude
|
131 |
+
if(in_array($field_type, array('message', 'accordion', 'tab', 'acfe_button', 'acfe_column', 'acfe_dynamic_message')))
|
132 |
+
continue;
|
133 |
+
|
134 |
+
add_action('acf/render_field_settings/type=' . $field_type, array($this, 'render_field_settings'), 990);
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Add Setting
|
142 |
+
*/
|
143 |
+
function render_field_settings($field){
|
144 |
+
|
145 |
+
$valid = false;
|
146 |
+
|
147 |
+
// Ajax
|
148 |
+
if(acf_verify_ajax()){
|
149 |
+
|
150 |
+
$field_group = acfe_get_field_group_from_field($field);
|
151 |
+
|
152 |
+
if(acf_maybe_get($field_group, 'acfe_form'))
|
153 |
+
$valid = true;
|
154 |
+
|
155 |
+
}
|
156 |
+
|
157 |
+
// Display
|
158 |
+
else{
|
159 |
+
|
160 |
+
if(acf_maybe_get($field, 'acfe_form'))
|
161 |
+
$valid = true;
|
162 |
+
|
163 |
+
if(!$valid && acf_maybe_get($field, '_name') === 'new_field'){
|
164 |
+
|
165 |
+
$field_group_id = get_the_ID();
|
166 |
+
|
167 |
+
if($field_group_id){
|
168 |
+
|
169 |
+
$field_group = acf_get_field_group($field_group_id);
|
170 |
+
|
171 |
+
if(acf_maybe_get($field_group, 'acfe_form'))
|
172 |
+
$valid = true;
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
if(!$valid)
|
181 |
+
return;
|
182 |
+
|
183 |
+
// Settings
|
184 |
+
acf_render_field_setting($field, array(
|
185 |
+
'label' => __('Advanced settings', 'acf'),
|
186 |
+
'name' => 'acfe_settings',
|
187 |
+
'key' => 'acfe_settings',
|
188 |
+
'instructions' => __('Change field settings based on location'),
|
189 |
+
'type' => 'repeater',
|
190 |
+
'button_label' => __('Add settings'),
|
191 |
+
'required' => false,
|
192 |
+
'layout' => 'row',
|
193 |
+
'sub_fields' => array(
|
194 |
+
array(
|
195 |
+
'label' => 'Location',
|
196 |
+
'name' => 'acfe_settings_location',
|
197 |
+
'key' => 'acfe_settings_location',
|
198 |
+
'type' => 'select',
|
199 |
+
'instructions' => '',
|
200 |
+
'required' => 0,
|
201 |
+
'conditional_logic' => 0,
|
202 |
+
'wrapper' => array(
|
203 |
+
'width' => '',
|
204 |
+
'class' => '',
|
205 |
+
'id' => '',
|
206 |
+
),
|
207 |
+
'choices' => array(
|
208 |
+
'admin' => 'Administration',
|
209 |
+
'front' => 'Front-end',
|
210 |
+
),
|
211 |
+
'allow_null' => true,
|
212 |
+
'multiple' => 0,
|
213 |
+
'ui' => 0,
|
214 |
+
'return_format' => 'value',
|
215 |
+
'ajax' => 0,
|
216 |
+
'placeholder' => 'Everywhere',
|
217 |
+
),
|
218 |
+
array(
|
219 |
+
'label' => __('Settings'),
|
220 |
+
'name' => 'acfe_settings_settings',
|
221 |
+
'key' => 'acfe_settings_settings',
|
222 |
+
'instructions' => '',
|
223 |
+
'type' => 'repeater',
|
224 |
+
'button_label' => __('+'),
|
225 |
+
'required' => false,
|
226 |
+
'layout' => 'table',
|
227 |
+
'sub_fields' => array(
|
228 |
+
array(
|
229 |
+
'label' => 'Setting',
|
230 |
+
'name' => 'acfe_settings_setting_type',
|
231 |
+
'key' => 'acfe_settings_setting_type',
|
232 |
+
'prefix' => '',
|
233 |
+
'_name' => '',
|
234 |
+
'_prepare' => '',
|
235 |
+
'type' => 'select',
|
236 |
+
'instructions' => false,
|
237 |
+
'required' => false,
|
238 |
+
'wrapper' => array(
|
239 |
+
'width' => '',
|
240 |
+
'class' => '',
|
241 |
+
'id' => '',
|
242 |
+
),
|
243 |
+
'choices' => array(
|
244 |
+
'required' => 'Required',
|
245 |
+
'hide_field' => 'Hide field',
|
246 |
+
'hide_label' => 'Hide label',
|
247 |
+
'default_value' => 'Default value',
|
248 |
+
'placeholder' => 'Placeholder',
|
249 |
+
'instructions' => 'Instructions',
|
250 |
+
'custom' => 'Custom setting',
|
251 |
+
)
|
252 |
+
),
|
253 |
+
array(
|
254 |
+
'label' => 'Setting name',
|
255 |
+
'name' => 'acfe_settings_setting_name',
|
256 |
+
'key' => 'acfe_settings_setting_name',
|
257 |
+
'prefix' => '',
|
258 |
+
'_name' => '',
|
259 |
+
'_prepare' => '',
|
260 |
+
'type' => 'text',
|
261 |
+
'instructions' => false,
|
262 |
+
'required' => false,
|
263 |
+
'wrapper' => array(
|
264 |
+
'width' => '',
|
265 |
+
'class' => '',
|
266 |
+
'id' => '',
|
267 |
+
),
|
268 |
+
'conditional_logic' => array(
|
269 |
+
array(
|
270 |
+
array(
|
271 |
+
'field' => 'acfe_settings_setting_type',
|
272 |
+
'operator' => '==',
|
273 |
+
'value' => 'custom',
|
274 |
+
)
|
275 |
+
)
|
276 |
+
)
|
277 |
+
),
|
278 |
+
array(
|
279 |
+
'label' => 'Operator / Value',
|
280 |
+
'name' => 'acfe_settings_setting_operator',
|
281 |
+
'key' => 'acfe_settings_setting_operator',
|
282 |
+
'prefix' => '',
|
283 |
+
'_name' => '',
|
284 |
+
'_prepare' => '',
|
285 |
+
'type' => 'select',
|
286 |
+
'choices' => array(
|
287 |
+
'Values' => array(
|
288 |
+
'true' => '= true',
|
289 |
+
'false' => '= false',
|
290 |
+
'empty' => '= (empty)',
|
291 |
+
),
|
292 |
+
'Operators' => array(
|
293 |
+
'=' => '=',
|
294 |
+
),
|
295 |
+
),
|
296 |
+
'instructions' => false,
|
297 |
+
'required' => false,
|
298 |
+
'wrapper' => array(
|
299 |
+
'width' => '',
|
300 |
+
'class' => '',
|
301 |
+
'id' => '',
|
302 |
+
),
|
303 |
+
),
|
304 |
+
array(
|
305 |
+
'label' => 'Value',
|
306 |
+
'name' => 'acfe_settings_setting_value',
|
307 |
+
'key' => 'acfe_settings_setting_value',
|
308 |
+
'prefix' => '',
|
309 |
+
'_name' => '',
|
310 |
+
'_prepare' => '',
|
311 |
+
'type' => 'text',
|
312 |
+
'instructions' => false,
|
313 |
+
'placeholder' => '',
|
314 |
+
'required' => false,
|
315 |
+
'wrapper' => array(
|
316 |
+
'width' => '',
|
317 |
+
'class' => '',
|
318 |
+
'id' => '',
|
319 |
+
),
|
320 |
+
'conditional_logic' => array(
|
321 |
+
array(
|
322 |
+
array(
|
323 |
+
'field' => 'acfe_settings_setting_operator',
|
324 |
+
'operator' => '==',
|
325 |
+
'value' => '=',
|
326 |
+
)
|
327 |
+
),
|
328 |
+
)
|
329 |
+
),
|
330 |
+
)
|
331 |
+
),
|
332 |
+
)
|
333 |
+
), false);
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Load field
|
339 |
+
*/
|
340 |
+
function load_field($field){
|
341 |
+
|
342 |
+
if(!acf_maybe_get($field, 'acfe_settings'))
|
343 |
+
return $field;
|
344 |
+
|
345 |
+
$exclude = apply_filters('acfe/settings/exclude', false, $field);
|
346 |
+
if($exclude)
|
347 |
+
return $field;
|
348 |
+
|
349 |
+
foreach($field['acfe_settings'] as $k => $rule){
|
350 |
+
|
351 |
+
// Fix possible ACF Clone Index
|
352 |
+
if($k === 'acfcloneindex')
|
353 |
+
continue;
|
354 |
+
|
355 |
+
// Screen
|
356 |
+
$screen = isset($rule['acfe_settings_location']) ? $rule['acfe_settings_location'] : '';
|
357 |
+
$screen_allow = false;
|
358 |
+
|
359 |
+
// Screen: All
|
360 |
+
if(empty($screen)){
|
361 |
+
|
362 |
+
$screen_allow = true;
|
363 |
+
|
364 |
+
}
|
365 |
+
|
366 |
+
// Screen: Admin
|
367 |
+
elseif($screen === 'admin' && acfe_form_is_admin()){
|
368 |
+
|
369 |
+
$screen_allow = true;
|
370 |
+
|
371 |
+
}
|
372 |
+
|
373 |
+
// Screen: Front
|
374 |
+
elseif($screen === 'front' && acfe_form_is_front()){
|
375 |
+
|
376 |
+
$screen_allow = true;
|
377 |
+
|
378 |
+
}
|
379 |
+
|
380 |
+
if(!$screen_allow)
|
381 |
+
continue;
|
382 |
+
|
383 |
+
if(!acf_maybe_get($rule, 'acfe_settings_settings'))
|
384 |
+
continue;
|
385 |
+
|
386 |
+
// Properties
|
387 |
+
$properties = $rule['acfe_settings_settings'];
|
388 |
+
|
389 |
+
foreach($properties as $property){
|
390 |
+
|
391 |
+
// Required / Hide field / Hide label / Default value / Placeholder / Instructions
|
392 |
+
$property_name = $property['acfe_settings_setting_type'];
|
393 |
+
|
394 |
+
// Custom
|
395 |
+
if($property['acfe_settings_setting_type'] === 'custom'){
|
396 |
+
|
397 |
+
if(!isset($property['acfe_settings_setting_name']) || empty($property['acfe_settings_setting_name']))
|
398 |
+
continue;
|
399 |
+
|
400 |
+
$property_name = $property['acfe_settings_setting_name'];
|
401 |
+
|
402 |
+
}
|
403 |
+
|
404 |
+
// = value
|
405 |
+
if($property['acfe_settings_setting_operator'] === '='){
|
406 |
+
|
407 |
+
$field[$property_name] = $property['acfe_settings_setting_value'];
|
408 |
+
|
409 |
+
}
|
410 |
+
|
411 |
+
// = true
|
412 |
+
elseif($property['acfe_settings_setting_operator'] === 'true'){
|
413 |
+
|
414 |
+
$field[$property_name] = true;
|
415 |
+
|
416 |
+
}
|
417 |
+
|
418 |
+
// = false
|
419 |
+
elseif($property['acfe_settings_setting_operator'] === 'false'){
|
420 |
+
|
421 |
+
$field[$property_name] = false;
|
422 |
+
|
423 |
+
}
|
424 |
+
|
425 |
+
// = empty
|
426 |
+
elseif($property['acfe_settings_setting_operator'] === 'empty'){
|
427 |
+
|
428 |
+
$field[$property_name] = '';
|
429 |
+
|
430 |
+
}
|
431 |
+
|
432 |
+
}
|
433 |
+
|
434 |
+
}
|
435 |
+
|
436 |
+
return $field;
|
437 |
+
|
438 |
+
}
|
439 |
+
|
440 |
+
/*
|
441 |
+
* Additional settings
|
442 |
+
*/
|
443 |
+
function prepare_field($field){
|
444 |
+
|
445 |
+
if(isset($field['hide_field']) && !empty($field['hide_field'])){
|
446 |
+
|
447 |
+
return false;
|
448 |
+
|
449 |
+
}
|
450 |
+
|
451 |
+
if(isset($field['hide_label']) && !empty($field['hide_label'])){
|
452 |
+
|
453 |
+
$field['label'] = '';
|
454 |
+
|
455 |
+
}
|
456 |
+
|
457 |
+
return $field;
|
458 |
+
|
459 |
+
}
|
460 |
+
|
461 |
+
/**
|
462 |
+
* Process Setting
|
463 |
+
*/
|
464 |
+
function fix_repeater($field){
|
465 |
+
|
466 |
+
$field['prefix'] = str_replace('row-', '', $field['prefix']);
|
467 |
+
$field['name'] = str_replace('row-', '', $field['name']);
|
468 |
+
|
469 |
+
return $field;
|
470 |
+
|
471 |
+
}
|
472 |
+
|
473 |
+
/**
|
474 |
+
* Setting: ACF Clone Index fix for flexible duplicate
|
475 |
+
*/
|
476 |
+
function fix_clone($field){
|
477 |
+
|
478 |
+
if(isset($field['acfe_settings']['acfcloneindex']))
|
479 |
+
$field['acfe_settings'] = false;
|
480 |
+
|
481 |
+
return $field;
|
482 |
+
|
483 |
+
}
|
484 |
+
|
485 |
+
}
|
486 |
+
|
487 |
+
// initialize
|
488 |
+
new acfe_field_settings();
|
489 |
+
|
490 |
endif;
|
includes/fields-settings/validation.php
CHANGED
@@ -35,7 +35,7 @@ class acfe_field_validation{
|
|
35 |
),
|
36 |
|
37 |
'Is' => array(
|
38 |
-
'is_email' => 'If is email - is_email(value)
|
39 |
'is_user_logged_in' => 'If is user logged in - is_user_logged_in()',
|
40 |
),
|
41 |
|
@@ -486,7 +486,7 @@ class acfe_field_validation{
|
|
486 |
|
487 |
// Vars
|
488 |
$operator = $function['acfe_validate_operator'];
|
489 |
-
$match = $function
|
490 |
|
491 |
if($operator === '==' && $result == $match){
|
492 |
$rule_match = true;
|
35 |
),
|
36 |
|
37 |
'Is' => array(
|
38 |
+
'is_email' => 'If is email - is_email(value)',
|
39 |
'is_user_logged_in' => 'If is user logged in - is_user_logged_in()',
|
40 |
),
|
41 |
|
486 |
|
487 |
// Vars
|
488 |
$operator = $function['acfe_validate_operator'];
|
489 |
+
$match = acf_maybe_get($function, 'acfe_validate_match');
|
490 |
|
491 |
if($operator === '==' && $result == $match){
|
492 |
$rule_match = true;
|
includes/fields/field-advanced-link.php
CHANGED
@@ -7,6 +7,8 @@ if(!class_exists('acfe_field_advanced_link')):
|
|
7 |
|
8 |
class acfe_field_advanced_link extends acf_field{
|
9 |
|
|
|
|
|
10 |
function __construct(){
|
11 |
|
12 |
$this->name = 'acfe_advanced_link';
|
@@ -16,14 +18,155 @@ class acfe_field_advanced_link extends acf_field{
|
|
16 |
'post_type' => array(),
|
17 |
'taxonomy' => array(),
|
18 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
parent::__construct();
|
21 |
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
function render_field_settings($field){
|
25 |
|
26 |
-
//
|
27 |
acf_render_field_setting($field, array(
|
28 |
'label' => __('Filter by Post Type','acf'),
|
29 |
'instructions' => '',
|
@@ -36,7 +179,7 @@ class acfe_field_advanced_link extends acf_field{
|
|
36 |
'placeholder' => __("All post types",'acf'),
|
37 |
));
|
38 |
|
39 |
-
//
|
40 |
acf_render_field_setting($field, array(
|
41 |
'label' => __('Filter by Taxonomy','acf'),
|
42 |
'instructions' => '',
|
@@ -55,28 +198,25 @@ class acfe_field_advanced_link extends acf_field{
|
|
55 |
|
56 |
ob_start();
|
57 |
?>
|
58 |
-
Add your own fields using the following hook:<br /><br />
|
59 |
<pre>
|
60 |
-
add_filter('acfe/fields/advanced_link/
|
61 |
-
function
|
62 |
|
63 |
/**
|
64 |
-
* @array $
|
65 |
-
* @array $field
|
66 |
-
* @array $value
|
67 |
*/
|
68 |
|
69 |
-
$
|
70 |
-
'prefix' => $field['name'],
|
71 |
'name' => 'my_field',
|
72 |
-
'key' => 'acfe_advanced_link_my_field',
|
73 |
'label' => 'My field',
|
74 |
'type' => 'true_false',
|
75 |
-
'ui' => true
|
76 |
-
'value' => isset($value['my_field']) ? $value['my_field'] : ''
|
77 |
);
|
78 |
|
79 |
-
return $
|
80 |
|
81 |
}
|
82 |
</pre>
|
@@ -86,7 +226,7 @@ function my_acf_advanced_link_fields($fields, $field, $value){
|
|
86 |
|
87 |
// field_type
|
88 |
acf_render_field_setting($field, array(
|
89 |
-
'label' => __('
|
90 |
'instructions' => '',
|
91 |
'type' => 'message',
|
92 |
'name' => 'instructions',
|
@@ -96,51 +236,57 @@ function my_acf_advanced_link_fields($fields, $field, $value){
|
|
96 |
|
97 |
}
|
98 |
|
99 |
-
function
|
100 |
|
101 |
// vars
|
102 |
$value = wp_parse_args($value, array(
|
|
|
103 |
'post' => '',
|
104 |
-
|
105 |
-
'url' => '',
|
106 |
'title' => '',
|
|
|
|
|
107 |
'target' => false,
|
108 |
));
|
109 |
|
110 |
-
|
111 |
-
'type' => 'url',
|
112 |
-
'url' => false,
|
113 |
-
'post' => '',
|
114 |
-
'title' => '',
|
115 |
-
'target' => false,
|
116 |
-
);
|
117 |
|
118 |
-
|
119 |
-
$link['type'] = $value['type'];
|
120 |
-
$link['title'] = $value['title'];
|
121 |
-
if($value['target'])
|
122 |
-
$link['target'] = '_blank';
|
123 |
-
|
124 |
-
// URL
|
125 |
-
if($value['type'] === 'url'){
|
126 |
-
|
127 |
-
$link['url'] = $value['url'];
|
128 |
-
|
129 |
// Post
|
130 |
-
|
131 |
-
|
132 |
-
$link['post'] = $value['post'];
|
133 |
|
134 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
-
$
|
|
|
|
|
|
|
137 |
|
138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
}
|
141 |
|
142 |
// return
|
143 |
-
return $
|
144 |
|
145 |
}
|
146 |
|
@@ -153,57 +299,42 @@ function my_acf_advanced_link_fields($fields, $field, $value){
|
|
153 |
);
|
154 |
|
155 |
// get link
|
156 |
-
$
|
157 |
|
158 |
// classes
|
159 |
-
if($
|
160 |
-
$div['class'] .= ' -value';
|
161 |
-
|
162 |
-
if($link['target'] === '_blank')
|
163 |
-
$div['class'] .= ' -external';
|
164 |
-
|
165 |
-
$link['url_title'] = '';
|
166 |
-
|
167 |
-
// URL
|
168 |
-
if($link['type'] === 'url'){
|
169 |
|
170 |
-
$
|
171 |
|
172 |
-
|
173 |
-
|
|
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
$link['url_title'] = get_the_title($link['post']);
|
178 |
-
|
179 |
-
}
|
180 |
|
181 |
}
|
182 |
|
183 |
-
$
|
184 |
|
185 |
array(
|
186 |
-
'prefix' => $field['name'],
|
187 |
'name' => 'type',
|
188 |
'key' => 'type',
|
189 |
'label' => __('Type', 'acf'),
|
190 |
'type' => 'radio',
|
191 |
-
'value' => $link['type'],
|
192 |
'required' => false,
|
193 |
'class' => 'input-type',
|
194 |
'choices' => array(
|
195 |
'url' => __('URL', 'acf'),
|
196 |
'post' => __('Post', 'acf'),
|
|
|
197 |
),
|
198 |
),
|
199 |
|
200 |
array(
|
201 |
-
'prefix' => $field['name'],
|
202 |
'name' => 'url',
|
203 |
'key' => 'url',
|
204 |
'label' => __('URL', 'acf'),
|
205 |
'type' => 'text',
|
206 |
-
'value' => $link['url'],
|
207 |
'required' => false,
|
208 |
'class' => 'input-url',
|
209 |
'conditional_logic' => array(
|
@@ -219,15 +350,14 @@ function my_acf_advanced_link_fields($fields, $field, $value){
|
|
219 |
),
|
220 |
|
221 |
array(
|
222 |
-
'prefix' => $field['name'],
|
223 |
'name' => 'post',
|
224 |
'key' => 'post',
|
225 |
'label' => __('Post', 'acf'),
|
226 |
'type' => 'post_object',
|
227 |
-
'value' => $link['post'],
|
228 |
'required' => false,
|
229 |
'class' => 'input-post',
|
230 |
-
'allow_null' =>
|
|
|
231 |
'conditional_logic' => array(
|
232 |
array(
|
233 |
array(
|
@@ -240,23 +370,42 @@ function my_acf_advanced_link_fields($fields, $field, $value){
|
|
240 |
),
|
241 |
|
242 |
array(
|
243 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
'name' => 'title',
|
245 |
'key' => 'title',
|
246 |
'label' => __('Link text', 'acf'),
|
247 |
'type' => 'text',
|
248 |
-
'value' => $link['title'],
|
249 |
'required' => false,
|
250 |
'class' => 'input-title',
|
251 |
),
|
252 |
|
253 |
array(
|
254 |
-
'prefix' => $field['name'],
|
255 |
'name' => 'target',
|
256 |
'key' => 'target',
|
257 |
'label' => __('Target', 'acf'),
|
258 |
'type' => 'true_false',
|
259 |
-
'value' => $link['target'],
|
260 |
'message' => __('Open in an new window', 'acf'),
|
261 |
'required' => false,
|
262 |
'class' => 'input-target',
|
@@ -264,9 +413,27 @@ function my_acf_advanced_link_fields($fields, $field, $value){
|
|
264 |
|
265 |
);
|
266 |
|
267 |
-
|
268 |
-
$
|
269 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
?>
|
272 |
|
@@ -278,7 +445,7 @@ function my_acf_advanced_link_fields($fields, $field, $value){
|
|
278 |
|
279 |
<div class="acf-fields acf-form-fields -left">
|
280 |
|
281 |
-
<?php acf_render_fields($
|
282 |
|
283 |
</div>
|
284 |
|
@@ -289,8 +456,8 @@ function my_acf_advanced_link_fields($fields, $field, $value){
|
|
289 |
<a href="#" class="button" data-name="add" target=""><?php _e('Select Link', 'acf'); ?></a>
|
290 |
|
291 |
<div class="link-wrap">
|
292 |
-
<span class="link-title"><?php echo esc_html($
|
293 |
-
<a class="link-url" href="<?php echo esc_url($
|
294 |
<i class="acf-icon -link-ext acf-js-tooltip" title="<?php _e('Opens in a new window/tab', 'acf'); ?>"></i><?php
|
295 |
?><a class="acf-icon -pencil -clear acf-js-tooltip" data-name="edit" href="#" title="<?php _e('Edit', 'acf'); ?>"></a><?php
|
296 |
?><a class="acf-icon -cancel -clear acf-js-tooltip" data-name="remove" href="#" title="<?php _e('Remove', 'acf'); ?>"></a>
|
@@ -303,15 +470,16 @@ function my_acf_advanced_link_fields($fields, $field, $value){
|
|
303 |
|
304 |
function format_value($value, $post_id, $field){
|
305 |
|
306 |
-
//
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
|
|
|
|
312 |
|
313 |
-
|
314 |
-
return $link;
|
315 |
|
316 |
}
|
317 |
|
@@ -320,10 +488,13 @@ function my_acf_advanced_link_fields($fields, $field, $value){
|
|
320 |
// bail early if not required
|
321 |
if(!$field['required'])
|
322 |
return $valid;
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
|
|
|
|
|
|
327 |
|
328 |
// return
|
329 |
return $valid;
|
7 |
|
8 |
class acfe_field_advanced_link extends acf_field{
|
9 |
|
10 |
+
public $post_object = '';
|
11 |
+
|
12 |
function __construct(){
|
13 |
|
14 |
$this->name = 'acfe_advanced_link';
|
18 |
'post_type' => array(),
|
19 |
'taxonomy' => array(),
|
20 |
);
|
21 |
+
|
22 |
+
add_action('wp_ajax_acfe/fields/advanced_link/post_query', array($this, 'ajax_query'));
|
23 |
+
add_action('wp_ajax_nopriv_acfe/fields/advanced_link/post_query', array($this, 'ajax_query'));
|
24 |
+
|
25 |
+
$this->post_object = acf_get_field_type('post_object');
|
26 |
+
remove_action('acf/render_field/type=post_object', array($this->post_object, 'render_field'), 9);
|
27 |
+
|
28 |
+
add_action('acf/render_field/type=post_object', array($this, 'post_object_render_field'), 9);
|
29 |
|
30 |
parent::__construct();
|
31 |
|
32 |
}
|
33 |
|
34 |
+
function post_object_render_field($field){
|
35 |
+
|
36 |
+
// Change Field into a select
|
37 |
+
$field['type'] = 'select';
|
38 |
+
$field['ui'] = 1;
|
39 |
+
$field['ajax'] = 1;
|
40 |
+
$field['choices'] = array();
|
41 |
+
|
42 |
+
// load posts
|
43 |
+
$posts = $this->post_object->get_posts( $field['value'], $field );
|
44 |
+
|
45 |
+
if($posts){
|
46 |
+
|
47 |
+
foreach( array_keys($posts) as $i ) {
|
48 |
+
|
49 |
+
// vars
|
50 |
+
$post = acf_extract_var( $posts, $i );
|
51 |
+
|
52 |
+
|
53 |
+
// append to choices
|
54 |
+
$field['choices'][ $post->ID ] = $this->post_object->get_post_title( $post, $field );
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
if(!is_array($field['value']) && !is_numeric($field['value'])){
|
61 |
+
|
62 |
+
$post_type = $field['value'];
|
63 |
+
$post_type_label = acf_get_post_type_label($post_type);
|
64 |
+
|
65 |
+
$field['choices'][$field['value']] = $post_type_label . ' Archive';
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
// render
|
70 |
+
acf_render_field( $field );
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
function ajax_query(){
|
75 |
+
|
76 |
+
// validate
|
77 |
+
if(!acf_verify_ajax())
|
78 |
+
die();
|
79 |
+
|
80 |
+
// get choices
|
81 |
+
$response = $this->post_object->get_ajax_query($_POST);
|
82 |
+
|
83 |
+
$options = acf_parse_args($_POST, array(
|
84 |
+
'post_id' => 0,
|
85 |
+
's' => '',
|
86 |
+
'field_key' => '',
|
87 |
+
'paged' => 1
|
88 |
+
));
|
89 |
+
|
90 |
+
$field = acf_get_field($options['field_key']);
|
91 |
+
if(!$field)
|
92 |
+
return false;
|
93 |
+
|
94 |
+
if($options['paged'] > 1)
|
95 |
+
acf_send_ajax_results($response);
|
96 |
+
|
97 |
+
// init archives
|
98 |
+
$s = false;
|
99 |
+
$is_search = false;
|
100 |
+
|
101 |
+
if($options['s'] !== ''){
|
102 |
+
|
103 |
+
$s = wp_unslash(strval($options['s']));
|
104 |
+
$is_search = true;
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
if(!empty($field['post_type'])){
|
109 |
+
|
110 |
+
$post_types = acf_get_array($field['post_type']);
|
111 |
+
|
112 |
+
}else{
|
113 |
+
|
114 |
+
$post_types = acf_get_post_types();
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
$post_types_archives = array();
|
119 |
+
|
120 |
+
foreach($post_types as $post_type){
|
121 |
+
|
122 |
+
$post_type_obj = get_post_type_object($post_type);
|
123 |
+
|
124 |
+
$has_archive = false;
|
125 |
+
|
126 |
+
if($post_type === 'post' || $post_type_obj->has_archive){
|
127 |
+
|
128 |
+
$has_archive = true;
|
129 |
+
|
130 |
+
}
|
131 |
+
|
132 |
+
if(!$has_archive)
|
133 |
+
continue;
|
134 |
+
|
135 |
+
$post_type_label = acf_get_post_type_label($post_type);
|
136 |
+
|
137 |
+
if($is_search && stripos($post_type_label, $s) === false)
|
138 |
+
continue;
|
139 |
+
|
140 |
+
$post_types_archives[] = array(
|
141 |
+
'id' => $post_type,
|
142 |
+
'text' => $post_type_label . ' Archive'
|
143 |
+
);
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
if(!empty($post_types_archives)){
|
148 |
+
|
149 |
+
if(!isset($response['results'])){
|
150 |
+
|
151 |
+
$response['results'] = array();
|
152 |
+
|
153 |
+
}
|
154 |
+
|
155 |
+
array_unshift($response['results'], array(
|
156 |
+
'text' => 'Archives',
|
157 |
+
'children' => $post_types_archives
|
158 |
+
));
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
// return
|
163 |
+
acf_send_ajax_results($response);
|
164 |
+
|
165 |
+
}
|
166 |
+
|
167 |
function render_field_settings($field){
|
168 |
|
169 |
+
// Filter Post Type
|
170 |
acf_render_field_setting($field, array(
|
171 |
'label' => __('Filter by Post Type','acf'),
|
172 |
'instructions' => '',
|
179 |
'placeholder' => __("All post types",'acf'),
|
180 |
));
|
181 |
|
182 |
+
// Filter Taxonomy
|
183 |
acf_render_field_setting($field, array(
|
184 |
'label' => __('Filter by Taxonomy','acf'),
|
185 |
'instructions' => '',
|
198 |
|
199 |
ob_start();
|
200 |
?>
|
201 |
+
Add your own sub fields using the following hook:<br /><br />
|
202 |
<pre>
|
203 |
+
add_filter('acfe/fields/advanced_link/sub_fields/name=<?php echo $field_name; ?>', 'my_acf_advanced_link_sub_fields', 10, 3);
|
204 |
+
function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
205 |
|
206 |
/**
|
207 |
+
* @array $sub_fields Sub fields array
|
208 |
+
* @array $field Advanced Link field
|
209 |
+
* @array $value Advanced Link values
|
210 |
*/
|
211 |
|
212 |
+
$sub_fields[] = array(
|
|
|
213 |
'name' => 'my_field',
|
|
|
214 |
'label' => 'My field',
|
215 |
'type' => 'true_false',
|
216 |
+
'ui' => true
|
|
|
217 |
);
|
218 |
|
219 |
+
return $sub_fields;
|
220 |
|
221 |
}
|
222 |
</pre>
|
226 |
|
227 |
// field_type
|
228 |
acf_render_field_setting($field, array(
|
229 |
+
'label' => __('Custom sub fields','acf'),
|
230 |
'instructions' => '',
|
231 |
'type' => 'message',
|
232 |
'name' => 'instructions',
|
236 |
|
237 |
}
|
238 |
|
239 |
+
function get_value($value = array()){
|
240 |
|
241 |
// vars
|
242 |
$value = wp_parse_args($value, array(
|
243 |
+
'type' => 'url',
|
244 |
'post' => '',
|
245 |
+
'term' => '',
|
|
|
246 |
'title' => '',
|
247 |
+
'url' => false,
|
248 |
+
'url_title' => '',
|
249 |
'target' => false,
|
250 |
));
|
251 |
|
252 |
+
$value['url_title'] = $value['url'];
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
// Post
|
255 |
+
if($value['type'] === 'post' && !empty($value['post'])){
|
|
|
|
|
256 |
|
257 |
+
if(is_numeric($value['post'])){
|
258 |
+
|
259 |
+
$value['url'] = get_permalink($value['post']);
|
260 |
+
$value['url_title'] = get_the_title($value['post']);
|
261 |
+
|
262 |
+
}else{
|
263 |
|
264 |
+
$post_type = $value['post'];
|
265 |
+
|
266 |
+
$value['url'] = get_post_type_archive_link($post_type);
|
267 |
+
$value['url_title'] = acf_get_post_type_label($post_type) . ' Archive';
|
268 |
|
269 |
}
|
270 |
+
|
271 |
+
// Term
|
272 |
+
}elseif($value['type'] === 'term' && !empty($value['term'])){
|
273 |
+
|
274 |
+
$term = get_term(intval($value['term']));
|
275 |
+
|
276 |
+
$value['url'] = get_term_link($term);
|
277 |
+
$value['url_title'] = $term->name;
|
278 |
+
|
279 |
+
}
|
280 |
+
|
281 |
+
// Target
|
282 |
+
if(!empty($value['target'])){
|
283 |
+
|
284 |
+
$value['target'] = '_blank';
|
285 |
|
286 |
}
|
287 |
|
288 |
// return
|
289 |
+
return $value;
|
290 |
|
291 |
}
|
292 |
|
299 |
);
|
300 |
|
301 |
// get link
|
302 |
+
$value = $this->get_value($field['value']);
|
303 |
|
304 |
// classes
|
305 |
+
if($value['url']){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
+
$div['class'] .= ' -value';
|
308 |
|
309 |
+
}
|
310 |
+
|
311 |
+
if($value['target'] === '_blank'){
|
312 |
|
313 |
+
$div['class'] .= ' -external';
|
|
|
|
|
|
|
|
|
314 |
|
315 |
}
|
316 |
|
317 |
+
$sub_fields = array(
|
318 |
|
319 |
array(
|
|
|
320 |
'name' => 'type',
|
321 |
'key' => 'type',
|
322 |
'label' => __('Type', 'acf'),
|
323 |
'type' => 'radio',
|
|
|
324 |
'required' => false,
|
325 |
'class' => 'input-type',
|
326 |
'choices' => array(
|
327 |
'url' => __('URL', 'acf'),
|
328 |
'post' => __('Post', 'acf'),
|
329 |
+
'term' => __('Term', 'acf'),
|
330 |
),
|
331 |
),
|
332 |
|
333 |
array(
|
|
|
334 |
'name' => 'url',
|
335 |
'key' => 'url',
|
336 |
'label' => __('URL', 'acf'),
|
337 |
'type' => 'text',
|
|
|
338 |
'required' => false,
|
339 |
'class' => 'input-url',
|
340 |
'conditional_logic' => array(
|
350 |
),
|
351 |
|
352 |
array(
|
|
|
353 |
'name' => 'post',
|
354 |
'key' => 'post',
|
355 |
'label' => __('Post', 'acf'),
|
356 |
'type' => 'post_object',
|
|
|
357 |
'required' => false,
|
358 |
'class' => 'input-post',
|
359 |
+
'allow_null' => 0,
|
360 |
+
'ajax_action' => 'acfe/fields/advanced_link/post_query',
|
361 |
'conditional_logic' => array(
|
362 |
array(
|
363 |
array(
|
370 |
),
|
371 |
|
372 |
array(
|
373 |
+
'name' => 'term',
|
374 |
+
'key' => 'term',
|
375 |
+
'label' => __('Term', 'acf'),
|
376 |
+
'type' => 'acfe_taxonomy_terms',
|
377 |
+
'required' => false,
|
378 |
+
'class' => 'input-term',
|
379 |
+
'allow_null' => 1,
|
380 |
+
'field_type' => 'select',
|
381 |
+
'return_format' => 'id',
|
382 |
+
'ui' => 1,
|
383 |
+
'allow_null' => 0,
|
384 |
+
'conditional_logic' => array(
|
385 |
+
array(
|
386 |
+
array(
|
387 |
+
'field' => 'type',
|
388 |
+
'operator' => '==',
|
389 |
+
'value' => 'term',
|
390 |
+
)
|
391 |
+
)
|
392 |
+
)
|
393 |
+
),
|
394 |
+
|
395 |
+
array(
|
396 |
'name' => 'title',
|
397 |
'key' => 'title',
|
398 |
'label' => __('Link text', 'acf'),
|
399 |
'type' => 'text',
|
|
|
400 |
'required' => false,
|
401 |
'class' => 'input-title',
|
402 |
),
|
403 |
|
404 |
array(
|
|
|
405 |
'name' => 'target',
|
406 |
'key' => 'target',
|
407 |
'label' => __('Target', 'acf'),
|
408 |
'type' => 'true_false',
|
|
|
409 |
'message' => __('Open in an new window', 'acf'),
|
410 |
'required' => false,
|
411 |
'class' => 'input-target',
|
413 |
|
414 |
);
|
415 |
|
416 |
+
// Deprecated
|
417 |
+
$sub_fields = apply_filters('acfe/fields/advanced_link/fields', $sub_fields, $field, $value);
|
418 |
+
$sub_fields = apply_filters('acfe/fields/advanced_link/fields/name=' . $field['_name'], $sub_fields, $field, $value);
|
419 |
+
$sub_fields = apply_filters('acfe/fields/advanced_link/fields/key=' . $field['key'], $sub_fields, $field, $value);
|
420 |
+
|
421 |
+
// Sub Fields Fitlers
|
422 |
+
$sub_fields = apply_filters('acfe/fields/advanced_link/sub_fields', $sub_fields, $field, $value);
|
423 |
+
$sub_fields = apply_filters('acfe/fields/advanced_link/sub_fields/name=' . $field['_name'], $sub_fields, $field, $value);
|
424 |
+
$sub_fields = apply_filters('acfe/fields/advanced_link/sub_fields/key=' . $field['key'], $sub_fields, $field, $value);
|
425 |
+
|
426 |
+
foreach($sub_fields as &$sub_field){
|
427 |
+
|
428 |
+
$sub_field['prefix'] = $field['name'];
|
429 |
+
|
430 |
+
$sub_field['value'] = isset($value[$sub_field['name']]) ? $value[$sub_field['name']] : '';
|
431 |
+
|
432 |
+
$sub_field = acf_validate_field($sub_field);
|
433 |
+
|
434 |
+
$sub_field = acf_prepare_field($sub_field);
|
435 |
+
|
436 |
+
}
|
437 |
|
438 |
?>
|
439 |
|
445 |
|
446 |
<div class="acf-fields acf-form-fields -left">
|
447 |
|
448 |
+
<?php acf_render_fields($sub_fields, false, 'div', 'label'); ?>
|
449 |
|
450 |
</div>
|
451 |
|
456 |
<a href="#" class="button" data-name="add" target=""><?php _e('Select Link', 'acf'); ?></a>
|
457 |
|
458 |
<div class="link-wrap">
|
459 |
+
<span class="link-title"><?php echo esc_html($value['title']); ?></span>
|
460 |
+
<a class="link-url" href="<?php echo esc_url($value['url']); ?>" target="_blank"><?php echo esc_html($value['url_title']); ?></a>
|
461 |
<i class="acf-icon -link-ext acf-js-tooltip" title="<?php _e('Opens in a new window/tab', 'acf'); ?>"></i><?php
|
462 |
?><a class="acf-icon -pencil -clear acf-js-tooltip" data-name="edit" href="#" title="<?php _e('Edit', 'acf'); ?>"></a><?php
|
463 |
?><a class="acf-icon -cancel -clear acf-js-tooltip" data-name="remove" href="#" title="<?php _e('Remove', 'acf'); ?>"></a>
|
470 |
|
471 |
function format_value($value, $post_id, $field){
|
472 |
|
473 |
+
// get value
|
474 |
+
$value = $this->get_value($value);
|
475 |
+
|
476 |
+
// clean
|
477 |
+
unset($value['type']);
|
478 |
+
unset($value['post']);
|
479 |
+
unset($value['term']);
|
480 |
+
unset($value['url_title']);
|
481 |
|
482 |
+
return $value;
|
|
|
483 |
|
484 |
}
|
485 |
|
488 |
// bail early if not required
|
489 |
if(!$field['required'])
|
490 |
return $valid;
|
491 |
+
|
492 |
+
// URL is required
|
493 |
+
if(empty($value))
|
494 |
+
return false;
|
495 |
+
|
496 |
+
if((acf_maybe_get($value, 'post') || acf_maybe_get($value, 'term')) && !acf_maybe_get($value, 'url'))
|
497 |
+
return false;
|
498 |
|
499 |
// return
|
500 |
return $valid;
|
includes/fields/field-code-editor.php
CHANGED
@@ -22,7 +22,8 @@ class acfe_field_code_editor extends acf_field{
|
|
22 |
'lines' => true,
|
23 |
'indent_unit' => 4,
|
24 |
'maxlength' => '',
|
25 |
-
'rows' => ''
|
|
|
26 |
);
|
27 |
|
28 |
$this->textarea = acf_get_field_type('textarea');
|
@@ -37,7 +38,9 @@ class acfe_field_code_editor extends acf_field{
|
|
37 |
'class' => 'acf-input-wrap acfe-field-code-editor',
|
38 |
'data-mode' => $field['mode'],
|
39 |
'data-lines' => $field['lines'],
|
40 |
-
'data-
|
|
|
|
|
41 |
);
|
42 |
|
43 |
$field['type'] = 'textarea';
|
@@ -120,6 +123,15 @@ class acfe_field_code_editor extends acf_field{
|
|
120 |
'placeholder' => 8
|
121 |
));
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
}
|
124 |
|
125 |
function input_admin_enqueue_scripts(){
|
22 |
'lines' => true,
|
23 |
'indent_unit' => 4,
|
24 |
'maxlength' => '',
|
25 |
+
'rows' => '',
|
26 |
+
'max_rows' => ''
|
27 |
);
|
28 |
|
29 |
$this->textarea = acf_get_field_type('textarea');
|
38 |
'class' => 'acf-input-wrap acfe-field-code-editor',
|
39 |
'data-mode' => $field['mode'],
|
40 |
'data-lines' => $field['lines'],
|
41 |
+
'data-indent-unit' => $field['indent_unit'],
|
42 |
+
'data-rows' => $field['rows'],
|
43 |
+
'data-max-rows' => $field['max_rows'],
|
44 |
);
|
45 |
|
46 |
$field['type'] = 'textarea';
|
123 |
'placeholder' => 8
|
124 |
));
|
125 |
|
126 |
+
// max rows
|
127 |
+
acf_render_field_setting($field, array(
|
128 |
+
'label' => __('Max rows','acf'),
|
129 |
+
'instructions' => __('Sets the textarea max height','acf'),
|
130 |
+
'type' => 'number',
|
131 |
+
'name' => 'max_rows',
|
132 |
+
'placeholder' => ''
|
133 |
+
));
|
134 |
+
|
135 |
}
|
136 |
|
137 |
function input_admin_enqueue_scripts(){
|
includes/fields/field-file.php
CHANGED
@@ -41,11 +41,15 @@ function acfe_field_file_settings($field){
|
|
41 |
|
42 |
add_filter('acf/prepare_field/type=file', 'acfe_field_file_uploader_type');
|
43 |
function acfe_field_file_uploader_type($field){
|
44 |
-
|
45 |
-
|
46 |
return $field;
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
49 |
|
50 |
return $field;
|
51 |
|
41 |
|
42 |
add_filter('acf/prepare_field/type=file', 'acfe_field_file_uploader_type');
|
43 |
function acfe_field_file_uploader_type($field){
|
44 |
+
|
45 |
+
if(!acf_maybe_get($field, 'acfe_uploader'))
|
46 |
return $field;
|
47 |
+
|
48 |
+
// ACFE Form force uploader type
|
49 |
+
if(acf_is_filter_enabled('acfe/form/uploader'))
|
50 |
+
return $field;
|
51 |
+
|
52 |
+
acf_update_setting('uploader', $field['acfe_uploader']);
|
53 |
|
54 |
return $field;
|
55 |
|
includes/fields/field-flexible-content.php
CHANGED
@@ -125,6 +125,36 @@ function acfe_flexible_layout_render_script_setting($return, $field, $layout, $i
|
|
125 |
|
126 |
}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
if(!class_exists('acfe_field_flexible_content')):
|
129 |
|
130 |
class acfe_field_flexible_content extends acf_field_flexible_content{
|
@@ -869,16 +899,19 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
869 |
|
870 |
// Category
|
871 |
if($flexible['acfe_flexible_modal'] && acf_maybe_get($flexible['acfe_flexible_modal'], 'acfe_flexible_modal_categories')){
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
|
|
|
|
|
|
882 |
|
883 |
}
|
884 |
|
@@ -1136,8 +1169,18 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
|
|
1136 |
|
1137 |
// Category
|
1138 |
if($layout['acfe_flexible_category'] && $field['acfe_flexible_modal']['acfe_flexible_modal_categories']){
|
1139 |
-
|
1140 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1141 |
|
1142 |
}
|
1143 |
|
125 |
|
126 |
}
|
127 |
|
128 |
+
add_filter('acf/prepare_field/name=acfe_flexible_category', 'acfe_prepare_flexible_layout_categories');
|
129 |
+
function acfe_prepare_flexible_layout_categories($field){
|
130 |
+
|
131 |
+
$value = acf_maybe_get($field, 'value');
|
132 |
+
|
133 |
+
if(empty($value))
|
134 |
+
return $field;
|
135 |
+
|
136 |
+
if(is_string($value)){
|
137 |
+
|
138 |
+
$explode = explode('|', $value);
|
139 |
+
|
140 |
+
$choices = array();
|
141 |
+
|
142 |
+
foreach($explode as $v){
|
143 |
+
|
144 |
+
$v = trim($v);
|
145 |
+
$choices[$v] = $v;
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
$field['choices'] = $choices;
|
150 |
+
$field['value'] = $choices;
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
return $field;
|
155 |
+
|
156 |
+
}
|
157 |
+
|
158 |
if(!class_exists('acfe_field_flexible_content')):
|
159 |
|
160 |
class acfe_field_flexible_content extends acf_field_flexible_content{
|
899 |
|
900 |
// Category
|
901 |
if($flexible['acfe_flexible_modal'] && acf_maybe_get($flexible['acfe_flexible_modal'], 'acfe_flexible_modal_categories')){
|
902 |
+
|
903 |
+
acf_render_field_wrap(array(
|
904 |
+
'prepend' => __('Category'),
|
905 |
+
'name' => 'acfe_flexible_category',
|
906 |
+
'type' => 'select',
|
907 |
+
'ui' => 1,
|
908 |
+
'multiple' => 1,
|
909 |
+
'allow_custom' => 1,
|
910 |
+
'class' => 'acf-fc-meta-name',
|
911 |
+
'prefix' => $prefix,
|
912 |
+
'value' => $layout['acfe_flexible_category'],
|
913 |
+
'placeholder' => __('Layouts categories')
|
914 |
+
), 'ul');
|
915 |
|
916 |
}
|
917 |
|
1169 |
|
1170 |
// Category
|
1171 |
if($layout['acfe_flexible_category'] && $field['acfe_flexible_modal']['acfe_flexible_modal_categories']){
|
1172 |
+
|
1173 |
+
$categories = $layout['acfe_flexible_category'];
|
1174 |
+
|
1175 |
+
// Compatibility
|
1176 |
+
if(is_string($categories)){
|
1177 |
+
|
1178 |
+
$categories = explode('|', $categories);
|
1179 |
+
$categories = array_map('trim', $categories);
|
1180 |
+
|
1181 |
+
}
|
1182 |
+
|
1183 |
+
$span['data-acfe-flexible-category'] = $categories;
|
1184 |
|
1185 |
}
|
1186 |
|
includes/fields/field-image.php
CHANGED
@@ -54,11 +54,15 @@ function acfe_field_image_settings($field){
|
|
54 |
|
55 |
add_filter('acf/prepare_field/type=image', 'acfe_field_image_uploader_type');
|
56 |
function acfe_field_image_uploader_type($field){
|
57 |
-
|
58 |
-
|
59 |
return $field;
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
|
63 |
return $field;
|
64 |
|
54 |
|
55 |
add_filter('acf/prepare_field/type=image', 'acfe_field_image_uploader_type');
|
56 |
function acfe_field_image_uploader_type($field){
|
57 |
+
|
58 |
+
if(!acf_maybe_get($field, 'acfe_uploader'))
|
59 |
return $field;
|
60 |
+
|
61 |
+
// ACFE Form force uploader type
|
62 |
+
if(acf_is_filter_enabled('acfe/form/uploader'))
|
63 |
+
return $field;
|
64 |
+
|
65 |
+
acf_update_setting('uploader', $field['acfe_uploader']);
|
66 |
|
67 |
return $field;
|
68 |
|
includes/fields/field-post-statuses.php
CHANGED
@@ -13,35 +13,25 @@ class acfe_field_post_statuses extends acf_field{
|
|
13 |
$this->label = __('Post statuses', 'acfe');
|
14 |
$this->category = 'relational';
|
15 |
$this->defaults = array(
|
16 |
-
'post_status'
|
17 |
-
'field_type'
|
18 |
-
'multiple'
|
19 |
-
'allow_null'
|
20 |
-
'choices'
|
21 |
-
'default_value'
|
22 |
-
'ui'
|
23 |
-
'ajax'
|
24 |
-
'placeholder'
|
25 |
-
'
|
26 |
-
|
27 |
-
'
|
28 |
-
'
|
|
|
29 |
);
|
30 |
|
31 |
parent::__construct();
|
32 |
|
33 |
}
|
34 |
-
|
35 |
-
function prepare_field($field){
|
36 |
-
|
37 |
-
$field['choices'] = acfe_get_pretty_post_statuses($field['post_status']);
|
38 |
-
|
39 |
-
// Set Field Type
|
40 |
-
$field['type'] = $field['field_type'];
|
41 |
-
|
42 |
-
return $field;
|
43 |
-
|
44 |
-
}
|
45 |
|
46 |
function render_field_settings($field){
|
47 |
|
@@ -121,43 +111,6 @@ class acfe_field_post_statuses extends acf_field{
|
|
121 |
)
|
122 |
));
|
123 |
|
124 |
-
// placeholder
|
125 |
-
acf_render_field_setting($field, array(
|
126 |
-
'label' => __('Placeholder Text','acf'),
|
127 |
-
'instructions' => __('Appears within the input','acf'),
|
128 |
-
'type' => 'text',
|
129 |
-
'name' => 'placeholder',
|
130 |
-
'placeholder' => _x('Select', 'verb', 'acf'),
|
131 |
-
'conditional_logic' => array(
|
132 |
-
array(
|
133 |
-
array(
|
134 |
-
'field' => 'field_type',
|
135 |
-
'operator' => '==',
|
136 |
-
'value' => 'select',
|
137 |
-
),
|
138 |
-
array(
|
139 |
-
'field' => 'allow_null',
|
140 |
-
'operator' => '==',
|
141 |
-
'value' => '1',
|
142 |
-
),
|
143 |
-
|
144 |
-
),
|
145 |
-
array(
|
146 |
-
array(
|
147 |
-
'field' => 'field_type',
|
148 |
-
'operator' => '==',
|
149 |
-
'value' => 'select',
|
150 |
-
),
|
151 |
-
array(
|
152 |
-
'field' => 'ui',
|
153 |
-
'operator' => '==',
|
154 |
-
'value' => '1',
|
155 |
-
),
|
156 |
-
|
157 |
-
),
|
158 |
-
)
|
159 |
-
));
|
160 |
-
|
161 |
// Select: multiple
|
162 |
acf_render_field_setting( $field, array(
|
163 |
'label' => __('Select multiple values?','acf'),
|
@@ -217,35 +170,78 @@ class acfe_field_post_statuses extends acf_field{
|
|
217 |
),
|
218 |
)
|
219 |
));
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
'conditions' => array(
|
230 |
array(
|
231 |
array(
|
232 |
'field' => 'field_type',
|
233 |
'operator' => '==',
|
234 |
-
'value' => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
),
|
236 |
),
|
237 |
)
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
|
241 |
-
// Radio:
|
242 |
acf_render_field_setting( $field, array(
|
243 |
-
'label' => __('
|
244 |
'instructions' => '',
|
245 |
-
'name' => '
|
246 |
'type' => 'true_false',
|
247 |
'ui' => 1,
|
248 |
-
'message' => __("
|
249 |
'conditions' => array(
|
250 |
array(
|
251 |
array(
|
@@ -253,11 +249,6 @@ class acfe_field_post_statuses extends acf_field{
|
|
253 |
'operator' => '==',
|
254 |
'value' => 'radio',
|
255 |
),
|
256 |
-
array(
|
257 |
-
'field' => 'other_choice',
|
258 |
-
'operator' => '==',
|
259 |
-
'value' => 1,
|
260 |
-
),
|
261 |
),
|
262 |
)
|
263 |
));
|
@@ -325,36 +316,54 @@ class acfe_field_post_statuses extends acf_field{
|
|
325 |
'value' => 'checkbox',
|
326 |
),
|
327 |
),
|
328 |
-
)
|
329 |
-
));
|
330 |
-
|
331 |
-
|
332 |
-
// Checkbox: save_other_choice
|
333 |
-
acf_render_field_setting( $field, array(
|
334 |
-
'label' => __('Save Custom','acf'),
|
335 |
-
'instructions' => '',
|
336 |
-
'name' => 'save_custom',
|
337 |
-
'type' => 'true_false',
|
338 |
-
'ui' => 1,
|
339 |
-
'message' => __("Save 'custom' values to the field's choices", 'acf'),
|
340 |
-
'conditions' => array(
|
341 |
array(
|
342 |
array(
|
343 |
'field' => 'field_type',
|
344 |
'operator' => '==',
|
345 |
-
'value' => '
|
346 |
),
|
347 |
array(
|
348 |
-
'field' => '
|
349 |
'operator' => '==',
|
350 |
-
'value' => 1,
|
351 |
),
|
352 |
-
)
|
353 |
)
|
354 |
));
|
355 |
|
356 |
}
|
357 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
|
359 |
function format_value($value, $post_id, $field){
|
360 |
|
@@ -366,14 +375,23 @@ class acfe_field_post_statuses extends acf_field{
|
|
366 |
|
367 |
foreach($value as $i => $v){
|
368 |
|
369 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
}
|
372 |
|
373 |
// string
|
374 |
}else{
|
375 |
|
376 |
-
$
|
|
|
377 |
|
378 |
}
|
379 |
|
13 |
$this->label = __('Post statuses', 'acfe');
|
14 |
$this->category = 'relational';
|
15 |
$this->defaults = array(
|
16 |
+
'post_status' => array(),
|
17 |
+
'field_type' => 'checkbox',
|
18 |
+
'multiple' => 0,
|
19 |
+
'allow_null' => 0,
|
20 |
+
'choices' => array(),
|
21 |
+
'default_value' => '',
|
22 |
+
'ui' => 0,
|
23 |
+
'ajax' => 0,
|
24 |
+
'placeholder' => '',
|
25 |
+
'search_placeholder' => '',
|
26 |
+
'layout' => '',
|
27 |
+
'toggle' => 0,
|
28 |
+
'allow_custom' => 0,
|
29 |
+
'return_format' => 'name',
|
30 |
);
|
31 |
|
32 |
parent::__construct();
|
33 |
|
34 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
function render_field_settings($field){
|
37 |
|
111 |
)
|
112 |
));
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
// Select: multiple
|
115 |
acf_render_field_setting( $field, array(
|
116 |
'label' => __('Select multiple values?','acf'),
|
170 |
),
|
171 |
)
|
172 |
));
|
173 |
+
|
174 |
+
// placeholder
|
175 |
+
acf_render_field_setting($field, array(
|
176 |
+
'label' => __('Placeholder','acf'),
|
177 |
+
'instructions' => __('Appears within the input','acf'),
|
178 |
+
'type' => 'text',
|
179 |
+
'name' => 'placeholder',
|
180 |
+
'placeholder' => _x('Select', 'verb', 'acf'),
|
181 |
+
'conditional_logic' => array(
|
|
|
182 |
array(
|
183 |
array(
|
184 |
'field' => 'field_type',
|
185 |
'operator' => '==',
|
186 |
+
'value' => 'select',
|
187 |
+
),
|
188 |
+
array(
|
189 |
+
'field' => 'allow_null',
|
190 |
+
'operator' => '==',
|
191 |
+
'value' => '1',
|
192 |
+
),
|
193 |
+
),
|
194 |
+
array(
|
195 |
+
array(
|
196 |
+
'field' => 'field_type',
|
197 |
+
'operator' => '==',
|
198 |
+
'value' => 'select',
|
199 |
+
),
|
200 |
+
array(
|
201 |
+
'field' => 'ui',
|
202 |
+
'operator' => '==',
|
203 |
+
'value' => '1',
|
204 |
+
),
|
205 |
+
array(
|
206 |
+
'field' => 'allow_null',
|
207 |
+
'operator' => '==',
|
208 |
+
'value' => '1',
|
209 |
),
|
210 |
),
|
211 |
)
|
212 |
+
));
|
213 |
+
|
214 |
+
// search placeholder
|
215 |
+
acf_render_field_setting($field, array(
|
216 |
+
'label' => __('Search Input Placeholder','acf'),
|
217 |
+
'instructions' => __('Appears within the search input','acf'),
|
218 |
+
'type' => 'text',
|
219 |
+
'name' => 'search_placeholder',
|
220 |
+
'placeholder' => _x('Select', 'verb', 'acf'),
|
221 |
+
'conditional_logic' => array(
|
222 |
+
array(
|
223 |
+
array(
|
224 |
+
'field' => 'field_type',
|
225 |
+
'operator' => '==',
|
226 |
+
'value' => 'select',
|
227 |
+
),
|
228 |
+
array(
|
229 |
+
'field' => 'ui',
|
230 |
+
'operator' => '==',
|
231 |
+
'value' => '1',
|
232 |
+
),
|
233 |
+
),
|
234 |
+
)
|
235 |
+
));
|
236 |
|
237 |
+
// Radio: other_choice
|
238 |
acf_render_field_setting( $field, array(
|
239 |
+
'label' => __('Other','acf'),
|
240 |
'instructions' => '',
|
241 |
+
'name' => 'other_choice',
|
242 |
'type' => 'true_false',
|
243 |
'ui' => 1,
|
244 |
+
'message' => __("Add 'other' choice to allow for custom values", 'acf'),
|
245 |
'conditions' => array(
|
246 |
array(
|
247 |
array(
|
249 |
'operator' => '==',
|
250 |
'value' => 'radio',
|
251 |
),
|
|
|
|
|
|
|
|
|
|
|
252 |
),
|
253 |
)
|
254 |
));
|
316 |
'value' => 'checkbox',
|
317 |
),
|
318 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
array(
|
320 |
array(
|
321 |
'field' => 'field_type',
|
322 |
'operator' => '==',
|
323 |
+
'value' => 'select',
|
324 |
),
|
325 |
array(
|
326 |
+
'field' => 'ui',
|
327 |
'operator' => '==',
|
328 |
+
'value' => '1',
|
329 |
),
|
330 |
+
)
|
331 |
)
|
332 |
));
|
333 |
|
334 |
}
|
335 |
|
336 |
+
function prepare_field($field){
|
337 |
+
|
338 |
+
// Set Field Type
|
339 |
+
$field['type'] = $field['field_type'];
|
340 |
+
|
341 |
+
// Choices
|
342 |
+
$field['choices'] = acfe_get_pretty_post_statuses($field['post_status']);
|
343 |
+
|
344 |
+
// Allow Custom
|
345 |
+
if(acf_maybe_get($field, 'allow_custom')){
|
346 |
+
|
347 |
+
if($value = acf_maybe_get($field, 'value')){
|
348 |
+
|
349 |
+
$value = acf_get_array($value);
|
350 |
+
|
351 |
+
foreach($value as $v){
|
352 |
+
|
353 |
+
if(isset($field['choices'][$v]))
|
354 |
+
continue;
|
355 |
+
|
356 |
+
$field['choices'][$v] = $v;
|
357 |
+
|
358 |
+
}
|
359 |
+
|
360 |
+
}
|
361 |
+
|
362 |
+
}
|
363 |
+
|
364 |
+
return $field;
|
365 |
+
|
366 |
+
}
|
367 |
|
368 |
function format_value($value, $post_id, $field){
|
369 |
|
375 |
|
376 |
foreach($value as $i => $v){
|
377 |
|
378 |
+
if($get_post_status_object = get_post_status_object($v)){
|
379 |
+
|
380 |
+
$value[$i] = $get_post_status_object;
|
381 |
+
|
382 |
+
}else{
|
383 |
+
|
384 |
+
$value[$i] = $i;
|
385 |
+
|
386 |
+
}
|
387 |
|
388 |
}
|
389 |
|
390 |
// string
|
391 |
}else{
|
392 |
|
393 |
+
if($get_post_status_object = get_post_status_object($value))
|
394 |
+
$value = $get_post_status_object;
|
395 |
|
396 |
}
|
397 |
|
includes/fields/field-post-types.php
CHANGED
@@ -13,35 +13,25 @@ class acfe_field_post_types extends acf_field{
|
|
13 |
$this->label = __('Post types', 'acfe');
|
14 |
$this->category = 'relational';
|
15 |
$this->defaults = array(
|
16 |
-
'post_type'
|
17 |
-
'field_type'
|
18 |
-
'multiple'
|
19 |
-
'allow_null'
|
20 |
-
'choices'
|
21 |
-
'default_value'
|
22 |
-
'ui'
|
23 |
-
'ajax'
|
24 |
-
'placeholder'
|
25 |
-
|
26 |
-
|
27 |
-
'
|
28 |
-
'
|
|
|
29 |
);
|
30 |
|
31 |
parent::__construct();
|
32 |
|
33 |
}
|
34 |
-
|
35 |
-
function prepare_field($field){
|
36 |
-
|
37 |
-
$field['choices'] = acf_get_pretty_post_types($field['post_type']);
|
38 |
-
|
39 |
-
// Set Field Type
|
40 |
-
$field['type'] = $field['field_type'];
|
41 |
-
|
42 |
-
return $field;
|
43 |
-
|
44 |
-
}
|
45 |
|
46 |
function render_field_settings($field){
|
47 |
|
@@ -121,43 +111,6 @@ class acfe_field_post_types extends acf_field{
|
|
121 |
)
|
122 |
));
|
123 |
|
124 |
-
// placeholder
|
125 |
-
acf_render_field_setting($field, array(
|
126 |
-
'label' => __('Placeholder Text','acf'),
|
127 |
-
'instructions' => __('Appears within the input','acf'),
|
128 |
-
'type' => 'text',
|
129 |
-
'name' => 'placeholder',
|
130 |
-
'placeholder' => _x('Select', 'verb', 'acf'),
|
131 |
-
'conditional_logic' => array(
|
132 |
-
array(
|
133 |
-
array(
|
134 |
-
'field' => 'field_type',
|
135 |
-
'operator' => '==',
|
136 |
-
'value' => 'select',
|
137 |
-
),
|
138 |
-
array(
|
139 |
-
'field' => 'allow_null',
|
140 |
-
'operator' => '==',
|
141 |
-
'value' => '1',
|
142 |
-
),
|
143 |
-
|
144 |
-
),
|
145 |
-
array(
|
146 |
-
array(
|
147 |
-
'field' => 'field_type',
|
148 |
-
'operator' => '==',
|
149 |
-
'value' => 'select',
|
150 |
-
),
|
151 |
-
array(
|
152 |
-
'field' => 'ui',
|
153 |
-
'operator' => '==',
|
154 |
-
'value' => '1',
|
155 |
-
),
|
156 |
-
|
157 |
-
),
|
158 |
-
)
|
159 |
-
));
|
160 |
-
|
161 |
// Select: multiple
|
162 |
acf_render_field_setting( $field, array(
|
163 |
'label' => __('Select multiple values?','acf'),
|
@@ -217,35 +170,78 @@ class acfe_field_post_types extends acf_field{
|
|
217 |
),
|
218 |
)
|
219 |
));
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
'conditions' => array(
|
230 |
array(
|
231 |
array(
|
232 |
'field' => 'field_type',
|
233 |
'operator' => '==',
|
234 |
-
'value' => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
),
|
236 |
),
|
237 |
)
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
|
241 |
-
// Radio:
|
242 |
acf_render_field_setting( $field, array(
|
243 |
-
'label' => __('
|
244 |
'instructions' => '',
|
245 |
-
'name' => '
|
246 |
'type' => 'true_false',
|
247 |
'ui' => 1,
|
248 |
-
'message' => __("
|
249 |
'conditions' => array(
|
250 |
array(
|
251 |
array(
|
@@ -253,11 +249,6 @@ class acfe_field_post_types extends acf_field{
|
|
253 |
'operator' => '==',
|
254 |
'value' => 'radio',
|
255 |
),
|
256 |
-
array(
|
257 |
-
'field' => 'other_choice',
|
258 |
-
'operator' => '==',
|
259 |
-
'value' => 1,
|
260 |
-
),
|
261 |
),
|
262 |
)
|
263 |
));
|
@@ -325,36 +316,55 @@ class acfe_field_post_types extends acf_field{
|
|
325 |
'value' => 'checkbox',
|
326 |
),
|
327 |
),
|
328 |
-
)
|
329 |
-
));
|
330 |
-
|
331 |
-
|
332 |
-
// Checkbox: save_other_choice
|
333 |
-
acf_render_field_setting( $field, array(
|
334 |
-
'label' => __('Save Custom','acf'),
|
335 |
-
'instructions' => '',
|
336 |
-
'name' => 'save_custom',
|
337 |
-
'type' => 'true_false',
|
338 |
-
'ui' => 1,
|
339 |
-
'message' => __("Save 'custom' values to the field's choices", 'acf'),
|
340 |
-
'conditions' => array(
|
341 |
array(
|
342 |
array(
|
343 |
'field' => 'field_type',
|
344 |
'operator' => '==',
|
345 |
-
'value' => '
|
346 |
),
|
347 |
array(
|
348 |
-
'field' => '
|
349 |
'operator' => '==',
|
350 |
-
'value' => 1,
|
351 |
),
|
352 |
-
)
|
353 |
)
|
354 |
));
|
355 |
|
356 |
}
|
357 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
|
359 |
function format_value($value, $post_id, $field){
|
360 |
|
@@ -366,14 +376,23 @@ class acfe_field_post_types extends acf_field{
|
|
366 |
|
367 |
foreach($value as $i => $v){
|
368 |
|
369 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
}
|
372 |
|
373 |
// string
|
374 |
}else{
|
375 |
|
376 |
-
$
|
|
|
377 |
|
378 |
}
|
379 |
|
13 |
$this->label = __('Post types', 'acfe');
|
14 |
$this->category = 'relational';
|
15 |
$this->defaults = array(
|
16 |
+
'post_type' => array(),
|
17 |
+
'field_type' => 'checkbox',
|
18 |
+
'multiple' => 0,
|
19 |
+
'allow_null' => 0,
|
20 |
+
'choices' => array(),
|
21 |
+
'default_value' => '',
|
22 |
+
'ui' => 0,
|
23 |
+
'ajax' => 0,
|
24 |
+
'placeholder' => '',
|
25 |
+
'search_placeholder' => '',
|
26 |
+
'layout' => '',
|
27 |
+
'toggle' => 0,
|
28 |
+
'allow_custom' => 0,
|
29 |
+
'return_format' => 'name',
|
30 |
);
|
31 |
|
32 |
parent::__construct();
|
33 |
|
34 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
function render_field_settings($field){
|
37 |
|
111 |
)
|
112 |
));
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
// Select: multiple
|
115 |
acf_render_field_setting( $field, array(
|
116 |
'label' => __('Select multiple values?','acf'),
|
170 |
),
|
171 |
)
|
172 |
));
|
173 |
+
|
174 |
+
// placeholder
|
175 |
+
acf_render_field_setting($field, array(
|
176 |
+
'label' => __('Placeholder','acf'),
|
177 |
+
'instructions' => __('Appears within the input','acf'),
|
178 |
+
'type' => 'text',
|
179 |
+
'name' => 'placeholder',
|
180 |
+
'placeholder' => _x('Select', 'verb', 'acf'),
|
181 |
+
'conditional_logic' => array(
|
|
|
182 |
array(
|
183 |
array(
|
184 |
'field' => 'field_type',
|
185 |
'operator' => '==',
|
186 |
+
'value' => 'select',
|
187 |
+
),
|
188 |
+
array(
|
189 |
+
'field' => 'allow_null',
|
190 |
+
'operator' => '==',
|
191 |
+
'value' => '1',
|
192 |
+
),
|
193 |
+
),
|
194 |
+
array(
|
195 |
+
array(
|
196 |
+
'field' => 'field_type',
|
197 |
+
'operator' => '==',
|
198 |
+
'value' => 'select',
|
199 |
+
),
|
200 |
+
array(
|
201 |
+
'field' => 'ui',
|
202 |
+
'operator' => '==',
|
203 |
+
'value' => '1',
|
204 |
+
),
|
205 |
+
array(
|
206 |
+
'field' => 'allow_null',
|
207 |
+
'operator' => '==',
|
208 |
+
'value' => '1',
|
209 |
),
|
210 |
),
|
211 |
)
|
212 |
+
));
|
213 |
+
|
214 |
+
// search placeholder
|
215 |
+
acf_render_field_setting($field, array(
|
216 |
+
'label' => __('Search Input Placeholder','acf'),
|
217 |
+
'instructions' => __('Appears within the search input','acf'),
|
218 |
+
'type' => 'text',
|
219 |
+
'name' => 'search_placeholder',
|
220 |
+
'placeholder' => _x('Select', 'verb', 'acf'),
|
221 |
+
'conditional_logic' => array(
|
222 |
+
array(
|
223 |
+
array(
|
224 |
+
'field' => 'field_type',
|
225 |
+
'operator' => '==',
|
226 |
+
'value' => 'select',
|
227 |
+
),
|
228 |
+
array(
|
229 |
+
'field' => 'ui',
|
230 |
+
'operator' => '==',
|
231 |
+
'value' => '1',
|
232 |
+
),
|
233 |
+
),
|
234 |
+
)
|
235 |
+
));
|
236 |
|
237 |
+
// Radio: other_choice
|
238 |
acf_render_field_setting( $field, array(
|
239 |
+
'label' => __('Other','acf'),
|
240 |
'instructions' => '',
|
241 |
+
'name' => 'other_choice',
|
242 |
'type' => 'true_false',
|
243 |
'ui' => 1,
|
244 |
+
'message' => __("Add 'other' choice to allow for custom values", 'acf'),
|
245 |
'conditions' => array(
|
246 |
array(
|
247 |
array(
|
249 |
'operator' => '==',
|
250 |
'value' => 'radio',
|
251 |
),
|
|
|
|
|
|
|
|
|
|
|
252 |
),
|
253 |
)
|
254 |
));
|
316 |
'value' => 'checkbox',
|
317 |
),
|
318 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
array(
|
320 |
array(
|
321 |
'field' => 'field_type',
|
322 |
'operator' => '==',
|
323 |
+
'value' => 'select',
|
324 |
),
|
325 |
array(
|
326 |
+
'field' => 'ui',
|
327 |
'operator' => '==',
|
328 |
+
'value' => '1',
|
329 |
),
|
330 |
+
)
|
331 |
)
|
332 |
));
|
333 |
|
334 |
}
|
335 |
|
336 |
+
function prepare_field($field){
|
337 |
+
|
338 |
+
// Set Field Type
|
339 |
+
$field['type'] = $field['field_type'];
|
340 |
+
|
341 |
+
// Choices
|
342 |
+
$field['choices'] = acf_get_pretty_post_types($field['post_type']);
|
343 |
+
|
344 |
+
// Allow Custom
|
345 |
+
if(acf_maybe_get($field, 'allow_custom')){
|
346 |
+
|
347 |
+
if($value = acf_maybe_get($field, 'value')){
|
348 |
+
|
349 |
+
$value = acf_get_array($value);
|
350 |
+
|
351 |
+
foreach($value as $v){
|
352 |
+
|
353 |
+
if(isset($field['choices'][$v]))
|
354 |
+
continue;
|
355 |
+
|
356 |
+
$field['choices'][$v] = $v;
|
357 |
+
|
358 |
+
}
|
359 |
+
|
360 |
+
}
|
361 |
+
|
362 |
+
}
|
363 |
+
|
364 |
+
// return
|
365 |
+
return $field;
|
366 |
+
|
367 |
+
}
|
368 |
|
369 |
function format_value($value, $post_id, $field){
|
370 |
|
376 |
|
377 |
foreach($value as $i => $v){
|
378 |
|
379 |
+
if($get_post_type_object = get_post_type_object($v)){
|
380 |
+
|
381 |
+
$value[$i] = $get_post_type_object;
|
382 |
+
|
383 |
+
}else{
|
384 |
+
|
385 |
+
$value[$i] = $i;
|
386 |
+
|
387 |
+
}
|
388 |
|
389 |
}
|
390 |
|
391 |
// string
|
392 |
}else{
|
393 |
|
394 |
+
if($get_post_type_object = get_post_type_object($value))
|
395 |
+
$value = $get_post_type_object;
|
396 |
|
397 |
}
|
398 |
|
includes/fields/field-select.php
CHANGED
@@ -3,32 +3,200 @@
|
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
-
|
7 |
-
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
'
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
'
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
array(
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
array(
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
+
if(!class_exists('acfe_field_select')):
|
7 |
+
|
8 |
+
class acfe_field_select{
|
9 |
|
10 |
+
function __construct(){
|
11 |
+
|
12 |
+
// Actions
|
13 |
+
add_action('acf/render_field_settings/type=select', array($this, 'field_settings'));
|
14 |
+
|
15 |
+
// Filters
|
16 |
+
add_filter('acf/prepare_field/type=select', array($this, 'prepare_field'));
|
17 |
+
add_filter('acfe/field_wrapper_attributes/type=select', array($this, 'field_wrapper'), 10, 2);
|
18 |
+
|
19 |
+
add_action('current_screen', array($this, 'current_screen'));
|
20 |
+
|
21 |
+
}
|
22 |
+
|
23 |
+
function current_screen(){
|
24 |
+
|
25 |
+
if(!acfe_is_admin_screen())
|
26 |
+
return;
|
27 |
+
|
28 |
+
add_filter('acf/prepare_field/name=choices', array($this, 'prepare_field_choices'), 5);
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
function prepare_field_choices($field){
|
33 |
+
|
34 |
+
$wrapper = $field['wrapper'];
|
35 |
+
|
36 |
+
if(acf_maybe_get($wrapper, 'data-setting') !== 'select')
|
37 |
+
return $field;
|
38 |
+
|
39 |
+
$field['instructions'] .= '<br/><br/>You may use "## Title" to create a group of options.';
|
40 |
+
|
41 |
+
return $field;
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
function field_settings($field){
|
46 |
+
|
47 |
+
// allow custom
|
48 |
+
acf_render_field_setting($field, array(
|
49 |
+
'label' => __('Allow Custom','acf'),
|
50 |
+
'instructions' => '',
|
51 |
+
'name' => 'allow_custom',
|
52 |
+
'type' => 'true_false',
|
53 |
+
'ui' => 1,
|
54 |
+
'message' => __("Allow 'custom' values to be added", 'acf'),
|
55 |
+
'conditional_logic' => array(
|
56 |
+
array(
|
57 |
+
array(
|
58 |
+
'field' => 'ui',
|
59 |
+
'operator' => '==',
|
60 |
+
'value' => '1',
|
61 |
+
),
|
62 |
+
),
|
63 |
+
)
|
64 |
+
));
|
65 |
+
|
66 |
+
// placeholder
|
67 |
+
acf_render_field_setting($field, array(
|
68 |
+
'label' => __('Placeholder','acf'),
|
69 |
+
'instructions' => __('Appears within the input','acf'),
|
70 |
+
'type' => 'text',
|
71 |
+
'name' => 'placeholder',
|
72 |
+
'placeholder' => _x('Select', 'verb', 'acf'),
|
73 |
+
'conditional_logic' => array(
|
74 |
+
array(
|
75 |
+
array(
|
76 |
+
'field' => 'ui',
|
77 |
+
'operator' => '==',
|
78 |
+
'value' => '1',
|
79 |
+
)
|
80 |
+
),
|
81 |
array(
|
82 |
+
array(
|
83 |
+
'field' => 'allow_null',
|
84 |
+
'operator' => '==',
|
85 |
+
'value' => '1',
|
86 |
+
)
|
87 |
+
),
|
88 |
+
)
|
89 |
+
));
|
90 |
+
|
91 |
+
// search placeholder
|
92 |
+
acf_render_field_setting($field, array(
|
93 |
+
'label' => __('Search Input Placeholder','acf'),
|
94 |
+
'instructions' => __('Appears within the search input','acf'),
|
95 |
+
'type' => 'text',
|
96 |
+
'name' => 'search_placeholder',
|
97 |
+
'placeholder' => '',
|
98 |
+
'conditional_logic' => array(
|
99 |
array(
|
100 |
+
array(
|
101 |
+
'field' => 'ui',
|
102 |
+
'operator' => '==',
|
103 |
+
'value' => '1',
|
104 |
+
),
|
105 |
+
),
|
106 |
+
)
|
107 |
+
));
|
108 |
+
|
109 |
+
}
|
110 |
|
111 |
+
function prepare_field($field){
|
112 |
+
|
113 |
+
// Allow Custom
|
114 |
+
if(acf_maybe_get($field, 'allow_custom')){
|
115 |
+
|
116 |
+
if($value = acf_maybe_get($field, 'value')){
|
117 |
+
|
118 |
+
$value = acf_get_array($value);
|
119 |
+
|
120 |
+
foreach($value as $v){
|
121 |
+
|
122 |
+
if(isset($field['choices'][$v]))
|
123 |
+
continue;
|
124 |
+
|
125 |
+
$field['choices'][$v] = $v;
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
}
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
if(!acf_maybe_get($field, 'ajax')){
|
134 |
+
|
135 |
+
if(is_array($field['choices'])){
|
136 |
+
|
137 |
+
$found = false;
|
138 |
+
$found_array = array();
|
139 |
+
|
140 |
+
foreach($field['choices'] as $k => $choice){
|
141 |
+
|
142 |
+
if(is_string($choice)){
|
143 |
+
|
144 |
+
$choice = trim($choice);
|
145 |
+
|
146 |
+
if(strpos($choice, '##') === 0){
|
147 |
+
|
148 |
+
$choice = substr($choice, 2);
|
149 |
+
$choice = trim($choice);
|
150 |
+
|
151 |
+
$found = $choice;
|
152 |
+
$found_array[$choice] = array();
|
153 |
+
|
154 |
+
}elseif(!empty($found)){
|
155 |
+
|
156 |
+
$found_array[$found][$k] = $choice;
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
}
|
163 |
+
|
164 |
+
if(!empty($found_array)){
|
165 |
+
|
166 |
+
$field['choices'] = $found_array;
|
167 |
+
|
168 |
+
}
|
169 |
+
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
return $field;
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
function field_wrapper($wrapper, $field){
|
179 |
+
|
180 |
+
// Search placeholder
|
181 |
+
if($search_placeholder = acf_maybe_get($field, 'search_placeholder')){
|
182 |
+
|
183 |
+
$wrapper['data-acfe-search-placeholder'] = $search_placeholder;
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
// Allow Custom
|
188 |
+
if(acf_maybe_get($field, 'allow_custom')){
|
189 |
+
|
190 |
+
$wrapper['data-acfe-allow-custom'] = 1;
|
191 |
+
|
192 |
+
}
|
193 |
+
|
194 |
+
return $wrapper;
|
195 |
+
|
196 |
+
}
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
+
new acfe_field_select();
|
201 |
+
|
202 |
+
endif;
|
includes/fields/field-taxonomies.php
CHANGED
@@ -13,35 +13,25 @@ class acfe_field_taxonomies extends acf_field{
|
|
13 |
$this->label = __('Taxonomies', 'acfe');
|
14 |
$this->category = 'relational';
|
15 |
$this->defaults = array(
|
16 |
-
'taxonomy'
|
17 |
-
'field_type'
|
18 |
-
'multiple'
|
19 |
-
'allow_null'
|
20 |
-
'choices'
|
21 |
-
'default_value'
|
22 |
-
'ui'
|
23 |
-
'ajax'
|
24 |
-
'placeholder'
|
25 |
-
|
26 |
-
|
27 |
-
'
|
28 |
-
'
|
|
|
29 |
);
|
30 |
|
31 |
parent::__construct();
|
32 |
|
33 |
}
|
34 |
-
|
35 |
-
function prepare_field($field){
|
36 |
-
|
37 |
-
$field['choices'] = acf_get_taxonomy_labels($field['taxonomy']);
|
38 |
-
|
39 |
-
// Set Field Type
|
40 |
-
$field['type'] = $field['field_type'];
|
41 |
-
|
42 |
-
return $field;
|
43 |
-
|
44 |
-
}
|
45 |
|
46 |
function render_field_settings($field){
|
47 |
|
@@ -121,43 +111,6 @@ class acfe_field_taxonomies extends acf_field{
|
|
121 |
)
|
122 |
));
|
123 |
|
124 |
-
// placeholder
|
125 |
-
acf_render_field_setting($field, array(
|
126 |
-
'label' => __('Placeholder Text','acf'),
|
127 |
-
'instructions' => __('Appears within the input','acf'),
|
128 |
-
'type' => 'text',
|
129 |
-
'name' => 'placeholder',
|
130 |
-
'placeholder' => _x('Select', 'verb', 'acf'),
|
131 |
-
'conditional_logic' => array(
|
132 |
-
array(
|
133 |
-
array(
|
134 |
-
'field' => 'field_type',
|
135 |
-
'operator' => '==',
|
136 |
-
'value' => 'select',
|
137 |
-
),
|
138 |
-
array(
|
139 |
-
'field' => 'allow_null',
|
140 |
-
'operator' => '==',
|
141 |
-
'value' => '1',
|
142 |
-
),
|
143 |
-
|
144 |
-
),
|
145 |
-
array(
|
146 |
-
array(
|
147 |
-
'field' => 'field_type',
|
148 |
-
'operator' => '==',
|
149 |
-
'value' => 'select',
|
150 |
-
),
|
151 |
-
array(
|
152 |
-
'field' => 'ui',
|
153 |
-
'operator' => '==',
|
154 |
-
'value' => '1',
|
155 |
-
),
|
156 |
-
|
157 |
-
),
|
158 |
-
)
|
159 |
-
));
|
160 |
-
|
161 |
// Select: multiple
|
162 |
acf_render_field_setting( $field, array(
|
163 |
'label' => __('Select multiple values?','acf'),
|
@@ -217,35 +170,78 @@ class acfe_field_taxonomies extends acf_field{
|
|
217 |
),
|
218 |
)
|
219 |
));
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
'conditions' => array(
|
230 |
array(
|
231 |
array(
|
232 |
'field' => 'field_type',
|
233 |
'operator' => '==',
|
234 |
-
'value' => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
),
|
236 |
),
|
237 |
)
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
|
241 |
-
// Radio:
|
242 |
acf_render_field_setting( $field, array(
|
243 |
-
'label' => __('
|
244 |
'instructions' => '',
|
245 |
-
'name' => '
|
246 |
'type' => 'true_false',
|
247 |
'ui' => 1,
|
248 |
-
'message' => __("
|
249 |
'conditions' => array(
|
250 |
array(
|
251 |
array(
|
@@ -253,11 +249,6 @@ class acfe_field_taxonomies extends acf_field{
|
|
253 |
'operator' => '==',
|
254 |
'value' => 'radio',
|
255 |
),
|
256 |
-
array(
|
257 |
-
'field' => 'other_choice',
|
258 |
-
'operator' => '==',
|
259 |
-
'value' => 1,
|
260 |
-
),
|
261 |
),
|
262 |
)
|
263 |
));
|
@@ -325,36 +316,54 @@ class acfe_field_taxonomies extends acf_field{
|
|
325 |
'value' => 'checkbox',
|
326 |
),
|
327 |
),
|
328 |
-
)
|
329 |
-
));
|
330 |
-
|
331 |
-
|
332 |
-
// Checkbox: save_other_choice
|
333 |
-
acf_render_field_setting( $field, array(
|
334 |
-
'label' => __('Save Custom','acf'),
|
335 |
-
'instructions' => '',
|
336 |
-
'name' => 'save_custom',
|
337 |
-
'type' => 'true_false',
|
338 |
-
'ui' => 1,
|
339 |
-
'message' => __("Save 'custom' values to the field's choices", 'acf'),
|
340 |
-
'conditions' => array(
|
341 |
array(
|
342 |
array(
|
343 |
'field' => 'field_type',
|
344 |
'operator' => '==',
|
345 |
-
'value' => '
|
346 |
),
|
347 |
array(
|
348 |
-
'field' => '
|
349 |
'operator' => '==',
|
350 |
-
'value' => 1,
|
351 |
),
|
352 |
-
)
|
353 |
)
|
354 |
));
|
355 |
|
356 |
}
|
357 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
|
359 |
function format_value($value, $post_id, $field){
|
360 |
|
@@ -366,14 +375,23 @@ class acfe_field_taxonomies extends acf_field{
|
|
366 |
|
367 |
foreach($value as $i => $v){
|
368 |
|
369 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
}
|
372 |
|
373 |
// string
|
374 |
}else{
|
375 |
|
376 |
-
$
|
|
|
377 |
|
378 |
}
|
379 |
|
13 |
$this->label = __('Taxonomies', 'acfe');
|
14 |
$this->category = 'relational';
|
15 |
$this->defaults = array(
|
16 |
+
'taxonomy' => array(),
|
17 |
+
'field_type' => 'checkbox',
|
18 |
+
'multiple' => 0,
|
19 |
+
'allow_null' => 0,
|
20 |
+
'choices' => array(),
|
21 |
+
'default_value' => '',
|
22 |
+
'ui' => 0,
|
23 |
+
'ajax' => 0,
|
24 |
+
'placeholder' => '',
|
25 |
+
'search_placeholder' => '',
|
26 |
+
'layout' => '',
|
27 |
+
'toggle' => 0,
|
28 |
+
'allow_custom' => 0,
|
29 |
+
'return_format' => 'name',
|
30 |
);
|
31 |
|
32 |
parent::__construct();
|
33 |
|
34 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
function render_field_settings($field){
|
37 |
|
111 |
)
|
112 |
));
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
// Select: multiple
|
115 |
acf_render_field_setting( $field, array(
|
116 |
'label' => __('Select multiple values?','acf'),
|
170 |
),
|
171 |
)
|
172 |
));
|
173 |
+
|
174 |
+
// placeholder
|
175 |
+
acf_render_field_setting($field, array(
|
176 |
+
'label' => __('Placeholder','acf'),
|
177 |
+
'instructions' => __('Appears within the input','acf'),
|
178 |
+
'type' => 'text',
|
179 |
+
'name' => 'placeholder',
|
180 |
+
'placeholder' => _x('Select', 'verb', 'acf'),
|
181 |
+
'conditional_logic' => array(
|
|
|
182 |
array(
|
183 |
array(
|
184 |
'field' => 'field_type',
|
185 |
'operator' => '==',
|
186 |
+
'value' => 'select',
|
187 |
+
),
|
188 |
+
array(
|
189 |
+
'field' => 'allow_null',
|
190 |
+
'operator' => '==',
|
191 |
+
'value' => '1',
|
192 |
+
),
|
193 |
+
),
|
194 |
+
array(
|
195 |
+
array(
|
196 |
+
'field' => 'field_type',
|
197 |
+
'operator' => '==',
|
198 |
+
'value' => 'select',
|
199 |
+
),
|
200 |
+
array(
|
201 |
+
'field' => 'ui',
|
202 |
+
'operator' => '==',
|
203 |
+
'value' => '1',
|
204 |
+
),
|
205 |
+
array(
|
206 |
+
'field' => 'allow_null',
|
207 |
+
'operator' => '==',
|
208 |
+
'value' => '1',
|
209 |
),
|
210 |
),
|
211 |
)
|
212 |
+
));
|
213 |
+
|
214 |
+
// search placeholder
|
215 |
+
acf_render_field_setting($field, array(
|
216 |
+
'label' => __('Search Input Placeholder','acf'),
|
217 |
+
'instructions' => __('Appears within the search input','acf'),
|
218 |
+
'type' => 'text',
|
219 |
+
'name' => 'search_placeholder',
|
220 |
+
'placeholder' => _x('Select', 'verb', 'acf'),
|
221 |
+
'conditional_logic' => array(
|
222 |
+
array(
|
223 |
+
array(
|
224 |
+
'field' => 'field_type',
|
225 |
+
'operator' => '==',
|
226 |
+
'value' => 'select',
|
227 |
+
),
|
228 |
+
array(
|
229 |
+
'field' => 'ui',
|
230 |
+
'operator' => '==',
|
231 |
+
'value' => '1',
|
232 |
+
),
|
233 |
+
),
|
234 |
+
)
|
235 |
+
));
|
236 |
|
237 |
+
// Radio: other_choice
|
238 |
acf_render_field_setting( $field, array(
|
239 |
+
'label' => __('Other','acf'),
|
240 |
'instructions' => '',
|
241 |
+
'name' => 'other_choice',
|
242 |
'type' => 'true_false',
|
243 |
'ui' => 1,
|
244 |
+
'message' => __("Add 'other' choice to allow for custom values", 'acf'),
|
245 |
'conditions' => array(
|
246 |
array(
|
247 |
array(
|
249 |
'operator' => '==',
|
250 |
'value' => 'radio',
|
251 |
),
|
|
|
|
|
|
|
|
|
|
|
252 |
),
|
253 |
)
|
254 |
));
|
316 |
'value' => 'checkbox',
|
317 |
),
|
318 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
array(
|
320 |
array(
|
321 |
'field' => 'field_type',
|
322 |
'operator' => '==',
|
323 |
+
'value' => 'select',
|
324 |
),
|
325 |
array(
|
326 |
+
'field' => 'ui',
|
327 |
'operator' => '==',
|
328 |
+
'value' => '1',
|
329 |
),
|
330 |
+
)
|
331 |
)
|
332 |
));
|
333 |
|
334 |
}
|
335 |
|
336 |
+
function prepare_field($field){
|
337 |
+
|
338 |
+
// Set Field Type
|
339 |
+
$field['type'] = $field['field_type'];
|
340 |
+
|
341 |
+
// Choices
|
342 |
+
$field['choices'] = acf_get_taxonomy_labels($field['taxonomy']);
|
343 |
+
|
344 |
+
// Allow Custom
|
345 |
+
if(acf_maybe_get($field, 'allow_custom')){
|
346 |
+
|
347 |
+
if($value = acf_maybe_get($field, 'value')){
|
348 |
+
|
349 |
+
$value = acf_get_array($value);
|
350 |
+
|
351 |
+
foreach($value as $v){
|
352 |
+
|
353 |
+
if(isset($field['choices'][$v]))
|
354 |
+
continue;
|
355 |
+
|
356 |
+
$field['choices'][$v] = $v;
|
357 |
+
|
358 |
+
}
|
359 |
+
|
360 |
+
}
|
361 |
+
|
362 |
+
}
|
363 |
+
|
364 |
+
return $field;
|
365 |
+
|
366 |
+
}
|
367 |
|
368 |
function format_value($value, $post_id, $field){
|
369 |
|
375 |
|
376 |
foreach($value as $i => $v){
|
377 |
|
378 |
+
if($get_taxonomy = get_taxonomy($v)){
|
379 |
+
|
380 |
+
$value[$i] = $get_taxonomy;
|
381 |
+
|
382 |
+
}else{
|
383 |
+
|
384 |
+
$value[$i] = $i;
|
385 |
+
|
386 |
+
}
|
387 |
|
388 |
}
|
389 |
|
390 |
// string
|
391 |
}else{
|
392 |
|
393 |
+
if($get_taxonomy = get_taxonomy($value))
|
394 |
+
$value = $get_taxonomy;
|
395 |
|
396 |
}
|
397 |
|
includes/fields/field-taxonomy-terms.php
CHANGED
@@ -42,7 +42,7 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
42 |
add_action('wp_ajax_nopriv_acf/fields/acfe_taxonomy_terms/query', array($this, 'ajax_query'));
|
43 |
|
44 |
// actions
|
45 |
-
add_action('acf/save_post',
|
46 |
|
47 |
parent::__construct();
|
48 |
|
@@ -352,6 +352,37 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
352 |
|
353 |
// Available choices
|
354 |
$field['choices'] = $this->get_available_terms($field);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
|
356 |
// Set Field Type
|
357 |
$field['type'] = $field['field_type'];
|
42 |
add_action('wp_ajax_nopriv_acf/fields/acfe_taxonomy_terms/query', array($this, 'ajax_query'));
|
43 |
|
44 |
// actions
|
45 |
+
add_action('acf/save_post', array($this, 'save_post'), 15, 1);
|
46 |
|
47 |
parent::__construct();
|
48 |
|
352 |
|
353 |
// Available choices
|
354 |
$field['choices'] = $this->get_available_terms($field);
|
355 |
+
|
356 |
+
// Allow Custom
|
357 |
+
if(acf_maybe_get($field, 'allow_custom')){
|
358 |
+
|
359 |
+
if($value = acf_maybe_get($field, 'value')){
|
360 |
+
|
361 |
+
$value = acf_get_array($value);
|
362 |
+
|
363 |
+
foreach($value as $v){
|
364 |
+
|
365 |
+
$found = false;
|
366 |
+
|
367 |
+
foreach($field['choices'] as $taxonomy => $term){
|
368 |
+
|
369 |
+
if(isset($term[$v])){
|
370 |
+
|
371 |
+
$found = true;
|
372 |
+
break;
|
373 |
+
|
374 |
+
}
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
if(!$found)
|
379 |
+
$field['choices'][$v] = $v;
|
380 |
+
|
381 |
+
}
|
382 |
+
|
383 |
+
}
|
384 |
+
|
385 |
+
}
|
386 |
|
387 |
// Set Field Type
|
388 |
$field['type'] = $field['field_type'];
|
includes/fields/field-user-roles.php
CHANGED
@@ -13,34 +13,24 @@ class acfe_field_user_roles extends acf_field{
|
|
13 |
$this->label = __('User Roles', 'acfe');
|
14 |
$this->category = 'relational';
|
15 |
$this->defaults = array(
|
16 |
-
'user_role'
|
17 |
-
'field_type'
|
18 |
-
'multiple'
|
19 |
-
'allow_null'
|
20 |
-
'choices'
|
21 |
-
'default_value'
|
22 |
-
'ui'
|
23 |
-
'ajax'
|
24 |
-
'placeholder'
|
25 |
-
|
26 |
-
|
27 |
-
'
|
|
|
28 |
);
|
29 |
|
30 |
parent::__construct();
|
31 |
|
32 |
}
|
33 |
-
|
34 |
-
function prepare_field($field){
|
35 |
-
|
36 |
-
$field['choices'] = acfe_get_roles($field['user_role']);
|
37 |
-
|
38 |
-
// Set Field Type
|
39 |
-
$field['type'] = $field['field_type'];
|
40 |
-
|
41 |
-
return $field;
|
42 |
-
|
43 |
-
}
|
44 |
|
45 |
function render_field_settings($field){
|
46 |
|
@@ -107,43 +97,6 @@ class acfe_field_user_roles extends acf_field{
|
|
107 |
)
|
108 |
));
|
109 |
|
110 |
-
// placeholder
|
111 |
-
acf_render_field_setting($field, array(
|
112 |
-
'label' => __('Placeholder Text','acf'),
|
113 |
-
'instructions' => __('Appears within the input','acf'),
|
114 |
-
'type' => 'text',
|
115 |
-
'name' => 'placeholder',
|
116 |
-
'placeholder' => _x('Select', 'verb', 'acf'),
|
117 |
-
'conditional_logic' => array(
|
118 |
-
array(
|
119 |
-
array(
|
120 |
-
'field' => 'field_type',
|
121 |
-
'operator' => '==',
|
122 |
-
'value' => 'select',
|
123 |
-
),
|
124 |
-
array(
|
125 |
-
'field' => 'allow_null',
|
126 |
-
'operator' => '==',
|
127 |
-
'value' => '1',
|
128 |
-
),
|
129 |
-
|
130 |
-
),
|
131 |
-
array(
|
132 |
-
array(
|
133 |
-
'field' => 'field_type',
|
134 |
-
'operator' => '==',
|
135 |
-
'value' => 'select',
|
136 |
-
),
|
137 |
-
array(
|
138 |
-
'field' => 'ui',
|
139 |
-
'operator' => '==',
|
140 |
-
'value' => '1',
|
141 |
-
),
|
142 |
-
|
143 |
-
),
|
144 |
-
)
|
145 |
-
));
|
146 |
-
|
147 |
// Select: multiple
|
148 |
acf_render_field_setting( $field, array(
|
149 |
'label' => __('Select multiple values?','acf'),
|
@@ -203,35 +156,78 @@ class acfe_field_user_roles extends acf_field{
|
|
203 |
),
|
204 |
)
|
205 |
));
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
'conditions' => array(
|
216 |
array(
|
217 |
array(
|
218 |
'field' => 'field_type',
|
219 |
'operator' => '==',
|
220 |
-
'value' => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
),
|
222 |
),
|
223 |
)
|
224 |
-
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
-
// Radio:
|
228 |
acf_render_field_setting( $field, array(
|
229 |
-
'label' => __('
|
230 |
'instructions' => '',
|
231 |
-
'name' => '
|
232 |
'type' => 'true_false',
|
233 |
'ui' => 1,
|
234 |
-
'message' => __("
|
235 |
'conditions' => array(
|
236 |
array(
|
237 |
array(
|
@@ -239,11 +235,6 @@ class acfe_field_user_roles extends acf_field{
|
|
239 |
'operator' => '==',
|
240 |
'value' => 'radio',
|
241 |
),
|
242 |
-
array(
|
243 |
-
'field' => 'other_choice',
|
244 |
-
'operator' => '==',
|
245 |
-
'value' => 1,
|
246 |
-
),
|
247 |
),
|
248 |
)
|
249 |
));
|
@@ -311,35 +302,54 @@ class acfe_field_user_roles extends acf_field{
|
|
311 |
'value' => 'checkbox',
|
312 |
),
|
313 |
),
|
314 |
-
)
|
315 |
-
));
|
316 |
-
|
317 |
-
|
318 |
-
// Checkbox: save_other_choice
|
319 |
-
acf_render_field_setting( $field, array(
|
320 |
-
'label' => __('Save Custom','acf'),
|
321 |
-
'instructions' => '',
|
322 |
-
'name' => 'save_custom',
|
323 |
-
'type' => 'true_false',
|
324 |
-
'ui' => 1,
|
325 |
-
'message' => __("Save 'custom' values to the field's choices", 'acf'),
|
326 |
-
'conditions' => array(
|
327 |
array(
|
328 |
array(
|
329 |
'field' => 'field_type',
|
330 |
'operator' => '==',
|
331 |
-
'value' => '
|
332 |
),
|
333 |
array(
|
334 |
-
'field' => '
|
335 |
'operator' => '==',
|
336 |
-
'value' => 1,
|
337 |
),
|
338 |
-
)
|
339 |
)
|
340 |
));
|
341 |
|
342 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
|
344 |
}
|
345 |
|
13 |
$this->label = __('User Roles', 'acfe');
|
14 |
$this->category = 'relational';
|
15 |
$this->defaults = array(
|
16 |
+
'user_role' => array(),
|
17 |
+
'field_type' => 'checkbox',
|
18 |
+
'multiple' => 0,
|
19 |
+
'allow_null' => 0,
|
20 |
+
'choices' => array(),
|
21 |
+
'default_value' => '',
|
22 |
+
'ui' => 0,
|
23 |
+
'ajax' => 0,
|
24 |
+
'placeholder' => '',
|
25 |
+
'search_placeholder' => '',
|
26 |
+
'layout' => '',
|
27 |
+
'toggle' => 0,
|
28 |
+
'allow_custom' => 0,
|
29 |
);
|
30 |
|
31 |
parent::__construct();
|
32 |
|
33 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
function render_field_settings($field){
|
36 |
|
97 |
)
|
98 |
));
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
// Select: multiple
|
101 |
acf_render_field_setting( $field, array(
|
102 |
'label' => __('Select multiple values?','acf'),
|
156 |
),
|
157 |
)
|
158 |
));
|
159 |
+
|
160 |
+
// placeholder
|
161 |
+
acf_render_field_setting($field, array(
|
162 |
+
'label' => __('Placeholder','acf'),
|
163 |
+
'instructions' => __('Appears within the input','acf'),
|
164 |
+
'type' => 'text',
|
165 |
+
'name' => 'placeholder',
|
166 |
+
'placeholder' => _x('Select', 'verb', 'acf'),
|
167 |
+
'conditional_logic' => array(
|
|
|
168 |
array(
|
169 |
array(
|
170 |
'field' => 'field_type',
|
171 |
'operator' => '==',
|
172 |
+
'value' => 'select',
|
173 |
+
),
|
174 |
+
array(
|
175 |
+
'field' => 'allow_null',
|
176 |
+
'operator' => '==',
|
177 |
+
'value' => '1',
|
178 |
+
),
|
179 |
+
),
|
180 |
+
array(
|
181 |
+
array(
|
182 |
+
'field' => 'field_type',
|
183 |
+
'operator' => '==',
|
184 |
+
'value' => 'select',
|
185 |
+
),
|
186 |
+
array(
|
187 |
+
'field' => 'ui',
|
188 |
+
'operator' => '==',
|
189 |
+
'value' => '1',
|
190 |
+
),
|
191 |
+
array(
|
192 |
+
'field' => 'allow_null',
|
193 |
+
'operator' => '==',
|
194 |
+
'value' => '1',
|
195 |
),
|
196 |
),
|
197 |
)
|
198 |
+
));
|
199 |
+
|
200 |
+
// search placeholder
|
201 |
+
acf_render_field_setting($field, array(
|
202 |
+
'label' => __('Search Input Placeholder','acf'),
|
203 |
+
'instructions' => __('Appears within the search input','acf'),
|
204 |
+
'type' => 'text',
|
205 |
+
'name' => 'search_placeholder',
|
206 |
+
'placeholder' => _x('Select', 'verb', 'acf'),
|
207 |
+
'conditional_logic' => array(
|
208 |
+
array(
|
209 |
+
array(
|
210 |
+
'field' => 'field_type',
|
211 |
+
'operator' => '==',
|
212 |
+
'value' => 'select',
|
213 |
+
),
|
214 |
+
array(
|
215 |
+
'field' => 'ui',
|
216 |
+
'operator' => '==',
|
217 |
+
'value' => '1',
|
218 |
+
),
|
219 |
+
),
|
220 |
+
)
|
221 |
+
));
|
222 |
|
223 |
+
// Radio: other_choice
|
224 |
acf_render_field_setting( $field, array(
|
225 |
+
'label' => __('Other','acf'),
|
226 |
'instructions' => '',
|
227 |
+
'name' => 'other_choice',
|
228 |
'type' => 'true_false',
|
229 |
'ui' => 1,
|
230 |
+
'message' => __("Add 'other' choice to allow for custom values", 'acf'),
|
231 |
'conditions' => array(
|
232 |
array(
|
233 |
array(
|
235 |
'operator' => '==',
|
236 |
'value' => 'radio',
|
237 |
),
|
|
|
|
|
|
|
|
|
|
|
238 |
),
|
239 |
)
|
240 |
));
|
302 |
'value' => 'checkbox',
|
303 |
),
|
304 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
array(
|
306 |
array(
|
307 |
'field' => 'field_type',
|
308 |
'operator' => '==',
|
309 |
+
'value' => 'select',
|
310 |
),
|
311 |
array(
|
312 |
+
'field' => 'ui',
|
313 |
'operator' => '==',
|
314 |
+
'value' => '1',
|
315 |
),
|
316 |
+
)
|
317 |
)
|
318 |
));
|
319 |
|
320 |
}
|
321 |
+
|
322 |
+
function prepare_field($field){
|
323 |
+
|
324 |
+
// Set Field Type
|
325 |
+
$field['type'] = $field['field_type'];
|
326 |
+
|
327 |
+
// Choices
|
328 |
+
$field['choices'] = acfe_get_roles($field['user_role']);
|
329 |
+
|
330 |
+
// Allow Custom
|
331 |
+
if(acf_maybe_get($field, 'allow_custom')){
|
332 |
+
|
333 |
+
if($value = acf_maybe_get($field, 'value')){
|
334 |
+
|
335 |
+
$value = acf_get_array($value);
|
336 |
+
|
337 |
+
foreach($value as $v){
|
338 |
+
|
339 |
+
if(isset($field['choices'][$v]))
|
340 |
+
continue;
|
341 |
+
|
342 |
+
$field['choices'][$v] = $v;
|
343 |
+
|
344 |
+
}
|
345 |
+
|
346 |
+
}
|
347 |
+
|
348 |
+
}
|
349 |
+
|
350 |
+
return $field;
|
351 |
+
|
352 |
+
}
|
353 |
|
354 |
}
|
355 |
|
includes/modules/author.php
CHANGED
@@ -143,7 +143,7 @@ class acfe_author{
|
|
143 |
return;
|
144 |
|
145 |
$post_author = (int) $_POST['acf']['acfe_author'];
|
146 |
-
$_post_author = get_post_field('post_author', $post_id);
|
147 |
|
148 |
// Check if author has been changed
|
149 |
if($_post_author === $post_author)
|
143 |
return;
|
144 |
|
145 |
$post_author = (int) $_POST['acf']['acfe_author'];
|
146 |
+
$_post_author = (int) get_post_field('post_author', $post_id);
|
147 |
|
148 |
// Check if author has been changed
|
149 |
if($_post_author === $post_author)
|
includes/modules/dev.php
CHANGED
@@ -4,7 +4,7 @@ if(!defined('ABSPATH'))
|
|
4 |
exit;
|
5 |
|
6 |
// Check setting
|
7 |
-
if(
|
8 |
return;
|
9 |
|
10 |
if(!class_exists('acfe_dev')):
|
@@ -14,17 +14,12 @@ class acfe_dev{
|
|
14 |
public $wp_meta = array();
|
15 |
public $acf_meta = array();
|
16 |
|
17 |
-
public $is_super_dev = false;
|
18 |
-
|
19 |
function __construct(){
|
20 |
|
21 |
// Script debug
|
22 |
if(!defined('SCRIPT_DEBUG'))
|
23 |
define('SCRIPT_DEBUG', true);
|
24 |
|
25 |
-
if(acf_get_setting('acfe/super_dev', false) || (defined('ACFE_super_dev') && ACFE_super_dev))
|
26 |
-
$this->is_super_dev = true;
|
27 |
-
|
28 |
// Post
|
29 |
add_action('load-post.php', array($this, 'load_post'));
|
30 |
add_action('load-post-new.php', array($this, 'load_post'));
|
@@ -53,7 +48,7 @@ class acfe_dev{
|
|
53 |
// Remove WP post meta box
|
54 |
remove_meta_box('postcustom', false, 'normal');
|
55 |
|
56 |
-
if(
|
57 |
|
58 |
$restricted = array('acf-field-group', 'acfe-dbt', 'acfe-dop', 'acfe-dpt', 'acfe-dt', 'acfe-form', 'acfe-template');
|
59 |
|
@@ -230,7 +225,7 @@ class acfe_dev{
|
|
230 |
$value = $meta['value'];
|
231 |
|
232 |
// Field Group
|
233 |
-
$field_group_display =
|
234 |
$field_group = $meta['field_group'];
|
235 |
|
236 |
if($field_group){
|
4 |
exit;
|
5 |
|
6 |
// Check setting
|
7 |
+
if(!acfe_is_dev() && !acfe_is_super_dev())
|
8 |
return;
|
9 |
|
10 |
if(!class_exists('acfe_dev')):
|
14 |
public $wp_meta = array();
|
15 |
public $acf_meta = array();
|
16 |
|
|
|
|
|
17 |
function __construct(){
|
18 |
|
19 |
// Script debug
|
20 |
if(!defined('SCRIPT_DEBUG'))
|
21 |
define('SCRIPT_DEBUG', true);
|
22 |
|
|
|
|
|
|
|
23 |
// Post
|
24 |
add_action('load-post.php', array($this, 'load_post'));
|
25 |
add_action('load-post-new.php', array($this, 'load_post'));
|
48 |
// Remove WP post meta box
|
49 |
remove_meta_box('postcustom', false, 'normal');
|
50 |
|
51 |
+
if(!acfe_is_super_dev()){
|
52 |
|
53 |
$restricted = array('acf-field-group', 'acfe-dbt', 'acfe-dop', 'acfe-dpt', 'acfe-dt', 'acfe-form', 'acfe-template');
|
54 |
|
225 |
$value = $meta['value'];
|
226 |
|
227 |
// Field Group
|
228 |
+
$field_group_display = __('Local', 'acf');
|
229 |
$field_group = $meta['field_group'];
|
230 |
|
231 |
if($field_group){
|
includes/modules/dynamic-block-type.php
CHANGED
@@ -111,8 +111,9 @@ function acfe_dbt_menu_sub_highlight($submenu_file){
|
|
111 |
*/
|
112 |
add_action('init', 'acfe_dbt_registers');
|
113 |
function acfe_dbt_registers(){
|
114 |
-
|
115 |
-
|
|
|
116 |
if(empty($dynamic_block_types))
|
117 |
return;
|
118 |
|
@@ -288,7 +289,7 @@ function acfe_dbt_filter_save($post_id){
|
|
288 |
|
289 |
|
290 |
// Get ACFE option
|
291 |
-
|
292 |
|
293 |
// Create ACFE option
|
294 |
$option[$name] = $register_args;
|
@@ -297,7 +298,7 @@ function acfe_dbt_filter_save($post_id){
|
|
297 |
ksort($option);
|
298 |
|
299 |
// Update ACFE option
|
300 |
-
|
301 |
|
302 |
}
|
303 |
|
@@ -314,14 +315,14 @@ function acfe_dbt_filter_status_trash($post){
|
|
314 |
$name = get_field('name', $post_id);
|
315 |
|
316 |
// Get ACFE option
|
317 |
-
|
318 |
|
319 |
// Check ACFE option
|
320 |
if(isset($option[$name]))
|
321 |
unset($option[$name]);
|
322 |
|
323 |
// Update ACFE option
|
324 |
-
|
325 |
|
326 |
}
|
327 |
|
@@ -404,7 +405,7 @@ function acfe_dbt_admin_columns_html($column, $post_id){
|
|
404 |
// Name
|
405 |
if($column == 'name'){
|
406 |
|
407 |
-
echo '<code style="
|
408 |
|
409 |
}
|
410 |
|
@@ -448,13 +449,13 @@ function acfe_dbt_admin_columns_html($column, $post_id){
|
|
448 |
|
449 |
if(!empty($render_template)){
|
450 |
|
451 |
-
echo '<code style="
|
452 |
|
453 |
}
|
454 |
|
455 |
elseif(!empty($render_callback)){
|
456 |
|
457 |
-
echo '<code style="
|
458 |
|
459 |
}
|
460 |
|
111 |
*/
|
112 |
add_action('init', 'acfe_dbt_registers');
|
113 |
function acfe_dbt_registers(){
|
114 |
+
|
115 |
+
$dynamic_block_types = acfe_settings('modules.dynamic_block_type.data');
|
116 |
+
|
117 |
if(empty($dynamic_block_types))
|
118 |
return;
|
119 |
|
289 |
|
290 |
|
291 |
// Get ACFE option
|
292 |
+
$option = acfe_settings('modules.dynamic_block_type.data');
|
293 |
|
294 |
// Create ACFE option
|
295 |
$option[$name] = $register_args;
|
298 |
ksort($option);
|
299 |
|
300 |
// Update ACFE option
|
301 |
+
acfe_settings('modules.dynamic_block_type.data', $option, true);
|
302 |
|
303 |
}
|
304 |
|
315 |
$name = get_field('name', $post_id);
|
316 |
|
317 |
// Get ACFE option
|
318 |
+
$option = acfe_settings('modules.dynamic_block_type.data');
|
319 |
|
320 |
// Check ACFE option
|
321 |
if(isset($option[$name]))
|
322 |
unset($option[$name]);
|
323 |
|
324 |
// Update ACFE option
|
325 |
+
acfe_settings('modules.dynamic_block_type.data', $option, true);
|
326 |
|
327 |
}
|
328 |
|
405 |
// Name
|
406 |
if($column == 'name'){
|
407 |
|
408 |
+
echo '<code style="font-size: 12px;">' . get_field('name', $post_id) . '</code>';
|
409 |
|
410 |
}
|
411 |
|
449 |
|
450 |
if(!empty($render_template)){
|
451 |
|
452 |
+
echo '<code style="font-size: 12px;">/' . $render_template . '</code>';
|
453 |
|
454 |
}
|
455 |
|
456 |
elseif(!empty($render_callback)){
|
457 |
|
458 |
+
echo '<code style="font-size: 12px;">' . $render_callback . '</code>';
|
459 |
|
460 |
}
|
461 |
|
includes/modules/dynamic-form.php
CHANGED
@@ -15,6 +15,4 @@ acfe_include('includes/modules/form/actions/custom.php');
|
|
15 |
acfe_include('includes/modules/form/actions/email.php');
|
16 |
acfe_include('includes/modules/form/actions/post.php');
|
17 |
acfe_include('includes/modules/form/actions/term.php');
|
18 |
-
acfe_include('includes/modules/form/actions/user.php');
|
19 |
-
|
20 |
-
//acfe_include('includes/modules/form/actions/option.php');
|
15 |
acfe_include('includes/modules/form/actions/email.php');
|
16 |
acfe_include('includes/modules/form/actions/post.php');
|
17 |
acfe_include('includes/modules/form/actions/term.php');
|
18 |
+
acfe_include('includes/modules/form/actions/user.php');
|
|
|
|
includes/modules/dynamic-options-page.php
CHANGED
@@ -106,8 +106,9 @@ function acfe_dop_menu_sub_highlight($submenu_file){
|
|
106 |
*/
|
107 |
add_action('init', 'acfe_dop_registers');
|
108 |
function acfe_dop_registers(){
|
|
|
|
|
109 |
|
110 |
-
$dynamic_options_pages = get_option('acfe_dynamic_options_pages', array());
|
111 |
if(empty($dynamic_options_pages))
|
112 |
return;
|
113 |
|
@@ -291,7 +292,7 @@ function acfe_dop_filter_save($post_id){
|
|
291 |
$register_args['autoload'] = false;
|
292 |
|
293 |
// Get ACFE option
|
294 |
-
|
295 |
|
296 |
// Create ACFE option
|
297 |
$option[$name] = $register_args;
|
@@ -300,7 +301,7 @@ function acfe_dop_filter_save($post_id){
|
|
300 |
ksort($option);
|
301 |
|
302 |
// Update ACFE option
|
303 |
-
|
304 |
|
305 |
}
|
306 |
|
@@ -318,14 +319,14 @@ function acfe_dop_filter_status_trash($post){
|
|
318 |
$name = get_field('acfe_dop_name', $post_id);
|
319 |
|
320 |
// Get ACFE option
|
321 |
-
|
322 |
|
323 |
// Check ACFE option
|
324 |
if(isset($option[$name]))
|
325 |
unset($option[$name]);
|
326 |
|
327 |
// Update ACFE option
|
328 |
-
|
329 |
|
330 |
}
|
331 |
|
@@ -409,7 +410,7 @@ function acfe_dop_admin_columns_html($column, $post_id){
|
|
409 |
|
410 |
$name = get_field('acfe_dop_name', $post_id);
|
411 |
|
412 |
-
echo '<code style="
|
413 |
|
414 |
}
|
415 |
|
@@ -420,7 +421,7 @@ function acfe_dop_admin_columns_html($column, $post_id){
|
|
420 |
if(empty($p_id))
|
421 |
$p_id = 'options';
|
422 |
|
423 |
-
echo '<code style="
|
424 |
|
425 |
}
|
426 |
|
106 |
*/
|
107 |
add_action('init', 'acfe_dop_registers');
|
108 |
function acfe_dop_registers(){
|
109 |
+
|
110 |
+
$dynamic_options_pages = acfe_settings('modules.dynamic_option.data');
|
111 |
|
|
|
112 |
if(empty($dynamic_options_pages))
|
113 |
return;
|
114 |
|
292 |
$register_args['autoload'] = false;
|
293 |
|
294 |
// Get ACFE option
|
295 |
+
$option = acfe_settings('modules.dynamic_option.data');
|
296 |
|
297 |
// Create ACFE option
|
298 |
$option[$name] = $register_args;
|
301 |
ksort($option);
|
302 |
|
303 |
// Update ACFE option
|
304 |
+
acfe_settings('modules.dynamic_option.data', $option, true);
|
305 |
|
306 |
}
|
307 |
|
319 |
$name = get_field('acfe_dop_name', $post_id);
|
320 |
|
321 |
// Get ACFE option
|
322 |
+
$option = acfe_settings('modules.dynamic_option.data');
|
323 |
|
324 |
// Check ACFE option
|
325 |
if(isset($option[$name]))
|
326 |
unset($option[$name]);
|
327 |
|
328 |
// Update ACFE option
|
329 |
+
acfe_settings('modules.dynamic_option.data', $option, true);
|
330 |
|
331 |
}
|
332 |
|
410 |
|
411 |
$name = get_field('acfe_dop_name', $post_id);
|
412 |
|
413 |
+
echo '<code style="font-size: 12px;">' . $name . '</code>';
|
414 |
|
415 |
}
|
416 |
|
421 |
if(empty($p_id))
|
422 |
$p_id = 'options';
|
423 |
|
424 |
+
echo '<code style="font-size: 12px;">' . $p_id. '</code>';
|
425 |
|
426 |
}
|
427 |
|
includes/modules/dynamic-post-type.php
CHANGED
@@ -56,8 +56,9 @@ function acfe_dpt_register(){
|
|
56 |
*/
|
57 |
add_action('init', 'acfe_dpt_registers');
|
58 |
function acfe_dpt_registers(){
|
59 |
-
|
60 |
-
|
|
|
61 |
if(empty($dynamic_post_types))
|
62 |
return;
|
63 |
|
@@ -114,7 +115,7 @@ function acfe_dpt_misc_actions($post){
|
|
114 |
add_action('acf/save_post', 'acfe_dpt_filter_save', 20);
|
115 |
function acfe_dpt_filter_save($post_id){
|
116 |
|
117 |
-
if(get_post_type($post_id)
|
118 |
return;
|
119 |
|
120 |
$title = get_field('label', $post_id);
|
@@ -160,7 +161,7 @@ function acfe_dpt_filter_save($post_id){
|
|
160 |
|
161 |
// Capability
|
162 |
$capability_type = acf_decode_choices(get_field('capability_type', $post_id), true);
|
163 |
-
$capabilities = acf_decode_choices(get_field('capabilities', $post_id)
|
164 |
$map_meta_cap = get_field('map_meta_cap', $post_id);
|
165 |
|
166 |
// Archive
|
@@ -277,7 +278,7 @@ function acfe_dpt_filter_save($post_id){
|
|
277 |
$register_args['map_meta_cap'] = true;
|
278 |
|
279 |
// Get ACFE option
|
280 |
-
|
281 |
|
282 |
// Create ACFE option
|
283 |
$option[$name] = $register_args;
|
@@ -286,7 +287,7 @@ function acfe_dpt_filter_save($post_id){
|
|
286 |
ksort($option);
|
287 |
|
288 |
// Update ACFE option
|
289 |
-
|
290 |
|
291 |
// Flush permalinks
|
292 |
flush_rewrite_rules();
|
@@ -306,14 +307,14 @@ function acfe_dpt_filter_status_trash($post){
|
|
306 |
$name = get_field('acfe_dpt_name', $post_id);
|
307 |
|
308 |
// Get ACFE option
|
309 |
-
|
310 |
|
311 |
// Check ACFE option
|
312 |
if(isset($option[$name]))
|
313 |
unset($option[$name]);
|
314 |
|
315 |
// Update ACFE option
|
316 |
-
|
317 |
|
318 |
// Flush permalinks
|
319 |
flush_rewrite_rules();
|
@@ -377,8 +378,10 @@ function acfe_dpt_admin_ppp($ppp, $post_type){
|
|
377 |
*/
|
378 |
add_action('pre_get_posts', 'acfe_dpt_filter_admin_list');
|
379 |
function acfe_dpt_filter_admin_list($query){
|
|
|
|
|
380 |
|
381 |
-
if(!is_admin() || !$query->is_main_query() ||
|
382 |
return;
|
383 |
|
384 |
$post_type = $query->get('post_type');
|
@@ -527,7 +530,7 @@ function acfe_dpt_admin_columns_html($column, $post_id){
|
|
527 |
// Name
|
528 |
if($column === 'acfe-name'){
|
529 |
|
530 |
-
echo '<code style="
|
531 |
|
532 |
}
|
533 |
|
@@ -1977,11 +1980,11 @@ stories',
|
|
1977 |
'name' => 'capabilities',
|
1978 |
'type' => 'textarea',
|
1979 |
'instructions' => 'An array of the capabilities for this post type. Specify capabilities like this:<br /><br />
|
1980 |
-
|
1981 |
-
edit_post<br />
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
etc...',
|
1986 |
'required' => 0,
|
1987 |
'conditional_logic' => 0,
|
@@ -2128,7 +2131,6 @@ etc...',
|
|
2128 |
'type' => 'number',
|
2129 |
'instructions' => 'ACF Extended: Number of posts to display in the archive page',
|
2130 |
'required' => 0,
|
2131 |
-
'conditional_logic' => 0,
|
2132 |
'wrapper' => array(
|
2133 |
'width' => '',
|
2134 |
'class' => '',
|
@@ -2144,6 +2146,15 @@ etc...',
|
|
2144 |
'min' => -1,
|
2145 |
'max' => '',
|
2146 |
'step' => '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2147 |
),
|
2148 |
array(
|
2149 |
'key' => 'field_acfe_dpt_archive_orderby',
|
@@ -2152,7 +2163,6 @@ etc...',
|
|
2152 |
'type' => 'text',
|
2153 |
'instructions' => 'ACF Extended: Sort retrieved posts by parameter in the archive page. Defaults to \'date (post_date)\'.',
|
2154 |
'required' => 0,
|
2155 |
-
'conditional_logic' => 0,
|
2156 |
'wrapper' => array(
|
2157 |
'width' => '',
|
2158 |
'class' => '',
|
@@ -2170,6 +2180,15 @@ etc...',
|
|
2170 |
'prepend' => '',
|
2171 |
'append' => '',
|
2172 |
'maxlength' => '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2173 |
),
|
2174 |
array(
|
2175 |
'key' => 'field_acfe_dpt_archive_order',
|
@@ -2178,7 +2197,6 @@ etc...',
|
|
2178 |
'type' => 'select',
|
2179 |
'instructions' => 'ACF Extended: Designates the ascending or descending order of the \'orderby\' parameter in the archive page. Defaults to \'DESC\'.',
|
2180 |
'required' => 0,
|
2181 |
-
'conditional_logic' => 0,
|
2182 |
'wrapper' => array(
|
2183 |
'width' => '',
|
2184 |
'class' => '',
|
@@ -2200,6 +2218,15 @@ etc...',
|
|
2200 |
'return_format' => 'value',
|
2201 |
'ajax' => 0,
|
2202 |
'placeholder' => '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2203 |
),
|
2204 |
array(
|
2205 |
'key' => 'field_acfe_dpt_tab_single',
|
56 |
*/
|
57 |
add_action('init', 'acfe_dpt_registers');
|
58 |
function acfe_dpt_registers(){
|
59 |
+
|
60 |
+
$dynamic_post_types = acfe_settings('modules.dynamic_post_type.data');
|
61 |
+
|
62 |
if(empty($dynamic_post_types))
|
63 |
return;
|
64 |
|
115 |
add_action('acf/save_post', 'acfe_dpt_filter_save', 20);
|
116 |
function acfe_dpt_filter_save($post_id){
|
117 |
|
118 |
+
if(get_post_type($post_id) !== 'acfe-dpt')
|
119 |
return;
|
120 |
|
121 |
$title = get_field('label', $post_id);
|
161 |
|
162 |
// Capability
|
163 |
$capability_type = acf_decode_choices(get_field('capability_type', $post_id), true);
|
164 |
+
$capabilities = acf_decode_choices(get_field('capabilities', $post_id));
|
165 |
$map_meta_cap = get_field('map_meta_cap', $post_id);
|
166 |
|
167 |
// Archive
|
278 |
$register_args['map_meta_cap'] = true;
|
279 |
|
280 |
// Get ACFE option
|
281 |
+
$option = acfe_settings('modules.dynamic_post_type.data');
|
282 |
|
283 |
// Create ACFE option
|
284 |
$option[$name] = $register_args;
|
287 |
ksort($option);
|
288 |
|
289 |
// Update ACFE option
|
290 |
+
acfe_settings('modules.dynamic_post_type.data', $option, true);
|
291 |
|
292 |
// Flush permalinks
|
293 |
flush_rewrite_rules();
|
307 |
$name = get_field('acfe_dpt_name', $post_id);
|
308 |
|
309 |
// Get ACFE option
|
310 |
+
$option = acfe_settings('modules.dynamic_post_type.data');
|
311 |
|
312 |
// Check ACFE option
|
313 |
if(isset($option[$name]))
|
314 |
unset($option[$name]);
|
315 |
|
316 |
// Update ACFE option
|
317 |
+
acfe_settings('modules.dynamic_post_type.data', $option, true);
|
318 |
|
319 |
// Flush permalinks
|
320 |
flush_rewrite_rules();
|
378 |
*/
|
379 |
add_action('pre_get_posts', 'acfe_dpt_filter_admin_list');
|
380 |
function acfe_dpt_filter_admin_list($query){
|
381 |
+
|
382 |
+
global $pagenow;
|
383 |
|
384 |
+
if(!is_admin() || !$query->is_main_query() || $pagenow !== 'edit.php')
|
385 |
return;
|
386 |
|
387 |
$post_type = $query->get('post_type');
|
530 |
// Name
|
531 |
if($column === 'acfe-name'){
|
532 |
|
533 |
+
echo '<code style="font-size: 12px;">' . get_field('acfe_dpt_name', $post_id) . '</code>';
|
534 |
|
535 |
}
|
536 |
|
1980 |
'name' => 'capabilities',
|
1981 |
'type' => 'textarea',
|
1982 |
'instructions' => 'An array of the capabilities for this post type. Specify capabilities like this:<br /><br />
|
1983 |
+
publish_posts : publish_posts<br />
|
1984 |
+
edit_post : edit_post<br />
|
1985 |
+
edit_posts : edit_posts<br />
|
1986 |
+
read_post : read_post<br />
|
1987 |
+
delete_post : delete_post<br />
|
1988 |
etc...',
|
1989 |
'required' => 0,
|
1990 |
'conditional_logic' => 0,
|
2131 |
'type' => 'number',
|
2132 |
'instructions' => 'ACF Extended: Number of posts to display in the archive page',
|
2133 |
'required' => 0,
|
|
|
2134 |
'wrapper' => array(
|
2135 |
'width' => '',
|
2136 |
'class' => '',
|
2146 |
'min' => -1,
|
2147 |
'max' => '',
|
2148 |
'step' => '',
|
2149 |
+
'conditional_logic' => array(
|
2150 |
+
array(
|
2151 |
+
array(
|
2152 |
+
'field' => 'field_acfe_dpt_has_archive',
|
2153 |
+
'operator' => '==',
|
2154 |
+
'value' => '1',
|
2155 |
+
),
|
2156 |
+
),
|
2157 |
+
),
|
2158 |
),
|
2159 |
array(
|
2160 |
'key' => 'field_acfe_dpt_archive_orderby',
|
2163 |
'type' => 'text',
|
2164 |
'instructions' => 'ACF Extended: Sort retrieved posts by parameter in the archive page. Defaults to \'date (post_date)\'.',
|
2165 |
'required' => 0,
|
|
|
2166 |
'wrapper' => array(
|
2167 |
'width' => '',
|
2168 |
'class' => '',
|
2180 |
'prepend' => '',
|
2181 |
'append' => '',
|
2182 |
'maxlength' => '',
|
2183 |
+
'conditional_logic' => array(
|
2184 |
+
array(
|
2185 |
+
array(
|
2186 |
+
'field' => 'field_acfe_dpt_has_archive',
|
2187 |
+
'operator' => '==',
|
2188 |
+
'value' => '1',
|
2189 |
+
),
|
2190 |
+
),
|
2191 |
+
),
|
2192 |
),
|
2193 |
array(
|
2194 |
'key' => 'field_acfe_dpt_archive_order',
|
2197 |
'type' => 'select',
|
2198 |
'instructions' => 'ACF Extended: Designates the ascending or descending order of the \'orderby\' parameter in the archive page. Defaults to \'DESC\'.',
|
2199 |
'required' => 0,
|
|
|
2200 |
'wrapper' => array(
|
2201 |
'width' => '',
|
2202 |
'class' => '',
|
2218 |
'return_format' => 'value',
|
2219 |
'ajax' => 0,
|
2220 |
'placeholder' => '',
|
2221 |
+
'conditional_logic' => array(
|
2222 |
+
array(
|
2223 |
+
array(
|
2224 |
+
'field' => 'field_acfe_dpt_has_archive',
|
2225 |
+
'operator' => '==',
|
2226 |
+
'value' => '1',
|
2227 |
+
),
|
2228 |
+
),
|
2229 |
+
),
|
2230 |
),
|
2231 |
array(
|
2232 |
'key' => 'field_acfe_dpt_tab_single',
|
includes/modules/dynamic-taxonomy.php
CHANGED
@@ -56,8 +56,9 @@ function acfe_dt_register(){
|
|
56 |
*/
|
57 |
add_action('init', 'acfe_dt_registers');
|
58 |
function acfe_dt_registers(){
|
59 |
-
|
60 |
-
|
|
|
61 |
if(empty($dynamic_taxonomies))
|
62 |
return;
|
63 |
|
@@ -120,7 +121,7 @@ function acfe_dt_misc_actions($post){
|
|
120 |
add_action('acf/save_post', 'acfe_dt_filter_save', 20);
|
121 |
function acfe_dt_filter_save($post_id){
|
122 |
|
123 |
-
if(get_post_type($post_id)
|
124 |
return;
|
125 |
|
126 |
$title = get_field('label', $post_id);
|
@@ -164,7 +165,7 @@ function acfe_dt_filter_save($post_id){
|
|
164 |
$show_admin_column = get_field('show_admin_column', $post_id);
|
165 |
|
166 |
// Capability
|
167 |
-
$capabilities = acf_decode_choices(get_field('capabilities', $post_id)
|
168 |
|
169 |
// Single
|
170 |
$single_template = get_field('acfe_dt_single_template', $post_id);
|
@@ -251,7 +252,7 @@ function acfe_dt_filter_save($post_id){
|
|
251 |
$register_args['meta_box_cb'] = $meta_box_cb_custom;
|
252 |
|
253 |
// Get ACFE option
|
254 |
-
|
255 |
|
256 |
// Create ACFE option
|
257 |
$option[$name] = $register_args;
|
@@ -260,7 +261,7 @@ function acfe_dt_filter_save($post_id){
|
|
260 |
ksort($option);
|
261 |
|
262 |
// Update ACFE option
|
263 |
-
|
264 |
|
265 |
// Flush permalinks
|
266 |
flush_rewrite_rules();
|
@@ -280,14 +281,14 @@ function acfe_dt_filter_status_trash($post){
|
|
280 |
$name = get_field('acfe_dt_name', $post_id);
|
281 |
|
282 |
// Get ACFE option
|
283 |
-
|
284 |
|
285 |
// Check ACFE option
|
286 |
if(isset($option[$name]))
|
287 |
unset($option[$name]);
|
288 |
|
289 |
// Update ACFE option
|
290 |
-
|
291 |
|
292 |
// Flush permalinks
|
293 |
flush_rewrite_rules();
|
@@ -411,8 +412,13 @@ function acfe_dt_filter_front_list($query){
|
|
411 |
|
412 |
if(is_admin() || !$query->is_main_query() || !is_tax())
|
413 |
return;
|
|
|
|
|
|
|
|
|
|
|
414 |
|
415 |
-
$taxonomy = $
|
416 |
$taxonomy_obj = get_taxonomy($taxonomy);
|
417 |
|
418 |
$acfe_single_ppp = (isset($taxonomy_obj->acfe_single_ppp) && !empty($taxonomy_obj->acfe_single_ppp));
|
@@ -482,7 +488,7 @@ function acfe_dt_admin_columns_html($column, $post_id){
|
|
482 |
// Name
|
483 |
if($column === 'acfe-name'){
|
484 |
|
485 |
-
echo '<code style="
|
486 |
|
487 |
}
|
488 |
|
@@ -682,22 +688,26 @@ function acfe_dt_admin_validate_name($valid, $value, $field, $input){
|
|
682 |
|
683 |
// Editing Current Dynamic Taxonomy
|
684 |
$current_post_id = $_POST['_acf_post_id'];
|
685 |
-
$
|
686 |
|
687 |
if(!empty($current_post_id))
|
688 |
-
|
689 |
|
690 |
-
if($value === $
|
691 |
return $valid;
|
692 |
|
693 |
// Listing WP Taxonomies
|
694 |
global $wp_taxonomies;
|
|
|
695 |
if(!empty($wp_taxonomies)){
|
|
|
696 |
foreach($wp_taxonomies as $taxonomy){
|
|
|
697 |
if($value != $taxonomy->name)
|
698 |
continue;
|
699 |
|
700 |
$valid = __('This taxonomy name already exists');
|
|
|
701 |
}
|
702 |
}
|
703 |
|
@@ -1633,10 +1643,10 @@ Default: if empty, name is set to label value, and singular_name is set to name
|
|
1633 |
'name' => 'capabilities',
|
1634 |
'type' => 'textarea',
|
1635 |
'instructions' => 'An array of the capabilities for this taxonomy:<br /><br />
|
1636 |
-
manage_terms<br />
|
1637 |
-
edit_terms<br />
|
1638 |
-
delete_terms<br />
|
1639 |
-
assign_terms',
|
1640 |
'required' => 0,
|
1641 |
'conditional_logic' => 0,
|
1642 |
'wrapper' => array(
|
56 |
*/
|
57 |
add_action('init', 'acfe_dt_registers');
|
58 |
function acfe_dt_registers(){
|
59 |
+
|
60 |
+
$dynamic_taxonomies = acfe_settings('modules.dynamic_taxonomy.data');
|
61 |
+
|
62 |
if(empty($dynamic_taxonomies))
|
63 |
return;
|
64 |
|
121 |
add_action('acf/save_post', 'acfe_dt_filter_save', 20);
|
122 |
function acfe_dt_filter_save($post_id){
|
123 |
|
124 |
+
if(get_post_type($post_id) !== 'acfe-dt')
|
125 |
return;
|
126 |
|
127 |
$title = get_field('label', $post_id);
|
165 |
$show_admin_column = get_field('show_admin_column', $post_id);
|
166 |
|
167 |
// Capability
|
168 |
+
$capabilities = acf_decode_choices(get_field('capabilities', $post_id));
|
169 |
|
170 |
// Single
|
171 |
$single_template = get_field('acfe_dt_single_template', $post_id);
|
252 |
$register_args['meta_box_cb'] = $meta_box_cb_custom;
|
253 |
|
254 |
// Get ACFE option
|
255 |
+
$option = acfe_settings('modules.dynamic_taxonomy.data');
|
256 |
|
257 |
// Create ACFE option
|
258 |
$option[$name] = $register_args;
|
261 |
ksort($option);
|
262 |
|
263 |
// Update ACFE option
|
264 |
+
acfe_settings('modules.dynamic_taxonomy.data', $option, true);
|
265 |
|
266 |
// Flush permalinks
|
267 |
flush_rewrite_rules();
|
281 |
$name = get_field('acfe_dt_name', $post_id);
|
282 |
|
283 |
// Get ACFE option
|
284 |
+
$option = acfe_settings('modules.dynamic_taxonomy.data');
|
285 |
|
286 |
// Check ACFE option
|
287 |
if(isset($option[$name]))
|
288 |
unset($option[$name]);
|
289 |
|
290 |
// Update ACFE option
|
291 |
+
acfe_settings('modules.dynamic_taxonomy.data', $option, true);
|
292 |
|
293 |
// Flush permalinks
|
294 |
flush_rewrite_rules();
|
412 |
|
413 |
if(is_admin() || !$query->is_main_query() || !is_tax())
|
414 |
return;
|
415 |
+
|
416 |
+
$term_obj = $query->get_queried_object();
|
417 |
+
|
418 |
+
if(!is_a($term_obj, 'WP_Term'))
|
419 |
+
return;
|
420 |
|
421 |
+
$taxonomy = $term_obj->taxonomy;
|
422 |
$taxonomy_obj = get_taxonomy($taxonomy);
|
423 |
|
424 |
$acfe_single_ppp = (isset($taxonomy_obj->acfe_single_ppp) && !empty($taxonomy_obj->acfe_single_ppp));
|
488 |
// Name
|
489 |
if($column === 'acfe-name'){
|
490 |
|
491 |
+
echo '<code style="font-size: 12px;">' . get_field('acfe_dt_name', $post_id) . '</code>';
|
492 |
|
493 |
}
|
494 |
|
688 |
|
689 |
// Editing Current Dynamic Taxonomy
|
690 |
$current_post_id = $_POST['_acf_post_id'];
|
691 |
+
$current_taxonomy = false;
|
692 |
|
693 |
if(!empty($current_post_id))
|
694 |
+
$current_taxonomy = get_field('acfe_dt_name', $current_post_id);
|
695 |
|
696 |
+
if($value === $current_taxonomy)
|
697 |
return $valid;
|
698 |
|
699 |
// Listing WP Taxonomies
|
700 |
global $wp_taxonomies;
|
701 |
+
|
702 |
if(!empty($wp_taxonomies)){
|
703 |
+
|
704 |
foreach($wp_taxonomies as $taxonomy){
|
705 |
+
|
706 |
if($value != $taxonomy->name)
|
707 |
continue;
|
708 |
|
709 |
$valid = __('This taxonomy name already exists');
|
710 |
+
|
711 |
}
|
712 |
}
|
713 |
|
1643 |
'name' => 'capabilities',
|
1644 |
'type' => 'textarea',
|
1645 |
'instructions' => 'An array of the capabilities for this taxonomy:<br /><br />
|
1646 |
+
manage_terms : edit_posts<br />
|
1647 |
+
edit_terms : edit_posts<br />
|
1648 |
+
delete_terms : edit_posts<br />
|
1649 |
+
assign_terms : edit_posts',
|
1650 |
'required' => 0,
|
1651 |
'conditional_logic' => 0,
|
1652 |
'wrapper' => array(
|
includes/modules/form/actions/custom.php
CHANGED
@@ -9,7 +9,11 @@ class acfe_form_custom{
|
|
9 |
|
10 |
function __construct(){
|
11 |
|
12 |
-
add_filter('acf/validate_value/name=acfe_form_custom_action',
|
|
|
|
|
|
|
|
|
13 |
|
14 |
}
|
15 |
|
@@ -31,6 +35,169 @@ class acfe_form_custom{
|
|
31 |
return $valid;
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
new acfe_form_custom();
|
9 |
|
10 |
function __construct(){
|
11 |
|
12 |
+
add_filter('acf/validate_value/name=acfe_form_custom_action', array($this, 'validate'), 10, 4);
|
13 |
+
|
14 |
+
add_action('acf/render_field/name=acfe_form_custom_action_advanced_load', array($this, 'advanced_load'));
|
15 |
+
add_action('acf/render_field/name=acfe_form_custom_action_advanced_validation', array($this, 'advanced_validation'));
|
16 |
+
add_action('acf/render_field/name=acfe_form_custom_action_advanced_submit', array($this, 'advanced_submit'));
|
17 |
|
18 |
}
|
19 |
|
35 |
return $valid;
|
36 |
}
|
37 |
|
38 |
+
function advanced_load($field){
|
39 |
+
|
40 |
+
$form_name = 'my_form';
|
41 |
+
|
42 |
+
if(acf_maybe_get($field, 'value'))
|
43 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
44 |
+
|
45 |
+
?>You may use the following hooks:<br /><br />
|
46 |
+
<pre data-codemirror="php-plain">
|
47 |
+
add_filter('acfe/form/load/my-custom-action', 'my_form_custom_action_load', 10, 3);
|
48 |
+
add_filter('acfe/form/load/my-custom-action/form=<?php echo $form_name; ?>', 'my_form_custom_action_load', 10, 3);</pre>
|
49 |
+
<br />
|
50 |
+
<pre>
|
51 |
+
/**
|
52 |
+
* @array $form The form settings
|
53 |
+
* @int $post_id Current post ID
|
54 |
+
* @string $alias Action alias (Empty for custom actions)
|
55 |
+
*/
|
56 |
+
add_filter('acfe/form/submit/my-custom-action', 'my_form_custom_action_load', 10, 3);
|
57 |
+
function my_form_custom_action_load($form, $post_id, $alias){
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Set a custom query var
|
61 |
+
* The value '145' can be retrieved in an another action using the template tag:
|
62 |
+
* {query_var:my_tag}
|
63 |
+
*/
|
64 |
+
set_query_var('my_tag', 145);
|
65 |
+
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Set a custom query var array
|
69 |
+
* The values can be retrieved in an another action using the template tags:
|
70 |
+
* {query_var:my_tag:target} {query_var:my_tag:load}
|
71 |
+
*/
|
72 |
+
set_query_var('my_tag', array(
|
73 |
+
'target' => 145,
|
74 |
+
'load' => 12,
|
75 |
+
);
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Change form success message dynamically
|
79 |
+
*/
|
80 |
+
$form['updated_message'] = 'New success message!';
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Change form redirection URL
|
84 |
+
*/
|
85 |
+
$form['field_acfe_form_return'] = '/thank-you';
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Return arguments
|
89 |
+
* Note: Return false will hide the form
|
90 |
+
*/
|
91 |
+
return $form;
|
92 |
+
|
93 |
+
}
|
94 |
+
</pre><?php
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
function advanced_validation($field){
|
99 |
+
|
100 |
+
$form_name = 'my_form';
|
101 |
+
|
102 |
+
if(acf_maybe_get($field, 'value'))
|
103 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
104 |
+
|
105 |
+
?>You may use the following hooks:<br /><br />
|
106 |
+
<pre data-codemirror="php-plain">
|
107 |
+
add_action('acfe/form/validation/my-custom-action', 'my_form_custom_action_validation', 10, 3);
|
108 |
+
add_filter('acfe/form/validation/my-custom-action/form=<?php echo $form_name; ?>', 'my_form_custom_action_validation', 10, 3);</pre>
|
109 |
+
<br />
|
110 |
+
<pre>
|
111 |
+
/**
|
112 |
+
* @array $form The form settings
|
113 |
+
* @int $post_id Current post ID
|
114 |
+
* @string $alias Action alias (Empty for custom actions)
|
115 |
+
*/
|
116 |
+
add_action('acfe/form/validation/my-custom-action', 'my_form_custom_action_validation', 10, 3);
|
117 |
+
function my_form_custom_action_validation($form, $post_id, $alias){
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Get the form input value named 'my_field'
|
121 |
+
* This is the value entered by the user during the form submission
|
122 |
+
*/
|
123 |
+
$my_field = get_field('my_field');
|
124 |
+
$my_field_unformatted = get_field('my_field', false, false);
|
125 |
+
|
126 |
+
if($my_field === 'Hello'){
|
127 |
+
|
128 |
+
// Add validation error
|
129 |
+
acfe_add_validation_error('my_field', 'Hello is not allowed');
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Get the field value 'my_field' from the post ID 145
|
136 |
+
*/
|
137 |
+
$post_my_field = get_field('my_field', 145);
|
138 |
+
$post_my_field_unformatted = get_field('my_field', 145, false);
|
139 |
+
|
140 |
+
}
|
141 |
+
</pre><?php
|
142 |
+
|
143 |
+
}
|
144 |
+
|
145 |
+
function advanced_submit($field){
|
146 |
+
|
147 |
+
$form_name = 'my_form';
|
148 |
+
|
149 |
+
if(acf_maybe_get($field, 'value'))
|
150 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
151 |
+
|
152 |
+
?>You may use the following hooks:<br /><br />
|
153 |
+
<pre data-codemirror="php-plain">
|
154 |
+
add_action('acfe/form/submit/my-custom-action', 'my_form_custom_action', 10, 2);
|
155 |
+
add_action('acfe/form/submit/my-custom-action/form=<?php echo $form_name; ?>', 'my_form_custom_action', 10, 2);</pre>
|
156 |
+
<br />
|
157 |
+
<pre>
|
158 |
+
/**
|
159 |
+
* @array $form The form settings
|
160 |
+
* @int $post_id Current post ID
|
161 |
+
*/
|
162 |
+
add_action('acfe/form/submit/my-custom-action', 'my_form_custom_action', 10, 2);
|
163 |
+
function my_form_custom_action($form, $post_id){
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Get the value from the form input named 'my_field'
|
167 |
+
* This is the value entered by the user during the form submission
|
168 |
+
*/
|
169 |
+
$my_field = get_field('my_field');
|
170 |
+
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Get the field value 'my_field' from the post ID 145
|
174 |
+
*/
|
175 |
+
$my_post_field = get_field('my_field', 145);
|
176 |
+
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Set a custom query var
|
180 |
+
* The value '145' can be retrieved in an another action using the template tag:
|
181 |
+
* {query_var:my_tag}
|
182 |
+
*/
|
183 |
+
set_query_var('my_tag', 145);
|
184 |
+
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Set a custom query var array
|
188 |
+
* The values can be retrieved in an another action using the template tags:
|
189 |
+
* {query_var:my_tag:post_id} {query_var:my_tag:user}
|
190 |
+
*/
|
191 |
+
set_query_var('my_tag', array(
|
192 |
+
'post_id' => 145,
|
193 |
+
'user' => 12,
|
194 |
+
);
|
195 |
+
|
196 |
+
}
|
197 |
+
</pre><?php
|
198 |
+
|
199 |
+
}
|
200 |
+
|
201 |
}
|
202 |
|
203 |
new acfe_form_custom();
|
includes/modules/form/actions/email.php
CHANGED
@@ -9,39 +9,57 @@ class acfe_form_email{
|
|
9 |
|
10 |
function __construct(){
|
11 |
|
12 |
-
add_action('acfe/form/prepare/email',
|
13 |
-
add_action('acfe/form/submit/email',
|
14 |
|
15 |
-
add_filter('acf/prepare_field/name=acfe_form_email_file',
|
|
|
|
|
|
|
16 |
|
17 |
}
|
18 |
|
19 |
-
function prepare($form, $
|
20 |
|
|
|
21 |
$form_name = acf_maybe_get($form, 'form_name');
|
22 |
$form_id = acf_maybe_get($form, 'form_id');
|
23 |
-
$post_info = acf_get_post_id_info($post_id);
|
24 |
|
|
|
25 |
$from = get_sub_field('acfe_form_email_from');
|
26 |
-
$from = acfe_form_map_field_value($from, $
|
|
|
|
|
|
|
27 |
|
28 |
$to = get_sub_field('acfe_form_email_to');
|
29 |
-
$to = acfe_form_map_field_value($to, $
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
$subject = get_sub_field('acfe_form_email_subject');
|
32 |
-
$subject = acfe_form_map_field_value($subject, $
|
33 |
|
34 |
$content = get_sub_field('acfe_form_email_content');
|
35 |
-
$content = acfe_form_map_field_value($content, $
|
36 |
|
37 |
$headers = array();
|
38 |
$attachments = array();
|
39 |
|
|
|
|
|
|
|
|
|
40 |
if(have_rows('acfe_form_email_files')):
|
41 |
while(have_rows('acfe_form_email_files')): the_row();
|
42 |
|
43 |
$file_field_key = get_sub_field('acfe_form_email_file');
|
44 |
-
$
|
|
|
45 |
|
46 |
$field = acf_get_field($file_field_key);
|
47 |
$file = acf_format_value($file_id, 0, $field);
|
@@ -50,49 +68,127 @@ class acfe_form_email{
|
|
50 |
continue;
|
51 |
|
52 |
$attachments[] = get_attached_file($file['ID']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
endwhile;
|
55 |
endif;
|
56 |
|
57 |
$headers[] = 'From: ' . $from;
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
$args = array(
|
62 |
'from' => $from,
|
63 |
'to' => $to,
|
|
|
|
|
|
|
64 |
'subject' => $subject,
|
65 |
'content' => $content,
|
66 |
'headers' => $headers,
|
67 |
'attachments' => $attachments,
|
68 |
);
|
69 |
|
|
|
70 |
$args = apply_filters('acfe/form/submit/email/args', $args, $form, $action);
|
71 |
$args = apply_filters('acfe/form/submit/email/args/form=' . $form_name, $args, $form, $action);
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
// Check if 'from' has changed
|
77 |
-
$new_from = acf_maybe_get($args, 'from');
|
78 |
|
79 |
-
|
80 |
-
|
|
|
|
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
if(stripos($header, 'from:') !== 0)
|
85 |
-
continue;
|
86 |
-
|
87 |
-
$header = 'From: ' . $args['from'];
|
88 |
-
break;
|
89 |
-
|
90 |
-
}
|
91 |
|
92 |
}
|
93 |
|
|
|
94 |
if(!$args)
|
95 |
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
wp_mail($args['to'], $args['subject'], $args['content'], $args['headers'], $args['attachments']);
|
98 |
|
@@ -102,6 +198,17 @@ class acfe_form_email{
|
|
102 |
if(!empty($action))
|
103 |
do_action('acfe/form/submit/email/action=' . $action, $args, $form, $action);
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
|
107 |
function submit($args, $form, $action){
|
@@ -128,6 +235,94 @@ class acfe_form_email{
|
|
128 |
|
129 |
}
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
132 |
|
133 |
new acfe_form_email();
|
9 |
|
10 |
function __construct(){
|
11 |
|
12 |
+
add_action('acfe/form/prepare/email', array($this, 'prepare'), 1, 3);
|
13 |
+
add_action('acfe/form/submit/email', array($this, 'submit'), 1, 3);
|
14 |
|
15 |
+
add_filter('acf/prepare_field/name=acfe_form_email_file', array(acfe()->acfe_form, 'map_fields_deep'));
|
16 |
+
|
17 |
+
add_action('acf/render_field/name=acfe_form_email_advanced_args', array($this, 'advanced_args'));
|
18 |
+
add_action('acf/render_field/name=form_email_advanced_send', array($this, 'advanced_send'));
|
19 |
|
20 |
}
|
21 |
|
22 |
+
function prepare($form, $current_post_id, $action){
|
23 |
|
24 |
+
// Form
|
25 |
$form_name = acf_maybe_get($form, 'form_name');
|
26 |
$form_id = acf_maybe_get($form, 'form_id');
|
|
|
27 |
|
28 |
+
// Fields
|
29 |
$from = get_sub_field('acfe_form_email_from');
|
30 |
+
$from = acfe_form_map_field_value($from, $current_post_id, $form);
|
31 |
+
|
32 |
+
$reply_to = get_sub_field('acfe_form_email_reply_to');
|
33 |
+
$reply_to = acfe_form_map_field_value($reply_to, $current_post_id, $form);
|
34 |
|
35 |
$to = get_sub_field('acfe_form_email_to');
|
36 |
+
$to = acfe_form_map_field_value($to, $current_post_id, $form);
|
37 |
+
|
38 |
+
$cc = get_sub_field('acfe_form_email_cc');
|
39 |
+
$cc = acfe_form_map_field_value($cc, $current_post_id, $form);
|
40 |
+
|
41 |
+
$bcc = get_sub_field('acfe_form_email_bcc');
|
42 |
+
$bcc = acfe_form_map_field_value($bcc, $current_post_id, $form);
|
43 |
|
44 |
$subject = get_sub_field('acfe_form_email_subject');
|
45 |
+
$subject = acfe_form_map_field_value($subject, $current_post_id, $form);
|
46 |
|
47 |
$content = get_sub_field('acfe_form_email_content');
|
48 |
+
$content = acfe_form_map_field_value($content, $current_post_id, $form);
|
49 |
|
50 |
$headers = array();
|
51 |
$attachments = array();
|
52 |
|
53 |
+
// Delete files
|
54 |
+
$delete_files = array();
|
55 |
+
|
56 |
+
// Attachments: Dynamic
|
57 |
if(have_rows('acfe_form_email_files')):
|
58 |
while(have_rows('acfe_form_email_files')): the_row();
|
59 |
|
60 |
$file_field_key = get_sub_field('acfe_form_email_file');
|
61 |
+
$file_delete = get_sub_field('acfe_form_email_file_delete');
|
62 |
+
$file_id = acfe_form_map_field_value($file_field_key, $current_post_id, $form);
|
63 |
|
64 |
$field = acf_get_field($file_field_key);
|
65 |
$file = acf_format_value($file_id, 0, $field);
|
68 |
continue;
|
69 |
|
70 |
$attachments[] = get_attached_file($file['ID']);
|
71 |
+
|
72 |
+
if($file_delete){
|
73 |
+
|
74 |
+
$delete_files[] = $file['ID'];
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
endwhile;
|
79 |
+
endif;
|
80 |
+
|
81 |
+
// Attachments: Static
|
82 |
+
if(have_rows('acfe_form_email_files_static')):
|
83 |
+
while(have_rows('acfe_form_email_files_static')): the_row();
|
84 |
+
|
85 |
+
$file = get_sub_field('acfe_form_email_file_static');
|
86 |
+
|
87 |
+
$attachments[] = get_attached_file($file);
|
88 |
|
89 |
endwhile;
|
90 |
endif;
|
91 |
|
92 |
$headers[] = 'From: ' . $from;
|
93 |
+
|
94 |
+
if(!empty($reply_to)){
|
95 |
+
|
96 |
+
$headers[] = 'Reply-To: ' . $cc;
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
+
if(!empty($cc)){
|
101 |
+
|
102 |
+
$headers[] = 'Cc: ' . $cc;
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
if(!empty($bcc)){
|
107 |
+
|
108 |
+
$headers[] = 'Bcc: ' . $bcc;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
$headers[] = 'Content-Type: text/html';
|
113 |
+
$headers[] = 'charset=UTF-8';
|
114 |
|
115 |
$args = array(
|
116 |
'from' => $from,
|
117 |
'to' => $to,
|
118 |
+
'reply_to' => $reply_to,
|
119 |
+
'cc' => $cc,
|
120 |
+
'bcc' => $bcc,
|
121 |
'subject' => $subject,
|
122 |
'content' => $content,
|
123 |
'headers' => $headers,
|
124 |
'attachments' => $attachments,
|
125 |
);
|
126 |
|
127 |
+
// Deprecated filters
|
128 |
$args = apply_filters('acfe/form/submit/email/args', $args, $form, $action);
|
129 |
$args = apply_filters('acfe/form/submit/email/args/form=' . $form_name, $args, $form, $action);
|
130 |
|
131 |
+
// Filters
|
132 |
+
$args = apply_filters('acfe/form/submit/email_args', $args, $form, $action);
|
133 |
+
$args = apply_filters('acfe/form/submit/email_args/form=' . $form_name, $args, $form, $action);
|
|
|
|
|
134 |
|
135 |
+
if(!empty($action)){
|
136 |
+
|
137 |
+
// Deprecated filter
|
138 |
+
$args = apply_filters('acfe/form/submit/email/args/action=' . $action, $args, $form, $action);
|
139 |
|
140 |
+
// Filter
|
141 |
+
$args = apply_filters('acfe/form/submit/email_args/action=' . $action, $args, $form, $action);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
}
|
144 |
|
145 |
+
// Bail early if no args
|
146 |
if(!$args)
|
147 |
return;
|
148 |
+
|
149 |
+
// Check if Headers changed
|
150 |
+
$rules = array(
|
151 |
+
array(
|
152 |
+
'args_key' => 'from',
|
153 |
+
'value_old' => $from,
|
154 |
+
'header_key' => 'From:',
|
155 |
+
),
|
156 |
+
array(
|
157 |
+
'args_key' => 'reply_to',
|
158 |
+
'value_old' => $reply_to,
|
159 |
+
'header_key' => 'Reply-To:',
|
160 |
+
),
|
161 |
+
array(
|
162 |
+
'args_key' => 'cc',
|
163 |
+
'value_old' => $cc,
|
164 |
+
'header_key' => 'Cc:',
|
165 |
+
),
|
166 |
+
array(
|
167 |
+
'args_key' => 'bcc',
|
168 |
+
'value_old' => $bcc,
|
169 |
+
'header_key' => 'Bcc:',
|
170 |
+
),
|
171 |
+
);
|
172 |
+
|
173 |
+
foreach($rules as $rule){
|
174 |
+
|
175 |
+
$new_check = acf_maybe_get($args, $rule['args_key']);
|
176 |
+
|
177 |
+
if(!empty($new_check) && $new_check !== $rule['value_old']){
|
178 |
+
|
179 |
+
foreach($args['headers'] as &$header){
|
180 |
+
|
181 |
+
if(stripos($header, $rule['header_key']) !== 0)
|
182 |
+
continue;
|
183 |
+
|
184 |
+
$header = $rule['header_key'] . ' ' . $new_check;
|
185 |
+
break;
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
}
|
190 |
+
|
191 |
+
}
|
192 |
|
193 |
wp_mail($args['to'], $args['subject'], $args['content'], $args['headers'], $args['attachments']);
|
194 |
|
198 |
if(!empty($action))
|
199 |
do_action('acfe/form/submit/email/action=' . $action, $args, $form, $action);
|
200 |
|
201 |
+
// Delete files
|
202 |
+
if(!empty($delete_files)){
|
203 |
+
|
204 |
+
foreach($delete_files as $file_id){
|
205 |
+
|
206 |
+
wp_delete_attachment($file_id, true);
|
207 |
+
|
208 |
+
}
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
}
|
213 |
|
214 |
function submit($args, $form, $action){
|
235 |
|
236 |
}
|
237 |
|
238 |
+
function advanced_args($field){
|
239 |
+
|
240 |
+
$form_name = 'my_form';
|
241 |
+
|
242 |
+
if(acf_maybe_get($field, 'value'))
|
243 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
244 |
+
|
245 |
+
?>You may use the following hooks:<br /><br />
|
246 |
+
<pre data-codemirror="php-plain">
|
247 |
+
add_filter('acfe/form/submit/email_args', 'my_form_email_args', 10, 3);
|
248 |
+
add_filter('acfe/form/submit/email_args/form=<?php echo $form_name; ?>', 'my_form_email_args', 10, 3);
|
249 |
+
add_filter('acfe/form/submit/email_args/action=my-email-action', 'my_form_email_args', 10, 3);</pre>
|
250 |
+
<br />
|
251 |
+
<pre data-codemirror="php-plain">
|
252 |
+
/**
|
253 |
+
* @array $args The generated email arguments
|
254 |
+
* @array $form The form settings
|
255 |
+
* @string $action The action alias name
|
256 |
+
*/
|
257 |
+
add_filter('acfe/form/submit/email_args/form=<?php echo $form_name; ?>', 'my_form_email_args', 10, 4);
|
258 |
+
function my_form_email_args($args, $form, $action){
|
259 |
+
|
260 |
+
/**
|
261 |
+
* $args = array(
|
262 |
+
* 'from' => 'email@domain.com',
|
263 |
+
* 'reply_to' => 'email@domain.com',
|
264 |
+
* 'to' => 'email@domain.com',
|
265 |
+
* 'cc' => 'email@domain.com',
|
266 |
+
* 'bcc' => 'email@domain.com',
|
267 |
+
* 'subject' => 'Subject',
|
268 |
+
* 'content' => 'Content',
|
269 |
+
* 'headers' => array(
|
270 |
+
* 'From: email@domain.com',
|
271 |
+
* 'Reply-to: email@domain.com',
|
272 |
+
* 'Cc: email@domain.com',
|
273 |
+
* 'Bcc: email@domain.com',
|
274 |
+
* 'Content-Type: text/html',
|
275 |
+
* 'charset=UTF-8'
|
276 |
+
* ),
|
277 |
+
* 'attachments' => array(
|
278 |
+
* '/path/to/file.jpg'
|
279 |
+
* )
|
280 |
+
* );
|
281 |
+
*/
|
282 |
+
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Return arguments
|
286 |
+
* Note: Return false will stop e-mail from being sent
|
287 |
+
*/
|
288 |
+
return $args;
|
289 |
+
|
290 |
+
}</pre><?php
|
291 |
+
|
292 |
+
}
|
293 |
+
|
294 |
+
function advanced_send($field){
|
295 |
+
|
296 |
+
$form_name = 'my_form';
|
297 |
+
|
298 |
+
if(acf_maybe_get($field, 'value'))
|
299 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
300 |
+
|
301 |
+
?>You may use the following hooks:<br /><br />
|
302 |
+
<pre data-codemirror="php-plain">
|
303 |
+
add_action('acfe/form/submit/email', 'my_form_email_send', 10, 3);
|
304 |
+
add_action('acfe/form/submit/email/form=<?php echo $form_name; ?>', 'my_form_email_send', 10, 3);
|
305 |
+
add_action('acfe/form/submit/email/action=my-email-action', 'my_form_email_send', 10, 3);</pre>
|
306 |
+
<br />
|
307 |
+
<pre data-codemirror="php-plain">
|
308 |
+
/**
|
309 |
+
* @array $args The generated email arguments
|
310 |
+
* @array $form The form settings
|
311 |
+
* @string $action The action alias name
|
312 |
+
*/
|
313 |
+
add_action('acfe/form/submit/email/form=<?php echo $form_name; ?>', 'my_form_email_send', 10, 3);
|
314 |
+
function my_form_email_send($args, $form, $action){
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Get the value from the form input named 'my_field'
|
318 |
+
* This is the value entered by the user during the form submission
|
319 |
+
*/
|
320 |
+
$my_field = get_field('my_field');
|
321 |
+
|
322 |
+
}</pre><?php
|
323 |
+
|
324 |
+
}
|
325 |
+
|
326 |
}
|
327 |
|
328 |
new acfe_form_email();
|
includes/modules/form/actions/option.php
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if(!defined('ABSPATH'))
|
4 |
-
exit;
|
5 |
-
|
6 |
-
if(!class_exists('acfe_form_option')):
|
7 |
-
|
8 |
-
class acfe_form_option{
|
9 |
-
|
10 |
-
function __construct(){
|
11 |
-
|
12 |
-
add_filter('acfe/form/load/option', array($this, 'load'), 1);
|
13 |
-
add_action('acfe/form/submit/option', array($this, 'submit'), 1, 3);
|
14 |
-
|
15 |
-
}
|
16 |
-
|
17 |
-
function load($args){
|
18 |
-
|
19 |
-
$form_name = acf_maybe_get($args, 'form_name');
|
20 |
-
$form_id = acf_maybe_get($args, 'form_id');
|
21 |
-
|
22 |
-
if(!get_sub_field('acfe_form_option_load'))
|
23 |
-
return $args;
|
24 |
-
|
25 |
-
$_option_name_group = get_sub_field('acfe_form_option_name_group');
|
26 |
-
$_option_name = $_option_name_group['acfe_form_option_name'];
|
27 |
-
$_option_name_custom = $_option_name_group['acfe_form_option_name_custom'];
|
28 |
-
|
29 |
-
// var
|
30 |
-
$_post_id = $args['post_id'];
|
31 |
-
|
32 |
-
// Custom
|
33 |
-
if($_option_name === 'custom'){
|
34 |
-
|
35 |
-
$_post_id = acfe_form_map_field_get_value($_option_name_custom);
|
36 |
-
|
37 |
-
// Field
|
38 |
-
}elseif(acf_is_field_key($_option_name)){
|
39 |
-
|
40 |
-
$_post_id = get_field($_option_name);
|
41 |
-
|
42 |
-
}
|
43 |
-
|
44 |
-
$_post_id = apply_filters('acfe/form/load/option_name', $_post_id, $args);
|
45 |
-
$_post_id = apply_filters('acfe/form/load/option_name/name=' . $form_name, $_post_id, $args);
|
46 |
-
$_post_id = apply_filters('acfe/form/load/option_name/id=' . $form_id, $_post_id, $args);
|
47 |
-
|
48 |
-
// ID
|
49 |
-
$args['post_id'] = $_post_id;
|
50 |
-
|
51 |
-
return $args;
|
52 |
-
|
53 |
-
}
|
54 |
-
|
55 |
-
function submit($form, $post_id, $acf){
|
56 |
-
|
57 |
-
$form_name = acf_maybe_get($form, 'form_name');
|
58 |
-
$form_id = acf_maybe_get($form, 'form_id');
|
59 |
-
|
60 |
-
$_option_name_group = get_sub_field('acfe_form_option_name_group');
|
61 |
-
$_option_name = $_option_name_group['acfe_form_option_name'];
|
62 |
-
$_option_name_custom = $_option_name_group['acfe_form_option_name_custom'];
|
63 |
-
|
64 |
-
// var
|
65 |
-
$_post_id = false;
|
66 |
-
|
67 |
-
// Current post
|
68 |
-
if($_option_name === 'custom'){
|
69 |
-
|
70 |
-
$_post_id = acfe_form_map_field_value($_option_name_custom, $acf);
|
71 |
-
|
72 |
-
// Field
|
73 |
-
}elseif(acf_is_field_key($_option_name)){
|
74 |
-
|
75 |
-
$_post_id = acfe_form_map_field_value($_option_name, $acf);
|
76 |
-
|
77 |
-
}
|
78 |
-
|
79 |
-
do_action('acfe/form/submit/option', $form, $_post_id);
|
80 |
-
do_action('acfe/form/submit/option/name=' . $form_name, $form, $_post_id);
|
81 |
-
do_action('acfe/form/submit/option/id=' . $form_id, $form, $_post_id);
|
82 |
-
|
83 |
-
// Meta save
|
84 |
-
$_meta = get_sub_field('acfe_form_option_meta');
|
85 |
-
|
86 |
-
$data = acfe_form_filter_meta($_meta, $acf);
|
87 |
-
|
88 |
-
if(!empty($data)){
|
89 |
-
|
90 |
-
// Save meta fields
|
91 |
-
acf_save_post($_post_id, $data);
|
92 |
-
|
93 |
-
}
|
94 |
-
|
95 |
-
}
|
96 |
-
|
97 |
-
}
|
98 |
-
|
99 |
-
new acfe_form_option();
|
100 |
-
|
101 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/form/actions/post.php
CHANGED
@@ -20,42 +20,59 @@ class acfe_form_post{
|
|
20 |
* Admin
|
21 |
*/
|
22 |
add_filter('acf/prepare_field/name=acfe_form_post_save_meta', array(acfe()->acfe_form, 'map_fields'));
|
23 |
-
add_filter('acf/prepare_field/name=acfe_form_post_load_meta', array(acfe()->acfe_form, '
|
24 |
-
|
25 |
-
add_filter('acf/prepare_field/name=
|
26 |
-
add_filter('acf/prepare_field/name=
|
27 |
-
|
28 |
-
add_filter('acf/prepare_field/name=
|
29 |
-
add_filter('acf/prepare_field/name=
|
30 |
-
add_filter('acf/prepare_field/name=
|
31 |
-
add_filter('acf/prepare_field/name=
|
32 |
-
add_filter('acf/prepare_field/name=
|
33 |
-
|
34 |
-
add_filter('acf/
|
35 |
-
add_filter('acf/
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
}
|
39 |
|
40 |
-
function load($form, $
|
41 |
|
42 |
// Form
|
43 |
$form_name = acf_maybe_get($form, 'form_name');
|
44 |
$form_id = acf_maybe_get($form, 'form_id');
|
45 |
-
$post_info = acf_get_post_id_info($post_id);
|
46 |
|
47 |
// Action
|
48 |
$post_action = get_sub_field('acfe_form_post_action');
|
49 |
|
50 |
// Load values
|
51 |
$load_values = get_sub_field('acfe_form_post_load_values');
|
52 |
-
$load_source = get_sub_field('acfe_form_post_load_source');
|
53 |
$load_meta = get_sub_field('acfe_form_post_load_meta');
|
54 |
|
55 |
// Load values
|
56 |
if(!$load_values)
|
57 |
return $form;
|
58 |
-
|
|
|
59 |
$_post_type = get_sub_field('acfe_form_post_map_post_type');
|
60 |
$_post_status = get_sub_field('acfe_form_post_map_post_status');
|
61 |
$_post_title = get_sub_field('acfe_form_post_map_post_title');
|
@@ -65,32 +82,24 @@ class acfe_form_post{
|
|
65 |
$_post_parent = get_sub_field('acfe_form_post_map_post_parent');
|
66 |
$_post_terms = get_sub_field('acfe_form_post_map_post_terms');
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
if($post_info['type'] === 'post')
|
81 |
-
$_post_id = $post_info['id'];
|
82 |
-
|
83 |
-
}
|
84 |
-
|
85 |
$_post_id = apply_filters('acfe/form/load/post_id', $_post_id, $form, $action);
|
86 |
$_post_id = apply_filters('acfe/form/load/post_id/form=' . $form_name, $_post_id, $form, $action);
|
87 |
|
88 |
if(!empty($action))
|
89 |
$_post_id = apply_filters('acfe/form/load/post_id/action=' . $action, $_post_id, $form, $action);
|
90 |
|
91 |
-
// Query Var
|
92 |
-
$_post_id = acfe_form_map_query_var($_post_id);
|
93 |
-
|
94 |
// Invalid Post ID
|
95 |
if(!$_post_id)
|
96 |
return $form;
|
@@ -100,27 +109,23 @@ class acfe_form_post{
|
|
100 |
|
101 |
$key = array_search($_post_type, $load_meta);
|
102 |
|
103 |
-
if($key !== false)
|
104 |
-
|
105 |
unset($load_meta[$key]);
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
}
|
111 |
|
112 |
// Post status
|
113 |
if(acf_is_field_key($_post_status)){
|
114 |
|
115 |
-
$key = array_search($
|
116 |
|
117 |
-
if($key !== false)
|
118 |
-
|
119 |
unset($load_meta[$key]);
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
}
|
125 |
|
126 |
// Post title
|
@@ -128,13 +133,11 @@ class acfe_form_post{
|
|
128 |
|
129 |
$key = array_search($_post_title, $load_meta);
|
130 |
|
131 |
-
if($key !== false)
|
132 |
-
|
133 |
unset($load_meta[$key]);
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
}
|
139 |
|
140 |
// Post name
|
@@ -142,13 +145,11 @@ class acfe_form_post{
|
|
142 |
|
143 |
$key = array_search($_post_name, $load_meta);
|
144 |
|
145 |
-
if($key !== false)
|
146 |
-
|
147 |
unset($load_meta[$key]);
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
}
|
153 |
|
154 |
// Post content
|
@@ -156,13 +157,11 @@ class acfe_form_post{
|
|
156 |
|
157 |
$key = array_search($_post_content, $load_meta);
|
158 |
|
159 |
-
if($key !== false)
|
160 |
-
|
161 |
unset($load_meta[$key]);
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
}
|
167 |
|
168 |
// Post author
|
@@ -170,13 +169,11 @@ class acfe_form_post{
|
|
170 |
|
171 |
$key = array_search($_post_author, $load_meta);
|
172 |
|
173 |
-
if($key !== false)
|
174 |
-
|
175 |
unset($load_meta[$key]);
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
}
|
181 |
|
182 |
// Post parent
|
@@ -184,13 +181,11 @@ class acfe_form_post{
|
|
184 |
|
185 |
$key = array_search($_post_parent, $load_meta);
|
186 |
|
187 |
-
if($key !== false)
|
188 |
-
|
189 |
unset($load_meta[$key]);
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
}
|
195 |
|
196 |
// Post terms
|
@@ -198,38 +193,33 @@ class acfe_form_post{
|
|
198 |
|
199 |
$key = array_search($_post_terms, $load_meta);
|
200 |
|
201 |
-
if($key !== false)
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
}
|
232 |
-
|
233 |
}
|
234 |
|
235 |
// Load others values
|
@@ -249,97 +239,74 @@ class acfe_form_post{
|
|
249 |
|
250 |
}
|
251 |
|
252 |
-
function prepare($form, $
|
253 |
|
|
|
254 |
$form_name = acf_maybe_get($form, 'form_name');
|
255 |
$form_id = acf_maybe_get($form, 'form_id');
|
256 |
-
$post_info = acf_get_post_id_info($post_id);
|
257 |
|
258 |
// Action
|
259 |
$post_action = get_sub_field('acfe_form_post_action');
|
260 |
|
261 |
-
//
|
262 |
-
|
263 |
-
'post_type' => get_sub_field('acfe_form_post_map_post_type'),
|
264 |
-
'post_status' => get_sub_field('acfe_form_post_map_post_status'),
|
265 |
-
'post_title' => get_sub_field('acfe_form_post_map_post_title'),
|
266 |
-
'post_name' => get_sub_field('acfe_form_post_map_post_name'),
|
267 |
-
'post_content' => get_sub_field('acfe_form_post_map_post_content'),
|
268 |
-
'post_author' => get_sub_field('acfe_form_post_map_post_author'),
|
269 |
-
'post_parent' => get_sub_field('acfe_form_post_map_post_parent'),
|
270 |
-
'post_terms' => get_sub_field('acfe_form_post_map_post_terms'),
|
271 |
-
);
|
272 |
-
|
273 |
-
// Fields
|
274 |
-
$_target = get_sub_field('acfe_form_post_save_target');
|
275 |
-
|
276 |
-
$_post_type = get_sub_field('acfe_form_post_save_post_type');
|
277 |
-
$_post_status = get_sub_field('acfe_form_post_save_post_status');
|
278 |
-
|
279 |
-
$_post_title_group = get_sub_field('acfe_form_post_save_post_title_group');
|
280 |
-
$_post_title = $_post_title_group['acfe_form_post_save_post_title'];
|
281 |
-
$_post_title_custom = $_post_title_group['acfe_form_post_save_post_title_custom'];
|
282 |
-
|
283 |
-
$_post_name_group = get_sub_field('acfe_form_post_save_post_name_group');
|
284 |
-
$_post_name = $_post_name_group['acfe_form_post_save_post_name'];
|
285 |
-
$_post_name_custom = $_post_name_group['acfe_form_post_save_post_name_custom'];
|
286 |
|
|
|
287 |
$_post_content_group = get_sub_field('acfe_form_post_save_post_content_group');
|
288 |
$_post_content = $_post_content_group['acfe_form_post_save_post_content'];
|
289 |
$_post_content_custom = $_post_content_group['acfe_form_post_save_post_content_custom'];
|
290 |
|
291 |
-
$
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
$_post_id = 0;
|
296 |
|
297 |
// Insert Post
|
298 |
if($post_action === 'insert_post'){
|
299 |
|
300 |
-
$
|
301 |
-
|
302 |
-
|
303 |
-
if(!empty($map['post_title'])){
|
304 |
-
|
305 |
-
$temp_title = acfe_form_map_field_value($map['post_title'], $_POST['acf'], $_post_id);
|
306 |
-
|
307 |
-
}elseif($_post_title === 'generated_id'){
|
308 |
-
|
309 |
-
$temp_title = true;
|
310 |
-
|
311 |
-
}elseif($_post_title === 'custom'){
|
312 |
-
|
313 |
-
$temp_title = acfe_form_map_field_value($_post_title_custom, $_POST['acf'], $_post_id);
|
314 |
-
|
315 |
-
}
|
316 |
-
|
317 |
-
if(!empty($temp_title)){
|
318 |
-
|
319 |
-
$_post_id = wp_insert_post(array(
|
320 |
-
'post_title' => 'Post'
|
321 |
-
));
|
322 |
-
|
323 |
-
}
|
324 |
|
325 |
}
|
326 |
|
327 |
// Update Post
|
328 |
elseif($post_action === 'update_post'){
|
329 |
|
330 |
-
|
331 |
-
$_post_id = $_target;
|
332 |
-
|
333 |
-
// Current Post
|
334 |
-
if($_target === 'current_post'){
|
335 |
-
|
336 |
-
if($post_info['type'] === 'post')
|
337 |
-
$_post_id = $post_info['id'];
|
338 |
-
|
339 |
-
}
|
340 |
-
|
341 |
-
// Query Var
|
342 |
-
$_post_id = acfe_form_map_query_var($_post_id);
|
343 |
|
344 |
}
|
345 |
|
@@ -353,150 +320,240 @@ class acfe_form_post{
|
|
353 |
$args['ID'] = $_post_id;
|
354 |
|
355 |
// Post type
|
356 |
-
if(!empty($
|
357 |
|
358 |
-
|
|
|
359 |
|
360 |
-
|
361 |
|
362 |
-
$args['post_type'] = $_post_type;
|
363 |
-
|
364 |
}
|
365 |
|
366 |
// Post status
|
367 |
-
if(!empty($
|
|
|
|
|
|
|
368 |
|
369 |
-
$args['post_status'] =
|
370 |
-
|
371 |
-
}elseif(!empty($_post_status)){
|
372 |
-
|
373 |
-
$args['post_status'] = $_post_status;
|
374 |
|
375 |
}
|
376 |
|
377 |
// Post title
|
378 |
-
if(!empty($
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
}elseif($_post_title === 'generated_id'){
|
383 |
-
|
384 |
-
$args['post_title'] = $_post_id;
|
385 |
-
|
386 |
-
}elseif($_post_title === 'custom'){
|
387 |
|
388 |
-
$args['post_title'] =
|
389 |
|
|
|
|
|
|
|
390 |
}
|
391 |
|
392 |
// Post name
|
393 |
-
if(!empty($
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
}elseif($_post_name === 'generated_id'){
|
398 |
|
399 |
-
$args['post_name'] = $
|
400 |
-
|
401 |
-
}elseif($_post_name === 'custom'){
|
402 |
-
|
403 |
-
$args['post_name'] = acfe_form_map_field_value($_post_name_custom, $_POST['acf'], $_post_id);
|
404 |
|
|
|
|
|
|
|
405 |
}
|
406 |
|
407 |
// Post content
|
408 |
-
if(!empty($
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
}elseif($_post_content === 'custom'){
|
413 |
-
|
414 |
-
$args['post_content'] = acfe_form_map_field_value($_post_content_custom, $_POST['acf'], $_post_id);
|
415 |
|
|
|
|
|
416 |
}
|
417 |
|
418 |
// Post author
|
419 |
-
if(!empty($
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
}elseif(!empty($_post_author)){
|
424 |
-
|
425 |
-
// Custom user ID
|
426 |
-
$args['post_author'] = $_post_author;
|
427 |
-
|
428 |
-
// Current User
|
429 |
-
if($_post_author === 'current_user'){
|
430 |
-
|
431 |
-
$args['post_author'] = get_current_user_id();
|
432 |
-
|
433 |
-
// Current Post Author
|
434 |
-
}elseif($_post_author === 'current_post_author'){
|
435 |
-
|
436 |
-
if($post_info['type'] === 'post')
|
437 |
-
$args['post_author'] = get_post_field('post_author', $post_info['id']);
|
438 |
-
|
439 |
-
}
|
440 |
|
|
|
|
|
441 |
}
|
442 |
|
443 |
// Post parent
|
444 |
-
if(!empty($
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
}elseif(!empty($_post_parent)){
|
449 |
-
|
450 |
-
// Custom Post ID
|
451 |
-
$args['post_parent'] = $_post_parent;
|
452 |
|
453 |
-
|
454 |
-
if($_post_parent === 'current_post'){
|
455 |
-
|
456 |
-
if($post_info['type'] === 'post')
|
457 |
-
$args['post_parent'] = $post_info['id'];
|
458 |
-
|
459 |
-
}
|
460 |
-
|
461 |
-
}
|
462 |
|
463 |
-
|
464 |
|
465 |
// Post terms
|
466 |
-
if(!empty($
|
467 |
|
468 |
-
$terms = acf_array(
|
469 |
|
470 |
-
|
471 |
-
|
472 |
-
$terms = acf_array($_post_terms);
|
473 |
-
|
474 |
-
}
|
475 |
-
|
476 |
-
// Tax input
|
477 |
-
if(!empty($terms)){
|
478 |
-
|
479 |
-
foreach($terms as $term){
|
480 |
|
481 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
|
483 |
}
|
484 |
-
|
485 |
}
|
486 |
|
|
|
487 |
$args = apply_filters('acfe/form/submit/post_args', $args, $post_action, $form, $action);
|
488 |
$args = apply_filters('acfe/form/submit/post_args/form=' . $form_name, $args, $post_action, $form, $action);
|
489 |
|
490 |
if(!empty($action))
|
491 |
$args = apply_filters('acfe/form/submit/post_args/action=' . $action, $args, $post_action, $form, $action);
|
492 |
|
|
|
493 |
if($args === false)
|
494 |
return;
|
495 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
// Update Post
|
497 |
$_post_id = wp_update_post($args);
|
498 |
-
|
499 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
500 |
do_action('acfe/form/submit/post', $_post_id, $post_action, $args, $form, $action);
|
501 |
do_action('acfe/form/submit/post/form=' . $form_name, $_post_id, $post_action, $args, $form, $action);
|
502 |
|
@@ -538,15 +595,15 @@ class acfe_form_post{
|
|
538 |
|
539 |
if(!empty($save_meta)){
|
540 |
|
541 |
-
$
|
542 |
|
543 |
-
if(!empty($
|
544 |
|
545 |
// Backup original acf post data
|
546 |
$acf = $_POST['acf'];
|
547 |
|
548 |
// Save meta fields
|
549 |
-
acf_save_post($_post_id, $
|
550 |
|
551 |
// Restore original acf post data
|
552 |
$_POST['acf'] = $acf;
|
@@ -557,36 +614,99 @@ class acfe_form_post{
|
|
557 |
|
558 |
}
|
559 |
|
560 |
-
|
|
|
|
|
|
|
561 |
|
562 |
-
$
|
563 |
-
$
|
564 |
|
565 |
if(acf_maybe_get($field, 'value')){
|
566 |
|
567 |
-
$
|
568 |
-
$
|
|
|
|
|
|
|
569 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
570 |
}
|
571 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
572 |
?>You may use the following hooks:<br /><br />
|
573 |
-
<pre>
|
574 |
add_filter('acfe/form/load/post_id', 'my_form_post_values_source', 10, 3);
|
575 |
add_filter('acfe/form/load/post_id/form=<?php echo $form_name; ?>', 'my_form_post_values_source', 10, 3);
|
576 |
-
add_filter('acfe/form/load/post_id/action=my-post-action', 'my_form_post_values_source', 10, 3)
|
577 |
-
</pre>
|
578 |
<br />
|
579 |
-
<pre>
|
|
|
|
|
|
|
|
|
|
|
580 |
add_filter('acfe/form/load/post_id/form=<?php echo $form_name; ?>', 'my_form_post_values_source', 10, 3);
|
581 |
function my_form_post_values_source($post_id, $form, $action){
|
582 |
|
583 |
-
/**
|
584 |
-
* @int $post_id Post ID used as source
|
585 |
-
* @array $form The form settings
|
586 |
-
* @string $action The action alias name
|
587 |
-
*/
|
588 |
-
|
589 |
-
|
590 |
/**
|
591 |
* Force to load values from the post ID 145
|
592 |
*/
|
@@ -598,42 +718,34 @@ function my_form_post_values_source($post_id, $form, $action){
|
|
598 |
*/
|
599 |
return $post_id;
|
600 |
|
601 |
-
}
|
602 |
-
</pre><?php
|
603 |
|
604 |
}
|
605 |
|
606 |
function advanced_save_args($field){
|
607 |
|
608 |
-
$form_id = 100;
|
609 |
$form_name = 'my_form';
|
610 |
|
611 |
-
if(acf_maybe_get($field, 'value'))
|
612 |
|
613 |
-
$
|
614 |
-
$form_name = get_field('acfe_form_name', $form_id);
|
615 |
-
|
616 |
-
}
|
617 |
|
618 |
?>You may use the following hooks:<br /><br />
|
619 |
-
<pre>
|
620 |
add_filter('acfe/form/submit/post_args', 'my_form_post_args', 10, 4);
|
621 |
add_filter('acfe/form/submit/post_args/form=<?php echo $form_name; ?>', 'my_form_post_args', 10, 4);
|
622 |
-
add_filter('acfe/form/submit/post_args/action=my-post-action', 'my_form_post_args', 10, 4)
|
623 |
-
</pre>
|
624 |
<br />
|
625 |
-
<pre>
|
|
|
|
|
|
|
|
|
|
|
|
|
626 |
add_filter('acfe/form/submit/post_args/form=<?php echo $form_name; ?>', 'my_form_post_args', 10, 4);
|
627 |
function my_form_post_args($args, $type, $form, $action){
|
628 |
|
629 |
-
/**
|
630 |
-
* @array $args The generated post arguments
|
631 |
-
* @string $type Action type: 'insert_post' or 'update_post'
|
632 |
-
* @array $form The form settings
|
633 |
-
* @string $action The action alias name
|
634 |
-
*/
|
635 |
-
|
636 |
-
|
637 |
/**
|
638 |
* Force specific post title if the action type is 'insert_post'
|
639 |
*/
|
@@ -663,46 +775,36 @@ function my_form_post_args($args, $type, $form, $action){
|
|
663 |
*/
|
664 |
return $args;
|
665 |
|
666 |
-
}
|
667 |
-
</pre><?php
|
668 |
|
669 |
}
|
670 |
|
671 |
function advanced_save($field){
|
672 |
|
673 |
-
$form_id = 100;
|
674 |
$form_name = 'my_form';
|
675 |
|
676 |
-
if(acf_maybe_get($field, 'value'))
|
677 |
-
|
678 |
-
$form_id = $field['value'];
|
679 |
-
$form_name = get_field('acfe_form_name', $form_id);
|
680 |
-
|
681 |
-
}
|
682 |
|
683 |
?>You may use the following hooks:<br /><br />
|
684 |
-
<pre>
|
685 |
add_action('acfe/form/submit/post', 'my_form_post_save', 10, 5);
|
686 |
add_action('acfe/form/submit/post/form=<?php echo $form_name; ?>', 'my_form_post_save', 10, 5);
|
687 |
-
add_action('acfe/form/submit/post/action=my-post-action', 'my_form_post_save', 10, 5)
|
688 |
-
</pre>
|
689 |
<br />
|
690 |
-
<pre>
|
691 |
/**
|
692 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
693 |
*/
|
694 |
add_action('acfe/form/submit/post/form=<?php echo $form_name; ?>', 'my_form_post_save', 10, 5);
|
695 |
function my_form_post_save($post_id, $type, $args, $form, $action){
|
696 |
|
697 |
-
/**
|
698 |
-
* @int $post_id The targeted post ID
|
699 |
-
* @string $type Action type: 'insert_post' or 'update_post'
|
700 |
-
* @array $args The generated post arguments
|
701 |
-
* @array $form The form settings
|
702 |
-
* @string $action The action alias name
|
703 |
-
*/
|
704 |
-
|
705 |
-
|
706 |
/**
|
707 |
* Get the value from the form input named 'my_field'
|
708 |
* This is the value entered by the user during the form submission
|
@@ -715,8 +817,7 @@ function my_form_post_save($post_id, $type, $args, $form, $action){
|
|
715 |
*/
|
716 |
$my_post_field = get_field('my_field', $post_id);
|
717 |
|
718 |
-
}
|
719 |
-
</pre><?php
|
720 |
|
721 |
}
|
722 |
|
20 |
* Admin
|
21 |
*/
|
22 |
add_filter('acf/prepare_field/name=acfe_form_post_save_meta', array(acfe()->acfe_form, 'map_fields'));
|
23 |
+
add_filter('acf/prepare_field/name=acfe_form_post_load_meta', array(acfe()->acfe_form, 'map_fields'));
|
24 |
+
|
25 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_target', array(acfe()->acfe_form, 'map_fields_deep'));
|
26 |
+
add_filter('acf/prepare_field/name=acfe_form_post_load_source', array(acfe()->acfe_form, 'map_fields_deep'));
|
27 |
+
|
28 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_post_type', array(acfe()->acfe_form, 'map_fields_deep'));
|
29 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_post_status', array(acfe()->acfe_form, 'map_fields_deep'));
|
30 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_post_title', array(acfe()->acfe_form, 'map_fields_deep'));
|
31 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_post_name', array(acfe()->acfe_form, 'map_fields_deep'));
|
32 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_post_content', array(acfe()->acfe_form, 'map_fields_deep'));
|
33 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_post_author', array(acfe()->acfe_form, 'map_fields_deep'));
|
34 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_post_parent', array(acfe()->acfe_form, 'map_fields_deep'));
|
35 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_post_terms', array(acfe()->acfe_form, 'map_fields_deep'));
|
36 |
+
|
37 |
+
add_filter('acf/prepare_field/name=acfe_form_post_map_post_type', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
38 |
+
add_filter('acf/prepare_field/name=acfe_form_post_map_post_status', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
39 |
+
add_filter('acf/prepare_field/name=acfe_form_post_map_post_title', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
40 |
+
add_filter('acf/prepare_field/name=acfe_form_post_map_post_name', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
41 |
+
add_filter('acf/prepare_field/name=acfe_form_post_map_post_content', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
42 |
+
add_filter('acf/prepare_field/name=acfe_form_post_map_post_author', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
43 |
+
add_filter('acf/prepare_field/name=acfe_form_post_map_post_parent', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
44 |
+
add_filter('acf/prepare_field/name=acfe_form_post_map_post_terms', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
45 |
+
|
46 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_target', array($this, 'prepare_choices'), 5);
|
47 |
+
add_filter('acf/prepare_field/name=acfe_form_post_load_source', array($this, 'prepare_choices'), 5);
|
48 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_post_parent', array($this, 'prepare_choices'), 5);
|
49 |
+
add_filter('acf/prepare_field/name=acfe_form_post_save_post_author', array($this, 'prepare_choices_users'), 5);
|
50 |
+
|
51 |
+
|
52 |
+
add_action('acf/render_field/name=acfe_form_post_advanced_load', array($this, 'advanced_load'));
|
53 |
+
add_action('acf/render_field/name=acfe_form_post_advanced_save_args', array($this, 'advanced_save_args'));
|
54 |
+
add_action('acf/render_field/name=acfe_form_post_advanced_save', array($this, 'advanced_save'));
|
55 |
|
56 |
}
|
57 |
|
58 |
+
function load($form, $current_post_id, $action){
|
59 |
|
60 |
// Form
|
61 |
$form_name = acf_maybe_get($form, 'form_name');
|
62 |
$form_id = acf_maybe_get($form, 'form_id');
|
|
|
63 |
|
64 |
// Action
|
65 |
$post_action = get_sub_field('acfe_form_post_action');
|
66 |
|
67 |
// Load values
|
68 |
$load_values = get_sub_field('acfe_form_post_load_values');
|
|
|
69 |
$load_meta = get_sub_field('acfe_form_post_load_meta');
|
70 |
|
71 |
// Load values
|
72 |
if(!$load_values)
|
73 |
return $form;
|
74 |
+
|
75 |
+
$_post_id = get_sub_field('acfe_form_post_load_source');
|
76 |
$_post_type = get_sub_field('acfe_form_post_map_post_type');
|
77 |
$_post_status = get_sub_field('acfe_form_post_map_post_status');
|
78 |
$_post_title = get_sub_field('acfe_form_post_map_post_title');
|
82 |
$_post_parent = get_sub_field('acfe_form_post_map_post_parent');
|
83 |
$_post_terms = get_sub_field('acfe_form_post_map_post_terms');
|
84 |
|
85 |
+
// Map {field:name} {get_field:name} {query_var:name}
|
86 |
+
$_post_id = acfe_form_map_field_value_load($_post_id, $current_post_id, $form);
|
87 |
+
$_post_type = acfe_form_map_field_value_load($_post_type, $current_post_id, $form);
|
88 |
+
$_post_status = acfe_form_map_field_value_load($_post_status, $current_post_id, $form);
|
89 |
+
$_post_title = acfe_form_map_field_value_load($_post_title, $current_post_id, $form);
|
90 |
+
$_post_name = acfe_form_map_field_value_load($_post_name, $current_post_id, $form);
|
91 |
+
$_post_content = acfe_form_map_field_value_load($_post_content, $current_post_id, $form);
|
92 |
+
$_post_author = acfe_form_map_field_value_load($_post_author, $current_post_id, $form);
|
93 |
+
$_post_parent = acfe_form_map_field_value_load($_post_parent, $current_post_id, $form);
|
94 |
+
$_post_terms = acfe_form_map_field_value_load($_post_terms, $current_post_id, $form);
|
95 |
+
|
96 |
+
// Filters
|
|
|
|
|
|
|
|
|
|
|
97 |
$_post_id = apply_filters('acfe/form/load/post_id', $_post_id, $form, $action);
|
98 |
$_post_id = apply_filters('acfe/form/load/post_id/form=' . $form_name, $_post_id, $form, $action);
|
99 |
|
100 |
if(!empty($action))
|
101 |
$_post_id = apply_filters('acfe/form/load/post_id/action=' . $action, $_post_id, $form, $action);
|
102 |
|
|
|
|
|
|
|
103 |
// Invalid Post ID
|
104 |
if(!$_post_id)
|
105 |
return $form;
|
109 |
|
110 |
$key = array_search($_post_type, $load_meta);
|
111 |
|
112 |
+
if($key !== false)
|
|
|
113 |
unset($load_meta[$key]);
|
114 |
+
|
115 |
+
$form['map'][$_post_type]['value'] = get_post_field('post_type', $_post_id);
|
116 |
+
|
|
|
117 |
}
|
118 |
|
119 |
// Post status
|
120 |
if(acf_is_field_key($_post_status)){
|
121 |
|
122 |
+
$key = array_search($_post_status, $load_meta);
|
123 |
|
124 |
+
if($key !== false)
|
|
|
125 |
unset($load_meta[$key]);
|
126 |
+
|
127 |
+
$form['map'][$_post_status]['value'] = get_post_field('post_status', $_post_id);
|
128 |
+
|
|
|
129 |
}
|
130 |
|
131 |
// Post title
|
133 |
|
134 |
$key = array_search($_post_title, $load_meta);
|
135 |
|
136 |
+
if($key !== false)
|
|
|
137 |
unset($load_meta[$key]);
|
138 |
+
|
139 |
+
$form['map'][$_post_title]['value'] = get_post_field('post_title', $_post_id);
|
140 |
+
|
|
|
141 |
}
|
142 |
|
143 |
// Post name
|
145 |
|
146 |
$key = array_search($_post_name, $load_meta);
|
147 |
|
148 |
+
if($key !== false)
|
|
|
149 |
unset($load_meta[$key]);
|
150 |
+
|
151 |
+
$form['map'][$_post_name]['value'] = get_post_field('post_name', $_post_id);
|
152 |
+
|
|
|
153 |
}
|
154 |
|
155 |
// Post content
|
157 |
|
158 |
$key = array_search($_post_content, $load_meta);
|
159 |
|
160 |
+
if($key !== false)
|
|
|
161 |
unset($load_meta[$key]);
|
162 |
+
|
163 |
+
$form['map'][$_post_content]['value'] = get_post_field('post_content', $_post_id);
|
164 |
+
|
|
|
165 |
}
|
166 |
|
167 |
// Post author
|
169 |
|
170 |
$key = array_search($_post_author, $load_meta);
|
171 |
|
172 |
+
if($key !== false)
|
|
|
173 |
unset($load_meta[$key]);
|
174 |
+
|
175 |
+
$form['map'][$_post_author]['value'] = get_post_field('post_author', $_post_id);
|
176 |
+
|
|
|
177 |
}
|
178 |
|
179 |
// Post parent
|
181 |
|
182 |
$key = array_search($_post_parent, $load_meta);
|
183 |
|
184 |
+
if($key !== false)
|
|
|
185 |
unset($load_meta[$key]);
|
186 |
+
|
187 |
+
$form['map'][$_post_parent]['value'] = get_post_field('post_parent', $_post_id);
|
188 |
+
|
|
|
189 |
}
|
190 |
|
191 |
// Post terms
|
193 |
|
194 |
$key = array_search($_post_terms, $load_meta);
|
195 |
|
196 |
+
if($key !== false)
|
197 |
+
unset($load_meta[$key]);
|
198 |
+
|
199 |
+
$taxonomies = acf_get_taxonomies(array(
|
200 |
+
'post_type' => get_post_type($_post_id)
|
201 |
+
));
|
202 |
+
|
203 |
+
if(!empty($taxonomies)){
|
204 |
+
|
205 |
+
$terms = array();
|
206 |
+
|
207 |
+
foreach($taxonomies as $taxonomy){
|
208 |
+
|
209 |
+
$get_the_terms = get_the_terms($_post_id, $taxonomy);
|
210 |
+
if(!$get_the_terms || is_wp_error($get_the_terms))
|
211 |
+
continue;
|
212 |
+
|
213 |
+
$terms = array_merge($terms, $get_the_terms);
|
214 |
+
|
215 |
+
}
|
216 |
+
|
217 |
+
$return = wp_list_pluck($terms, 'term_id');
|
218 |
+
|
219 |
+
$form['map'][$_post_terms]['value'] = $return;
|
220 |
+
|
221 |
+
}
|
222 |
+
|
|
|
|
|
|
|
|
|
|
|
223 |
}
|
224 |
|
225 |
// Load others values
|
239 |
|
240 |
}
|
241 |
|
242 |
+
function prepare($form, $current_post_id, $action){
|
243 |
|
244 |
+
// Form
|
245 |
$form_name = acf_maybe_get($form, 'form_name');
|
246 |
$form_id = acf_maybe_get($form, 'form_id');
|
|
|
247 |
|
248 |
// Action
|
249 |
$post_action = get_sub_field('acfe_form_post_action');
|
250 |
|
251 |
+
// Load values
|
252 |
+
$load_values = get_sub_field('acfe_form_post_load_values');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
+
// Pre-process
|
255 |
$_post_content_group = get_sub_field('acfe_form_post_save_post_content_group');
|
256 |
$_post_content = $_post_content_group['acfe_form_post_save_post_content'];
|
257 |
$_post_content_custom = $_post_content_group['acfe_form_post_save_post_content_custom'];
|
258 |
|
259 |
+
if($_post_content === 'custom')
|
260 |
+
$_post_content = $_post_content_custom;
|
261 |
+
|
262 |
+
$map = array();
|
263 |
+
|
264 |
+
if($load_values){
|
265 |
+
|
266 |
+
// Mapping
|
267 |
+
$map = array(
|
268 |
+
'post_type' => get_sub_field('acfe_form_post_map_post_type'),
|
269 |
+
'post_status' => get_sub_field('acfe_form_post_map_post_status'),
|
270 |
+
'post_title' => get_sub_field('acfe_form_post_map_post_title'),
|
271 |
+
'post_name' => get_sub_field('acfe_form_post_map_post_name'),
|
272 |
+
'post_content' => get_sub_field('acfe_form_post_map_post_content'),
|
273 |
+
'post_author' => get_sub_field('acfe_form_post_map_post_author'),
|
274 |
+
'post_parent' => get_sub_field('acfe_form_post_map_post_parent'),
|
275 |
+
'post_terms' => get_sub_field('acfe_form_post_map_post_terms'),
|
276 |
+
);
|
277 |
+
|
278 |
+
}
|
279 |
+
|
280 |
+
// Fields
|
281 |
+
$fields = array(
|
282 |
+
'target' => get_sub_field('acfe_form_post_save_target'),
|
283 |
+
'post_type' => get_sub_field('acfe_form_post_save_post_type'),
|
284 |
+
'post_status' => get_sub_field('acfe_form_post_save_post_status'),
|
285 |
+
'post_title' => get_sub_field('acfe_form_post_save_post_title'),
|
286 |
+
'post_name' => get_sub_field('acfe_form_post_save_post_name'),
|
287 |
+
'post_content' => $_post_content,
|
288 |
+
'post_author' => get_sub_field('acfe_form_post_save_post_author'),
|
289 |
+
'post_parent' => get_sub_field('acfe_form_post_save_post_parent'),
|
290 |
+
'post_terms' => get_sub_field('acfe_form_post_save_post_terms'),
|
291 |
+
);
|
292 |
+
|
293 |
+
$data = acfe_form_map_vs_fields($map, $fields, $current_post_id, $form);
|
294 |
|
295 |
$_post_id = 0;
|
296 |
|
297 |
// Insert Post
|
298 |
if($post_action === 'insert_post'){
|
299 |
|
300 |
+
$_post_id = wp_insert_post(array(
|
301 |
+
'post_title' => 'Post'
|
302 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
|
304 |
}
|
305 |
|
306 |
// Update Post
|
307 |
elseif($post_action === 'update_post'){
|
308 |
|
309 |
+
$_post_id = $data['target'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
|
311 |
}
|
312 |
|
320 |
$args['ID'] = $_post_id;
|
321 |
|
322 |
// Post type
|
323 |
+
if(!empty($data['post_type'])){
|
324 |
|
325 |
+
if(is_array($data['post_type']))
|
326 |
+
$data['post_type'] = acfe_array_to_string($data['post_type']);
|
327 |
|
328 |
+
$args['post_type'] = $data['post_type'];
|
329 |
|
|
|
|
|
330 |
}
|
331 |
|
332 |
// Post status
|
333 |
+
if(!empty($data['post_status'])){
|
334 |
+
|
335 |
+
if(is_array($data['post_status']))
|
336 |
+
$data['post_status'] = acfe_array_to_string($data['post_status']);
|
337 |
|
338 |
+
$args['post_status'] = $data['post_status'];
|
|
|
|
|
|
|
|
|
339 |
|
340 |
}
|
341 |
|
342 |
// Post title
|
343 |
+
if(!empty($data['post_title'])){
|
344 |
+
|
345 |
+
if(is_array($data['post_title']))
|
346 |
+
$data['post_title'] = acfe_array_to_string($data['post_title']);
|
|
|
|
|
|
|
|
|
|
|
347 |
|
348 |
+
$args['post_title'] = $data['post_title'];
|
349 |
|
350 |
+
if($data['post_title'] === 'generated_id')
|
351 |
+
$args['post_title'] = $_post_id;
|
352 |
+
|
353 |
}
|
354 |
|
355 |
// Post name
|
356 |
+
if(!empty($data['post_name'])){
|
357 |
+
|
358 |
+
if(is_array($data['post_name']))
|
359 |
+
$data['post_name'] = acfe_array_to_string($data['post_name']);
|
|
|
360 |
|
361 |
+
$args['post_name'] = $data['post_name'];
|
|
|
|
|
|
|
|
|
362 |
|
363 |
+
if($data['post_name'] === 'generated_id')
|
364 |
+
$args['post_name'] = $_post_id;
|
365 |
+
|
366 |
}
|
367 |
|
368 |
// Post content
|
369 |
+
if(!empty($data['post_content'])){
|
370 |
+
|
371 |
+
if(is_array($data['post_content']))
|
372 |
+
$data['post_content'] = acfe_array_to_string($data['post_content']);
|
|
|
|
|
|
|
373 |
|
374 |
+
$args['post_content'] = $data['post_content'];
|
375 |
+
|
376 |
}
|
377 |
|
378 |
// Post author
|
379 |
+
if(!empty($data['post_author'])){
|
380 |
+
|
381 |
+
if(is_array($data['post_author']))
|
382 |
+
$data['post_author'] = acfe_array_to_string($data['post_author']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
|
384 |
+
$args['post_author'] = $data['post_author'];
|
385 |
+
|
386 |
}
|
387 |
|
388 |
// Post parent
|
389 |
+
if(!empty($data['post_parent'])){
|
390 |
+
|
391 |
+
if(is_array($data['post_author']))
|
392 |
+
$data['post_author'] = acfe_array_to_string($data['post_author']);
|
|
|
|
|
|
|
|
|
393 |
|
394 |
+
$args['post_parent'] = $data['post_parent'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
|
396 |
+
}
|
397 |
|
398 |
// Post terms
|
399 |
+
if(!empty($data['post_terms'])){
|
400 |
|
401 |
+
$terms = acf_array($data['post_terms']);
|
402 |
|
403 |
+
// Tax input
|
404 |
+
if(!empty($terms)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
|
406 |
+
foreach($terms as $term){
|
407 |
+
|
408 |
+
if(is_string($term) || is_numeric($term)){
|
409 |
+
|
410 |
+
$args['acfe_form_terms'][] = $term;
|
411 |
+
|
412 |
+
}elseif(is_array($term)){
|
413 |
+
|
414 |
+
foreach($term as $sub_term){
|
415 |
+
|
416 |
+
// String || Numeric
|
417 |
+
if(is_string($sub_term) || is_numeric($sub_term)){
|
418 |
+
|
419 |
+
$args['acfe_form_terms'][] = $sub_term;
|
420 |
+
|
421 |
+
// Array
|
422 |
+
}elseif(is_array($sub_term)){
|
423 |
+
|
424 |
+
if(!acf_maybe_get($sub_term, 'term_id'))
|
425 |
+
continue;
|
426 |
+
|
427 |
+
$args['acfe_form_terms'][] = $sub_term['term_id'];
|
428 |
+
|
429 |
+
// Object
|
430 |
+
}elseif(is_object($sub_term) && is_a($sub_term, 'WP_Term')){
|
431 |
+
|
432 |
+
if(!isset($sub_term->term_id) || empty($sub_term->term_id))
|
433 |
+
continue;
|
434 |
+
|
435 |
+
$args['acfe_form_terms'][] = $sub_term->term_id;
|
436 |
+
|
437 |
+
}
|
438 |
+
|
439 |
+
|
440 |
+
}
|
441 |
+
|
442 |
+
}elseif(is_object($term) && is_a($term, 'WP_Term')){
|
443 |
+
|
444 |
+
if(!isset($term->term_id) || empty($term->term_id))
|
445 |
+
continue;
|
446 |
+
|
447 |
+
$args['acfe_form_terms'][] = $term->term_id;
|
448 |
+
|
449 |
+
}
|
450 |
+
|
451 |
+
|
452 |
+
|
453 |
+
}
|
454 |
|
455 |
}
|
456 |
+
|
457 |
}
|
458 |
|
459 |
+
// Args
|
460 |
$args = apply_filters('acfe/form/submit/post_args', $args, $post_action, $form, $action);
|
461 |
$args = apply_filters('acfe/form/submit/post_args/form=' . $form_name, $args, $post_action, $form, $action);
|
462 |
|
463 |
if(!empty($action))
|
464 |
$args = apply_filters('acfe/form/submit/post_args/action=' . $action, $args, $post_action, $form, $action);
|
465 |
|
466 |
+
// Bail early if false
|
467 |
if($args === false)
|
468 |
return;
|
469 |
|
470 |
+
// Post terms pre-process (let post update first, for post type)
|
471 |
+
$terms = array();
|
472 |
+
|
473 |
+
if(acf_maybe_get($args, 'acfe_form_terms')){
|
474 |
+
|
475 |
+
$terms = acf_extract_var($args, 'acfe_form_terms');
|
476 |
+
|
477 |
+
}
|
478 |
+
|
479 |
// Update Post
|
480 |
$_post_id = wp_update_post($args);
|
481 |
+
|
482 |
+
// Post terms process
|
483 |
+
if(!empty($terms)){
|
484 |
+
|
485 |
+
$term_objects = array();
|
486 |
+
$term_create = array();
|
487 |
+
|
488 |
+
foreach($terms as $term){
|
489 |
+
|
490 |
+
if(is_numeric($term)){
|
491 |
+
|
492 |
+
$get_term = get_term($term);
|
493 |
+
|
494 |
+
if(empty($get_term) || is_wp_error($get_term))
|
495 |
+
continue;
|
496 |
+
|
497 |
+
$term_objects[$get_term->taxonomy][] = $get_term->term_id;
|
498 |
+
|
499 |
+
}elseif(is_string($term)){
|
500 |
+
|
501 |
+
$explode = explode('|', $term);
|
502 |
+
|
503 |
+
// No taxonomy found in input
|
504 |
+
if(isset($explode[1])){
|
505 |
+
|
506 |
+
$term_create[$explode[1]][] = $explode[0];
|
507 |
+
|
508 |
+
}else{
|
509 |
+
|
510 |
+
// Get post type
|
511 |
+
$post_type = 'post';
|
512 |
+
|
513 |
+
if(isset($args['post_type']))
|
514 |
+
$post_type = $args['post_type'];
|
515 |
+
|
516 |
+
$taxonomies = get_object_taxonomies($post_type);
|
517 |
+
|
518 |
+
if(!empty($taxonomies)){
|
519 |
+
|
520 |
+
$taxonomy = $taxonomies[0];
|
521 |
+
|
522 |
+
$term_create[$taxonomy] = $explode[0];
|
523 |
+
|
524 |
+
}
|
525 |
+
|
526 |
+
}
|
527 |
+
|
528 |
+
}
|
529 |
+
|
530 |
+
}
|
531 |
+
|
532 |
+
// Term Objects
|
533 |
+
if(!empty($term_objects)){
|
534 |
+
|
535 |
+
foreach($term_objects as $term_taxonomy => $term_ids){
|
536 |
+
|
537 |
+
wp_set_object_terms($args['ID'], $term_ids, $term_taxonomy, true);
|
538 |
+
|
539 |
+
}
|
540 |
+
|
541 |
+
}
|
542 |
+
|
543 |
+
// Create Terms (with slugs)
|
544 |
+
if(!empty($term_create)){
|
545 |
+
|
546 |
+
foreach($term_create as $term_taxonomy => $term_slugs){
|
547 |
+
|
548 |
+
wp_set_object_terms($args['ID'], $term_slugs, $term_taxonomy, true);
|
549 |
+
|
550 |
+
}
|
551 |
+
|
552 |
+
}
|
553 |
+
|
554 |
+
}
|
555 |
+
|
556 |
+
// Submit
|
557 |
do_action('acfe/form/submit/post', $_post_id, $post_action, $args, $form, $action);
|
558 |
do_action('acfe/form/submit/post/form=' . $form_name, $_post_id, $post_action, $args, $form, $action);
|
559 |
|
595 |
|
596 |
if(!empty($save_meta)){
|
597 |
|
598 |
+
$meta = acfe_form_filter_meta($save_meta, $_POST['acf']);
|
599 |
|
600 |
+
if(!empty($meta)){
|
601 |
|
602 |
// Backup original acf post data
|
603 |
$acf = $_POST['acf'];
|
604 |
|
605 |
// Save meta fields
|
606 |
+
acf_save_post($_post_id, $meta);
|
607 |
|
608 |
// Restore original acf post data
|
609 |
$_POST['acf'] = $acf;
|
614 |
|
615 |
}
|
616 |
|
617 |
+
/**
|
618 |
+
* Post: Select2 Choices
|
619 |
+
*/
|
620 |
+
function prepare_choices($field){
|
621 |
|
622 |
+
$field['choices']['current_post'] = 'Current: Post';
|
623 |
+
$field['choices']['current_post_parent'] = 'Current: Post Parent';
|
624 |
|
625 |
if(acf_maybe_get($field, 'value')){
|
626 |
|
627 |
+
$field_type = acf_get_field_type('post_object');
|
628 |
+
$field['post_type'] = acf_get_post_types();
|
629 |
+
|
630 |
+
// load posts
|
631 |
+
$posts = $field_type->get_posts($field['value'], $field);
|
632 |
|
633 |
+
if($posts){
|
634 |
+
|
635 |
+
foreach(array_keys($posts) as $i){
|
636 |
+
|
637 |
+
// vars
|
638 |
+
$post = acf_extract_var($posts, $i);
|
639 |
+
|
640 |
+
// append to choices
|
641 |
+
$field['choices'][$post->ID] = $field_type->get_post_title($post, $field);
|
642 |
+
|
643 |
+
}
|
644 |
+
|
645 |
+
}
|
646 |
+
|
647 |
+
}
|
648 |
+
|
649 |
+
return $field;
|
650 |
+
|
651 |
+
}
|
652 |
+
|
653 |
+
/**
|
654 |
+
* User: Select2 Choices
|
655 |
+
*/
|
656 |
+
function prepare_choices_users($field){
|
657 |
+
|
658 |
+
$field['choices']['current_user'] = 'Current User';
|
659 |
+
$field['choices']['current_post_author'] = 'Current Post Author';
|
660 |
+
|
661 |
+
if(acf_maybe_get($field, 'value')){
|
662 |
+
|
663 |
+
$field_type = acf_get_field_type('user');
|
664 |
+
|
665 |
+
// Clean value into an array of IDs.
|
666 |
+
$user_ids = array_map('intval', acf_array($field['value']));
|
667 |
+
|
668 |
+
// Find users in database (ensures all results are real).
|
669 |
+
$users = acf_get_users(array(
|
670 |
+
'include' => $user_ids
|
671 |
+
));
|
672 |
+
|
673 |
+
// Append.
|
674 |
+
if($users){
|
675 |
+
|
676 |
+
foreach($users as $user){
|
677 |
+
$field['choices'][$user->ID] = $field_type->get_result($user, $field);
|
678 |
+
}
|
679 |
+
|
680 |
+
}
|
681 |
+
|
682 |
}
|
683 |
|
684 |
+
return $field;
|
685 |
+
|
686 |
+
}
|
687 |
+
|
688 |
+
function advanced_load($field){
|
689 |
+
|
690 |
+
$form_name = 'my_form';
|
691 |
+
|
692 |
+
if(acf_maybe_get($field, 'value'))
|
693 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
694 |
+
|
695 |
?>You may use the following hooks:<br /><br />
|
696 |
+
<pre data-codemirror="php-plain">
|
697 |
add_filter('acfe/form/load/post_id', 'my_form_post_values_source', 10, 3);
|
698 |
add_filter('acfe/form/load/post_id/form=<?php echo $form_name; ?>', 'my_form_post_values_source', 10, 3);
|
699 |
+
add_filter('acfe/form/load/post_id/action=my-post-action', 'my_form_post_values_source', 10, 3);</pre>
|
|
|
700 |
<br />
|
701 |
+
<pre data-codemirror="php-plain">
|
702 |
+
/**
|
703 |
+
* @int $post_id Post ID used as source
|
704 |
+
* @array $form The form settings
|
705 |
+
* @string $action The action alias name
|
706 |
+
*/
|
707 |
add_filter('acfe/form/load/post_id/form=<?php echo $form_name; ?>', 'my_form_post_values_source', 10, 3);
|
708 |
function my_form_post_values_source($post_id, $form, $action){
|
709 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
710 |
/**
|
711 |
* Force to load values from the post ID 145
|
712 |
*/
|
718 |
*/
|
719 |
return $post_id;
|
720 |
|
721 |
+
}</pre><?php
|
|
|
722 |
|
723 |
}
|
724 |
|
725 |
function advanced_save_args($field){
|
726 |
|
|
|
727 |
$form_name = 'my_form';
|
728 |
|
729 |
+
if(acf_maybe_get($field, 'value'))
|
730 |
|
731 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
|
|
|
|
|
|
732 |
|
733 |
?>You may use the following hooks:<br /><br />
|
734 |
+
<pre data-codemirror="php-plain">
|
735 |
add_filter('acfe/form/submit/post_args', 'my_form_post_args', 10, 4);
|
736 |
add_filter('acfe/form/submit/post_args/form=<?php echo $form_name; ?>', 'my_form_post_args', 10, 4);
|
737 |
+
add_filter('acfe/form/submit/post_args/action=my-post-action', 'my_form_post_args', 10, 4);</pre>
|
|
|
738 |
<br />
|
739 |
+
<pre data-codemirror="php-plain">
|
740 |
+
/**
|
741 |
+
* @array $args The generated post arguments
|
742 |
+
* @string $type Action type: 'insert_post' or 'update_post'
|
743 |
+
* @array $form The form settings
|
744 |
+
* @string $action The action alias name
|
745 |
+
*/
|
746 |
add_filter('acfe/form/submit/post_args/form=<?php echo $form_name; ?>', 'my_form_post_args', 10, 4);
|
747 |
function my_form_post_args($args, $type, $form, $action){
|
748 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
749 |
/**
|
750 |
* Force specific post title if the action type is 'insert_post'
|
751 |
*/
|
775 |
*/
|
776 |
return $args;
|
777 |
|
778 |
+
}</pre><?php
|
|
|
779 |
|
780 |
}
|
781 |
|
782 |
function advanced_save($field){
|
783 |
|
|
|
784 |
$form_name = 'my_form';
|
785 |
|
786 |
+
if(acf_maybe_get($field, 'value'))
|
787 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
|
|
|
|
|
|
|
|
788 |
|
789 |
?>You may use the following hooks:<br /><br />
|
790 |
+
<pre data-codemirror="php-plain">
|
791 |
add_action('acfe/form/submit/post', 'my_form_post_save', 10, 5);
|
792 |
add_action('acfe/form/submit/post/form=<?php echo $form_name; ?>', 'my_form_post_save', 10, 5);
|
793 |
+
add_action('acfe/form/submit/post/action=my-post-action', 'my_form_post_save', 10, 5);</pre>
|
|
|
794 |
<br />
|
795 |
+
<pre data-codemirror="php-plain">
|
796 |
/**
|
797 |
+
* @int $post_id The targeted post ID
|
798 |
+
* @string $type Action type: 'insert_post' or 'update_post'
|
799 |
+
* @array $args The generated post arguments
|
800 |
+
* @array $form The form settings
|
801 |
+
* @string $action The action alias name
|
802 |
+
*
|
803 |
+
* Note: At this point the post & meta fields are already saved in the database
|
804 |
*/
|
805 |
add_action('acfe/form/submit/post/form=<?php echo $form_name; ?>', 'my_form_post_save', 10, 5);
|
806 |
function my_form_post_save($post_id, $type, $args, $form, $action){
|
807 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
/**
|
809 |
* Get the value from the form input named 'my_field'
|
810 |
* This is the value entered by the user during the form submission
|
817 |
*/
|
818 |
$my_post_field = get_field('my_field', $post_id);
|
819 |
|
820 |
+
}</pre><?php
|
|
|
821 |
|
822 |
}
|
823 |
|
includes/modules/form/actions/term.php
CHANGED
@@ -20,61 +20,64 @@ class acfe_form_term{
|
|
20 |
* Admin
|
21 |
*/
|
22 |
add_filter('acf/prepare_field/name=acfe_form_term_save_meta', array(acfe()->acfe_form, 'map_fields'));
|
23 |
-
add_filter('acf/prepare_field/name=acfe_form_term_load_meta', array(acfe()->acfe_form, '
|
24 |
|
25 |
-
add_filter('acf/prepare_field/name=
|
26 |
-
add_filter('acf/prepare_field/name=
|
27 |
-
add_filter('acf/prepare_field/name=acfe_form_term_map_taxonomy', array(acfe()->acfe_form, 'map_fields_deep'));
|
28 |
-
add_filter('acf/prepare_field/name=acfe_form_term_map_parent', array(acfe()->acfe_form, 'map_fields_deep'));
|
29 |
-
add_filter('acf/prepare_field/name=acfe_form_term_map_description', array(acfe()->acfe_form, 'map_fields_deep'));
|
30 |
|
31 |
-
add_filter('acf/
|
32 |
-
add_filter('acf/
|
33 |
-
add_filter('acf/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
}
|
36 |
|
37 |
-
function load($form, $
|
38 |
|
39 |
// Form
|
40 |
$form_name = acf_maybe_get($form, 'form_name');
|
41 |
$form_id = acf_maybe_get($form, 'form_id');
|
42 |
-
$post_info = acf_get_post_id_info($post_id);
|
43 |
|
44 |
// Action
|
45 |
$term_action = get_sub_field('acfe_form_term_action');
|
46 |
|
47 |
// Load values
|
48 |
$load_values = get_sub_field('acfe_form_term_load_values');
|
49 |
-
$load_source = get_sub_field('acfe_form_term_load_source');
|
50 |
$load_meta = get_sub_field('acfe_form_term_load_meta');
|
51 |
|
52 |
// Load values
|
53 |
if(!$load_values)
|
54 |
return $form;
|
55 |
-
|
|
|
56 |
$_name = get_sub_field('acfe_form_term_map_name');
|
57 |
$_slug = get_sub_field('acfe_form_term_map_slug');
|
58 |
$_taxonomy = get_sub_field('acfe_form_term_map_taxonomy');
|
59 |
$_parent = get_sub_field('acfe_form_term_map_parent');
|
60 |
$_description = get_sub_field('acfe_form_term_map_description');
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
}
|
70 |
-
|
71 |
-
// Current Term
|
72 |
-
elseif($load_source === 'current_term'){
|
73 |
-
|
74 |
-
if($post_info['type'] === 'term')
|
75 |
-
$_term_id = $post_info['id'];
|
76 |
-
|
77 |
-
}
|
78 |
|
79 |
$_term_id = apply_filters('acfe/form/load/term_id', $_term_id, $form, $action);
|
80 |
$_term_id = apply_filters('acfe/form/load/term_id/form=' . $form_name, $_term_id, $form, $action);
|
@@ -82,9 +85,6 @@ class acfe_form_term{
|
|
82 |
if(!empty($action))
|
83 |
$_term_id = apply_filters('acfe/form/load/term_id/action=' . $action, $_term_id, $form, $action);
|
84 |
|
85 |
-
// Query Var
|
86 |
-
$_term_id = acfe_form_map_query_var($_term_id);
|
87 |
-
|
88 |
// Invalid Term ID
|
89 |
if(!$_term_id)
|
90 |
return $form;
|
@@ -94,12 +94,10 @@ class acfe_form_term{
|
|
94 |
|
95 |
$key = array_search($_name, $load_meta);
|
96 |
|
97 |
-
if($key !== false)
|
98 |
-
|
99 |
unset($load_meta[$key]);
|
100 |
-
|
101 |
-
|
102 |
-
}
|
103 |
|
104 |
}
|
105 |
|
@@ -108,12 +106,10 @@ class acfe_form_term{
|
|
108 |
|
109 |
$key = array_search($_slug, $load_meta);
|
110 |
|
111 |
-
if($key !== false)
|
112 |
-
|
113 |
unset($load_meta[$key]);
|
114 |
-
|
115 |
-
|
116 |
-
}
|
117 |
|
118 |
}
|
119 |
|
@@ -122,12 +118,10 @@ class acfe_form_term{
|
|
122 |
|
123 |
$key = array_search($_taxonomy, $load_meta);
|
124 |
|
125 |
-
if($key !== false)
|
126 |
-
|
127 |
unset($load_meta[$key]);
|
128 |
-
|
129 |
-
|
130 |
-
}
|
131 |
|
132 |
}
|
133 |
|
@@ -136,16 +130,10 @@ class acfe_form_term{
|
|
136 |
|
137 |
$key = array_search($_parent, $load_meta);
|
138 |
|
139 |
-
if($key !== false)
|
140 |
-
|
141 |
unset($load_meta[$key]);
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
if(!empty($get_term_field))
|
146 |
-
$form['map'][$_parent]['value'] = get_term_field('parent', $_term_id);
|
147 |
-
|
148 |
-
}
|
149 |
|
150 |
}
|
151 |
|
@@ -154,12 +142,10 @@ class acfe_form_term{
|
|
154 |
|
155 |
$key = array_search($_description, $load_meta);
|
156 |
|
157 |
-
if($key !== false)
|
158 |
-
|
159 |
unset($load_meta[$key]);
|
160 |
-
|
161 |
-
|
162 |
-
}
|
163 |
|
164 |
}
|
165 |
|
@@ -180,134 +166,119 @@ class acfe_form_term{
|
|
180 |
|
181 |
}
|
182 |
|
183 |
-
function prepare($form, $
|
184 |
|
|
|
185 |
$form_name = acf_maybe_get($form, 'form_name');
|
186 |
$form_id = acf_maybe_get($form, 'form_id');
|
187 |
-
$post_info = acf_get_post_id_info($post_id);
|
188 |
|
189 |
// Action
|
190 |
$term_action = get_sub_field('acfe_form_term_action');
|
|
|
|
|
|
|
191 |
|
192 |
-
//
|
193 |
-
$map = array(
|
194 |
-
'name' => get_sub_field('acfe_form_term_map_name'),
|
195 |
-
'slug' => get_sub_field('acfe_form_term_map_slug'),
|
196 |
-
'taxonomy' => get_sub_field('acfe_form_term_map_taxonomy'),
|
197 |
-
'parent' => get_sub_field('acfe_form_term_map_parent'),
|
198 |
-
'description' => get_sub_field('acfe_form_term_map_description'),
|
199 |
-
);
|
200 |
-
|
201 |
-
// Fields
|
202 |
-
$_target = get_sub_field('acfe_form_term_save_target');
|
203 |
-
|
204 |
-
$_name_group = get_sub_field('acfe_form_term_save_name_group');
|
205 |
-
$_name = $_name_group['acfe_form_term_save_name'];
|
206 |
-
$_name_custom = $_name_group['acfe_form_term_save_name_custom'];
|
207 |
-
|
208 |
-
$_slug_group = get_sub_field('acfe_form_term_save_slug_group');
|
209 |
-
$_slug = $_slug_group['acfe_form_term_save_slug'];
|
210 |
-
$_slug_custom = $_slug_group['acfe_form_term_save_slug_custom'];
|
211 |
-
|
212 |
-
$_taxonomy = get_sub_field('acfe_form_term_save_taxonomy');
|
213 |
-
$_parent = get_sub_field('acfe_form_term_save_parent');
|
214 |
-
|
215 |
$_description_group = get_sub_field('acfe_form_term_save_description_group');
|
216 |
$_description = $_description_group['acfe_form_term_save_description'];
|
217 |
$_description_custom = $_description_group['acfe_form_term_save_description_custom'];
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
// args
|
220 |
$args = array();
|
221 |
|
222 |
// Insert term
|
223 |
$_term_id = 0;
|
224 |
|
225 |
-
// Update
|
226 |
if($term_action === 'update_term'){
|
227 |
|
228 |
-
|
229 |
-
$_term_id = $_target;
|
230 |
-
|
231 |
-
// Current Term
|
232 |
-
if($_target === 'current_term'){
|
233 |
-
|
234 |
-
if($post_info['type'] === 'term')
|
235 |
-
$_term_id = $post_info['id'];
|
236 |
-
|
237 |
-
// Invalid Term ID
|
238 |
-
if(!$_term_id)
|
239 |
-
return;
|
240 |
-
|
241 |
-
}
|
242 |
|
243 |
-
//
|
244 |
-
|
|
|
245 |
|
246 |
$args['ID'] = $_term_id;
|
247 |
|
248 |
}
|
249 |
|
250 |
// Name
|
251 |
-
if(!empty($
|
|
|
|
|
|
|
252 |
|
253 |
-
$args['name'] =
|
254 |
-
|
255 |
-
}elseif($_name === 'custom'){
|
256 |
-
|
257 |
-
$args['name'] = acfe_form_map_field_value($_name_custom, $_POST['acf'], $_term_id);
|
258 |
|
259 |
}
|
260 |
|
261 |
// Slug
|
262 |
-
if(!empty($
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
}elseif($_slug === 'custom'){
|
267 |
|
268 |
-
$args['slug'] =
|
269 |
|
270 |
}
|
271 |
|
272 |
// Taxonomy
|
273 |
-
if(!empty($
|
|
|
|
|
|
|
274 |
|
275 |
-
$args['taxonomy'] =
|
276 |
-
|
277 |
-
}elseif(!empty($_taxonomy)){
|
278 |
-
|
279 |
-
$args['taxonomy'] = $_taxonomy;
|
280 |
|
281 |
}
|
282 |
|
283 |
// Parent
|
284 |
-
if(!empty($
|
285 |
-
|
286 |
-
|
|
|
287 |
|
288 |
-
|
289 |
-
|
290 |
-
// Custom Term ID
|
291 |
-
$args['parent'] = $_parent;
|
292 |
-
|
293 |
-
// Current Term
|
294 |
-
if($_parent === 'current_term'){
|
295 |
-
|
296 |
-
if($post_info['type'] === 'term')
|
297 |
-
$args['parent'] = $post_info['id'];
|
298 |
-
|
299 |
-
}
|
300 |
|
301 |
}
|
302 |
|
303 |
// Description
|
304 |
-
if(!empty($
|
305 |
-
|
306 |
-
|
|
|
307 |
|
308 |
-
|
309 |
-
|
310 |
-
$args['description'] = acfe_form_map_field_value($_description_custom, $_POST['acf'], $_term_id);
|
311 |
|
312 |
}
|
313 |
|
@@ -377,8 +348,8 @@ class acfe_form_term{
|
|
377 |
// Get term array
|
378 |
$term_object = get_term($_term_id, $args['taxonomy'], 'ARRAY_A');
|
379 |
|
380 |
-
$term_object['permalink'] = get_term_link($_term_id, $
|
381 |
-
$term_object['admin_url'] = admin_url('
|
382 |
|
383 |
$term_object = apply_filters('acfe/form/query_var/term', $term_object, $_term_id, $term_action, $args, $form, $action);
|
384 |
$term_object = apply_filters('acfe/form/query_var/term/form=' . $form_name, $term_object, $_term_id, $term_action, $args, $form, $action);
|
@@ -395,15 +366,15 @@ class acfe_form_term{
|
|
395 |
|
396 |
if(!empty($save_meta)){
|
397 |
|
398 |
-
$
|
399 |
|
400 |
-
if(!empty($
|
401 |
|
402 |
// Backup original acf post data
|
403 |
$acf = $_POST['acf'];
|
404 |
|
405 |
// Save meta fields
|
406 |
-
acf_save_post('term_' . $_term_id, $
|
407 |
|
408 |
// Restore original acf post data
|
409 |
$_POST['acf'] = $acf;
|
@@ -414,6 +385,35 @@ class acfe_form_term{
|
|
414 |
|
415 |
}
|
416 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
function advanced_load($field){
|
418 |
|
419 |
$form_name = 'my_form';
|
@@ -429,16 +429,14 @@ add_filter('acfe/form/load/term_id/action=my-term-action', 'my_form_term_values_
|
|
429 |
</pre>
|
430 |
<br />
|
431 |
<pre>
|
|
|
|
|
|
|
|
|
|
|
432 |
add_filter('acfe/form/load/term_id/form=<?php echo $form_name; ?>', 'my_form_term_values_source', 10, 3);
|
433 |
function my_form_term_values_source($term_id, $form, $action){
|
434 |
|
435 |
-
/**
|
436 |
-
* @int $term_id Term ID used as source
|
437 |
-
* @array $form The form settings
|
438 |
-
* @string $action The action alias name
|
439 |
-
*/
|
440 |
-
|
441 |
-
|
442 |
/**
|
443 |
* Force to load values from the term ID 45
|
444 |
*/
|
@@ -470,17 +468,15 @@ add_filter('acfe/form/submit/term_args/action=my-term-action', 'my_form_term_arg
|
|
470 |
</pre>
|
471 |
<br />
|
472 |
<pre>
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
add_filter('acfe/form/submit/term_args/form=<?php echo $form_name; ?>', 'my_form_term_args', 10, 4);
|
474 |
function my_form_term_args($args, $type, $form, $action){
|
475 |
|
476 |
-
/**
|
477 |
-
* @array $args The generated term arguments
|
478 |
-
* @string $type Action type: 'insert_term' or 'update_term'
|
479 |
-
* @array $form The form settings
|
480 |
-
* @string $action The action alias name
|
481 |
-
*/
|
482 |
-
|
483 |
-
|
484 |
/**
|
485 |
* Force specific description if the action type is 'insert_term'
|
486 |
*/
|
@@ -531,22 +527,17 @@ add_action('acfe/form/submit/term/action=my-term-action', 'my_form_term_save', 1
|
|
531 |
<br />
|
532 |
<pre>
|
533 |
/**
|
534 |
-
*
|
535 |
-
*
|
536 |
-
*
|
|
|
|
|
|
|
|
|
537 |
*/
|
538 |
add_action('acfe/form/submit/term/form=<?php echo $form_name; ?>', 'my_form_term_save', 10, 5);
|
539 |
function my_form_term_save($term_id, $type, $args, $form, $action){
|
540 |
-
|
541 |
-
/**
|
542 |
-
* @int $term_id The targeted term ID
|
543 |
-
* @string $type Action type: 'insert_term' or 'update_term'
|
544 |
-
* @array $args The generated term arguments
|
545 |
-
* @array $form The form settings
|
546 |
-
* @string $action The action alias name
|
547 |
-
*/
|
548 |
-
|
549 |
-
|
550 |
/**
|
551 |
* Get the form input value named 'my_field'
|
552 |
* This is the value entered by the user during the form submission
|
20 |
* Admin
|
21 |
*/
|
22 |
add_filter('acf/prepare_field/name=acfe_form_term_save_meta', array(acfe()->acfe_form, 'map_fields'));
|
23 |
+
add_filter('acf/prepare_field/name=acfe_form_term_load_meta', array(acfe()->acfe_form, 'map_fields'));
|
24 |
|
25 |
+
add_filter('acf/prepare_field/name=acfe_form_term_save_target', array(acfe()->acfe_form, 'map_fields_deep'));
|
26 |
+
add_filter('acf/prepare_field/name=acfe_form_term_load_source', array(acfe()->acfe_form, 'map_fields_deep'));
|
|
|
|
|
|
|
27 |
|
28 |
+
add_filter('acf/prepare_field/name=acfe_form_term_save_name', array(acfe()->acfe_form, 'map_fields_deep'));
|
29 |
+
add_filter('acf/prepare_field/name=acfe_form_term_save_slug', array(acfe()->acfe_form, 'map_fields_deep'));
|
30 |
+
add_filter('acf/prepare_field/name=acfe_form_term_save_taxonomy', array(acfe()->acfe_form, 'map_fields_deep'));
|
31 |
+
add_filter('acf/prepare_field/name=acfe_form_term_save_parent', array(acfe()->acfe_form, 'map_fields_deep'));
|
32 |
+
add_filter('acf/prepare_field/name=acfe_form_term_save_description', array(acfe()->acfe_form, 'map_fields_deep'));
|
33 |
+
|
34 |
+
add_filter('acf/prepare_field/name=acfe_form_term_map_name', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
35 |
+
add_filter('acf/prepare_field/name=acfe_form_term_map_slug', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
36 |
+
add_filter('acf/prepare_field/name=acfe_form_term_map_taxonomy', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
37 |
+
add_filter('acf/prepare_field/name=acfe_form_term_map_parent', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
38 |
+
add_filter('acf/prepare_field/name=acfe_form_term_map_description', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
39 |
+
|
40 |
+
add_filter('acf/prepare_field/name=acfe_form_term_save_target', array($this, 'prepare_choices'), 5);
|
41 |
+
add_filter('acf/prepare_field/name=acfe_form_term_load_source', array($this, 'prepare_choices'), 5);
|
42 |
+
add_filter('acf/prepare_field/name=acfe_form_term_save_parent', array($this, 'prepare_choices'), 5);
|
43 |
+
|
44 |
+
add_action('acf/render_field/name=acfe_form_term_advanced_load', array($this, 'advanced_load'));
|
45 |
+
add_action('acf/render_field/name=acfe_form_term_advanced_save_args', array($this, 'advanced_save_args'));
|
46 |
+
add_action('acf/render_field/name=acfe_form_term_advanced_save', array($this, 'advanced_save'));
|
47 |
|
48 |
}
|
49 |
|
50 |
+
function load($form, $current_post_id, $action){
|
51 |
|
52 |
// Form
|
53 |
$form_name = acf_maybe_get($form, 'form_name');
|
54 |
$form_id = acf_maybe_get($form, 'form_id');
|
|
|
55 |
|
56 |
// Action
|
57 |
$term_action = get_sub_field('acfe_form_term_action');
|
58 |
|
59 |
// Load values
|
60 |
$load_values = get_sub_field('acfe_form_term_load_values');
|
|
|
61 |
$load_meta = get_sub_field('acfe_form_term_load_meta');
|
62 |
|
63 |
// Load values
|
64 |
if(!$load_values)
|
65 |
return $form;
|
66 |
+
|
67 |
+
$_term_id = get_sub_field('acfe_form_term_load_source');
|
68 |
$_name = get_sub_field('acfe_form_term_map_name');
|
69 |
$_slug = get_sub_field('acfe_form_term_map_slug');
|
70 |
$_taxonomy = get_sub_field('acfe_form_term_map_taxonomy');
|
71 |
$_parent = get_sub_field('acfe_form_term_map_parent');
|
72 |
$_description = get_sub_field('acfe_form_term_map_description');
|
73 |
|
74 |
+
// Map {field:name} {get_field:name} {query_var:name}
|
75 |
+
$_term_id = acfe_form_map_field_value_load($_term_id, $current_post_id, $form);
|
76 |
+
$_name = acfe_form_map_field_value_load($_name, $current_post_id, $form);
|
77 |
+
$_slug = acfe_form_map_field_value_load($_slug, $current_post_id, $form);
|
78 |
+
$_taxonomy = acfe_form_map_field_value_load($_taxonomy, $current_post_id, $form);
|
79 |
+
$_parent = acfe_form_map_field_value_load($_parent, $current_post_id, $form);
|
80 |
+
$_description = acfe_form_map_field_value_load($_description, $current_post_id, $form);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
$_term_id = apply_filters('acfe/form/load/term_id', $_term_id, $form, $action);
|
83 |
$_term_id = apply_filters('acfe/form/load/term_id/form=' . $form_name, $_term_id, $form, $action);
|
85 |
if(!empty($action))
|
86 |
$_term_id = apply_filters('acfe/form/load/term_id/action=' . $action, $_term_id, $form, $action);
|
87 |
|
|
|
|
|
|
|
88 |
// Invalid Term ID
|
89 |
if(!$_term_id)
|
90 |
return $form;
|
94 |
|
95 |
$key = array_search($_name, $load_meta);
|
96 |
|
97 |
+
if($key !== false)
|
|
|
98 |
unset($load_meta[$key]);
|
99 |
+
|
100 |
+
$form['map'][$_name]['value'] = get_term_field('name', $_term_id);
|
|
|
101 |
|
102 |
}
|
103 |
|
106 |
|
107 |
$key = array_search($_slug, $load_meta);
|
108 |
|
109 |
+
if($key !== false)
|
|
|
110 |
unset($load_meta[$key]);
|
111 |
+
|
112 |
+
$form['map'][$_slug]['value'] = get_term_field('slug', $_term_id);
|
|
|
113 |
|
114 |
}
|
115 |
|
118 |
|
119 |
$key = array_search($_taxonomy, $load_meta);
|
120 |
|
121 |
+
if($key !== false)
|
|
|
122 |
unset($load_meta[$key]);
|
123 |
+
|
124 |
+
$form['map'][$_taxonomy]['value'] = get_term_field('taxonomy', $_term_id);
|
|
|
125 |
|
126 |
}
|
127 |
|
130 |
|
131 |
$key = array_search($_parent, $load_meta);
|
132 |
|
133 |
+
if($key !== false)
|
|
|
134 |
unset($load_meta[$key]);
|
135 |
+
|
136 |
+
$form['map'][$_parent]['value'] = get_term_field('parent', $_term_id);
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
}
|
139 |
|
142 |
|
143 |
$key = array_search($_description, $load_meta);
|
144 |
|
145 |
+
if($key !== false)
|
|
|
146 |
unset($load_meta[$key]);
|
147 |
+
|
148 |
+
$form['map'][$_description]['value'] = get_term_field('description', $_term_id);
|
|
|
149 |
|
150 |
}
|
151 |
|
166 |
|
167 |
}
|
168 |
|
169 |
+
function prepare($form, $current_post_id, $action){
|
170 |
|
171 |
+
// Form
|
172 |
$form_name = acf_maybe_get($form, 'form_name');
|
173 |
$form_id = acf_maybe_get($form, 'form_id');
|
|
|
174 |
|
175 |
// Action
|
176 |
$term_action = get_sub_field('acfe_form_term_action');
|
177 |
+
|
178 |
+
// Load values
|
179 |
+
$load_values = get_sub_field('acfe_form_term_load_values');
|
180 |
|
181 |
+
// Pre-process
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
$_description_group = get_sub_field('acfe_form_term_save_description_group');
|
183 |
$_description = $_description_group['acfe_form_term_save_description'];
|
184 |
$_description_custom = $_description_group['acfe_form_term_save_description_custom'];
|
185 |
|
186 |
+
if($_description === 'custom')
|
187 |
+
$_description = $_description_custom;
|
188 |
+
|
189 |
+
$map = array();
|
190 |
+
|
191 |
+
if($load_values){
|
192 |
+
|
193 |
+
// Mapping
|
194 |
+
$map = array(
|
195 |
+
'name' => get_sub_field( 'acfe_form_term_map_name' ),
|
196 |
+
'slug' => get_sub_field( 'acfe_form_term_map_slug' ),
|
197 |
+
'taxonomy' => get_sub_field( 'acfe_form_term_map_taxonomy' ),
|
198 |
+
'parent' => get_sub_field( 'acfe_form_term_map_parent' ),
|
199 |
+
'description' => get_sub_field( 'acfe_form_term_map_description' ),
|
200 |
+
);
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
// Fields
|
205 |
+
$fields = array(
|
206 |
+
'target' => get_sub_field('acfe_form_term_save_target'),
|
207 |
+
'name' => get_sub_field('acfe_form_term_save_name'),
|
208 |
+
'slug' => get_sub_field('acfe_form_term_save_slug'),
|
209 |
+
'taxonomy' => get_sub_field('acfe_form_term_save_taxonomy'),
|
210 |
+
'parent' => get_sub_field('acfe_form_term_save_parent'),
|
211 |
+
'description' => $_description,
|
212 |
+
);
|
213 |
+
|
214 |
+
$data = acfe_form_map_vs_fields($map, $fields, $current_post_id, $form);
|
215 |
+
|
216 |
// args
|
217 |
$args = array();
|
218 |
|
219 |
// Insert term
|
220 |
$_term_id = 0;
|
221 |
|
222 |
+
// Update term
|
223 |
if($term_action === 'update_term'){
|
224 |
|
225 |
+
$_term_id = $data['target'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
+
// Invalid Term ID
|
228 |
+
if(!$_term_id)
|
229 |
+
return;
|
230 |
|
231 |
$args['ID'] = $_term_id;
|
232 |
|
233 |
}
|
234 |
|
235 |
// Name
|
236 |
+
if(!empty($data['name'])){
|
237 |
+
|
238 |
+
if(is_array($data['name']))
|
239 |
+
$data['name'] = acfe_array_to_string($data['name']);
|
240 |
|
241 |
+
$args['name'] = $data['name'];
|
|
|
|
|
|
|
|
|
242 |
|
243 |
}
|
244 |
|
245 |
// Slug
|
246 |
+
if(!empty($data['slug'])){
|
247 |
+
|
248 |
+
if(is_array($data['name']))
|
249 |
+
$data['name'] = acfe_array_to_string($data['name']);
|
|
|
250 |
|
251 |
+
$args['slug'] = $data['slug'];
|
252 |
|
253 |
}
|
254 |
|
255 |
// Taxonomy
|
256 |
+
if(!empty($data['taxonomy'])){
|
257 |
+
|
258 |
+
if(is_array($data['name']))
|
259 |
+
$data['name'] = acfe_array_to_string($data['name']);
|
260 |
|
261 |
+
$args['taxonomy'] = $data['taxonomy'];
|
|
|
|
|
|
|
|
|
262 |
|
263 |
}
|
264 |
|
265 |
// Parent
|
266 |
+
if(!empty($data['parent'])){
|
267 |
+
|
268 |
+
if(is_array($data['name']))
|
269 |
+
$data['name'] = acfe_array_to_string($data['name']);
|
270 |
|
271 |
+
$args['parent'] = $data['parent'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
|
273 |
}
|
274 |
|
275 |
// Description
|
276 |
+
if(!empty($data['description'])){
|
277 |
+
|
278 |
+
if(is_array($data['name']))
|
279 |
+
$data['name'] = acfe_array_to_string($data['name']);
|
280 |
|
281 |
+
$args['description'] = $data['description'];
|
|
|
|
|
282 |
|
283 |
}
|
284 |
|
348 |
// Get term array
|
349 |
$term_object = get_term($_term_id, $args['taxonomy'], 'ARRAY_A');
|
350 |
|
351 |
+
$term_object['permalink'] = get_term_link($_term_id, $term_object['taxonomy']);
|
352 |
+
$term_object['admin_url'] = admin_url('term.php?tag_ID=' . $_term_id . '&taxonomy=' . $term_object['taxonomy']);
|
353 |
|
354 |
$term_object = apply_filters('acfe/form/query_var/term', $term_object, $_term_id, $term_action, $args, $form, $action);
|
355 |
$term_object = apply_filters('acfe/form/query_var/term/form=' . $form_name, $term_object, $_term_id, $term_action, $args, $form, $action);
|
366 |
|
367 |
if(!empty($save_meta)){
|
368 |
|
369 |
+
$meta = acfe_form_filter_meta($save_meta, $_POST['acf']);
|
370 |
|
371 |
+
if(!empty($meta)){
|
372 |
|
373 |
// Backup original acf post data
|
374 |
$acf = $_POST['acf'];
|
375 |
|
376 |
// Save meta fields
|
377 |
+
acf_save_post('term_' . $_term_id, $meta);
|
378 |
|
379 |
// Restore original acf post data
|
380 |
$_POST['acf'] = $acf;
|
385 |
|
386 |
}
|
387 |
|
388 |
+
/**
|
389 |
+
* Term: Select2 Choices
|
390 |
+
*/
|
391 |
+
function prepare_choices($field){
|
392 |
+
|
393 |
+
$field['choices']['current_term'] = 'Current: Term';
|
394 |
+
$field['choices']['current_term_parent'] = 'Current: Term Parent';
|
395 |
+
|
396 |
+
if(acf_maybe_get($field, 'value')){
|
397 |
+
|
398 |
+
$value = $field['value'];
|
399 |
+
|
400 |
+
if(is_array($value))
|
401 |
+
$value = $value[0];
|
402 |
+
|
403 |
+
$term = get_term($value);
|
404 |
+
|
405 |
+
if($term){
|
406 |
+
|
407 |
+
$field['choices'][$term->term_id] = $term->name;
|
408 |
+
|
409 |
+
}
|
410 |
+
|
411 |
+
}
|
412 |
+
|
413 |
+
return $field;
|
414 |
+
|
415 |
+
}
|
416 |
+
|
417 |
function advanced_load($field){
|
418 |
|
419 |
$form_name = 'my_form';
|
429 |
</pre>
|
430 |
<br />
|
431 |
<pre>
|
432 |
+
/**
|
433 |
+
* @int $term_id Term ID used as source
|
434 |
+
* @array $form The form settings
|
435 |
+
* @string $action The action alias name
|
436 |
+
*/
|
437 |
add_filter('acfe/form/load/term_id/form=<?php echo $form_name; ?>', 'my_form_term_values_source', 10, 3);
|
438 |
function my_form_term_values_source($term_id, $form, $action){
|
439 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
/**
|
441 |
* Force to load values from the term ID 45
|
442 |
*/
|
468 |
</pre>
|
469 |
<br />
|
470 |
<pre>
|
471 |
+
/**
|
472 |
+
* @array $args The generated term arguments
|
473 |
+
* @string $type Action type: 'insert_term' or 'update_term'
|
474 |
+
* @array $form The form settings
|
475 |
+
* @string $action The action alias name
|
476 |
+
*/
|
477 |
add_filter('acfe/form/submit/term_args/form=<?php echo $form_name; ?>', 'my_form_term_args', 10, 4);
|
478 |
function my_form_term_args($args, $type, $form, $action){
|
479 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
/**
|
481 |
* Force specific description if the action type is 'insert_term'
|
482 |
*/
|
527 |
<br />
|
528 |
<pre>
|
529 |
/**
|
530 |
+
* @int $term_id The targeted term ID
|
531 |
+
* @string $type Action type: 'insert_term' or 'update_term'
|
532 |
+
* @array $args The generated term arguments
|
533 |
+
* @array $form The form settings
|
534 |
+
* @string $action The action alias name
|
535 |
+
*
|
536 |
+
* Note: At this point the term is already saved into the database
|
537 |
*/
|
538 |
add_action('acfe/form/submit/term/form=<?php echo $form_name; ?>', 'my_form_term_save', 10, 5);
|
539 |
function my_form_term_save($term_id, $type, $args, $form, $action){
|
540 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
/**
|
542 |
* Get the form input value named 'my_field'
|
543 |
* This is the value entered by the user during the form submission
|
includes/modules/form/actions/user.php
CHANGED
@@ -12,51 +12,77 @@ class acfe_form_user{
|
|
12 |
/*
|
13 |
* Form
|
14 |
*/
|
15 |
-
add_filter('acfe/form/load/user', array($this, 'load'),
|
16 |
-
add_action('acfe/form/
|
17 |
-
add_action('acfe/form/
|
|
|
18 |
|
19 |
/*
|
20 |
* Admin
|
21 |
*/
|
22 |
add_filter('acf/prepare_field/name=acfe_form_user_save_meta', array(acfe()->acfe_form, 'map_fields'));
|
23 |
-
add_filter('acf/prepare_field/name=acfe_form_user_load_meta', array(acfe()->acfe_form, '
|
24 |
-
|
25 |
-
add_filter('acf/prepare_field/name=
|
26 |
-
add_filter('acf/prepare_field/name=
|
27 |
-
add_filter('acf/prepare_field/name=
|
28 |
-
|
29 |
-
add_filter('acf/prepare_field/name=
|
30 |
-
add_filter('acf/prepare_field/name=
|
31 |
-
|
32 |
-
add_filter('acf/prepare_field/name=
|
33 |
-
add_filter('acf/prepare_field/name=
|
34 |
-
add_filter('acf/prepare_field/name=
|
35 |
-
|
36 |
-
add_filter('acf/
|
37 |
-
add_filter('acf/
|
38 |
-
add_filter('acf/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
}
|
41 |
|
42 |
-
function load($form, $
|
43 |
|
|
|
44 |
$form_name = acf_maybe_get($form, 'form_name');
|
45 |
$form_id = acf_maybe_get($form, 'form_id');
|
46 |
-
$post_info = acf_get_post_id_info($post_id);
|
47 |
|
48 |
// Action
|
49 |
$user_action = get_sub_field('acfe_form_user_action');
|
|
|
|
|
|
|
|
|
50 |
|
51 |
// Load values
|
52 |
$load_values = get_sub_field('acfe_form_user_load_values');
|
53 |
-
$load_source = get_sub_field('acfe_form_user_load_source');
|
54 |
$load_meta = get_sub_field('acfe_form_user_load_meta');
|
55 |
|
56 |
// Load values
|
57 |
if(!$load_values)
|
58 |
return $form;
|
59 |
-
|
|
|
60 |
$_email = get_sub_field('acfe_form_user_map_email');
|
61 |
$_username = get_sub_field('acfe_form_user_map_username');
|
62 |
$_password = get_sub_field('acfe_form_user_map_password');
|
@@ -68,23 +94,18 @@ class acfe_form_user{
|
|
68 |
$_description = get_sub_field('acfe_form_user_map_description');
|
69 |
$_role = get_sub_field('acfe_form_user_map_role');
|
70 |
|
71 |
-
//
|
72 |
-
$_user_id = $
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
if($post_info['type'] === 'post')
|
85 |
-
$_user_id = get_post_field('post_author', $post_id);
|
86 |
-
|
87 |
-
}
|
88 |
|
89 |
$_user_id = apply_filters('acfe/form/load/user_id', $_user_id, $form, $action);
|
90 |
$_user_id = apply_filters('acfe/form/load/user_id/form=' . $form_name, $_user_id, $form, $action);
|
@@ -92,9 +113,6 @@ class acfe_form_user{
|
|
92 |
if(!empty($action))
|
93 |
$_user_id = apply_filters('acfe/form/load/user_id/action=' . $action, $_user_id, $form, $action);
|
94 |
|
95 |
-
// Query Var
|
96 |
-
$_user_id = acfe_form_map_query_var($_user_id);
|
97 |
-
|
98 |
// Invalid User ID
|
99 |
if(!$_user_id)
|
100 |
return $form;
|
@@ -110,12 +128,10 @@ class acfe_form_user{
|
|
110 |
|
111 |
$key = array_search($_email, $load_meta);
|
112 |
|
113 |
-
if($key !== false)
|
114 |
-
|
115 |
unset($load_meta[$key]);
|
116 |
-
|
117 |
-
|
118 |
-
}
|
119 |
|
120 |
}
|
121 |
|
@@ -124,13 +140,11 @@ class acfe_form_user{
|
|
124 |
|
125 |
$key = array_search($_username, $load_meta);
|
126 |
|
127 |
-
if($key !== false)
|
128 |
-
|
129 |
unset($load_meta[$key]);
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
}
|
134 |
|
135 |
}
|
136 |
|
@@ -139,12 +153,10 @@ class acfe_form_user{
|
|
139 |
|
140 |
$key = array_search($_password, $load_meta);
|
141 |
|
142 |
-
if($key !== false)
|
143 |
-
|
144 |
unset($load_meta[$key]);
|
145 |
-
|
146 |
-
|
147 |
-
}
|
148 |
|
149 |
}
|
150 |
|
@@ -153,12 +165,10 @@ class acfe_form_user{
|
|
153 |
|
154 |
$key = array_search($_first_name, $load_meta);
|
155 |
|
156 |
-
if($key !== false)
|
157 |
-
|
158 |
unset($load_meta[$key]);
|
159 |
-
|
160 |
-
|
161 |
-
}
|
162 |
|
163 |
}
|
164 |
|
@@ -167,12 +177,10 @@ class acfe_form_user{
|
|
167 |
|
168 |
$key = array_search($_last_name, $load_meta);
|
169 |
|
170 |
-
if($key !== false)
|
171 |
-
|
172 |
unset($load_meta[$key]);
|
173 |
-
|
174 |
-
|
175 |
-
}
|
176 |
|
177 |
}
|
178 |
|
@@ -181,12 +189,10 @@ class acfe_form_user{
|
|
181 |
|
182 |
$key = array_search($_nickname, $load_meta);
|
183 |
|
184 |
-
if($key !== false)
|
185 |
-
|
186 |
unset($load_meta[$key]);
|
187 |
-
|
188 |
-
|
189 |
-
}
|
190 |
|
191 |
}
|
192 |
|
@@ -195,12 +201,10 @@ class acfe_form_user{
|
|
195 |
|
196 |
$key = array_search($_display_name, $load_meta);
|
197 |
|
198 |
-
if($key !== false)
|
199 |
-
|
200 |
unset($load_meta[$key]);
|
201 |
-
|
202 |
-
|
203 |
-
}
|
204 |
|
205 |
}
|
206 |
|
@@ -209,12 +213,10 @@ class acfe_form_user{
|
|
209 |
|
210 |
$key = array_search($_website, $load_meta);
|
211 |
|
212 |
-
if($key !== false)
|
213 |
-
|
214 |
unset($load_meta[$key]);
|
215 |
-
|
216 |
-
|
217 |
-
}
|
218 |
|
219 |
}
|
220 |
|
@@ -223,12 +225,10 @@ class acfe_form_user{
|
|
223 |
|
224 |
$key = array_search($_description, $load_meta);
|
225 |
|
226 |
-
if($key !== false)
|
227 |
-
|
228 |
unset($load_meta[$key]);
|
229 |
-
|
230 |
-
|
231 |
-
}
|
232 |
|
233 |
}
|
234 |
|
@@ -237,12 +237,10 @@ class acfe_form_user{
|
|
237 |
|
238 |
$key = array_search($_role, $load_meta);
|
239 |
|
240 |
-
if($key !== false)
|
241 |
-
|
242 |
unset($load_meta[$key]);
|
243 |
-
|
244 |
-
|
245 |
-
}
|
246 |
|
247 |
}
|
248 |
|
@@ -263,317 +261,506 @@ class acfe_form_user{
|
|
263 |
|
264 |
}
|
265 |
|
266 |
-
function
|
267 |
-
|
268 |
-
$form_name = acf_maybe_get($form, 'form_name');
|
269 |
-
$form_id = acf_maybe_get($form, 'form_id');
|
270 |
-
$post_info = acf_get_post_id_info($post_id);
|
271 |
|
272 |
// Action
|
273 |
$user_action = get_sub_field('acfe_form_user_action');
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
'user_email' => get_sub_field('acfe_form_user_map_email'),
|
278 |
-
'user_login' => get_sub_field('acfe_form_user_map_username'),
|
279 |
-
'user_pass' => get_sub_field('acfe_form_user_map_password'),
|
280 |
-
'first_name' => get_sub_field('acfe_form_user_map_first_name'),
|
281 |
-
'last_name' => get_sub_field('acfe_form_user_map_last_name'),
|
282 |
-
'nickname' => get_sub_field('acfe_form_user_map_nickname'),
|
283 |
-
'display_name' => get_sub_field('acfe_form_user_map_display_name'),
|
284 |
-
'user_url' => get_sub_field('acfe_form_user_map_website'),
|
285 |
-
'description' => get_sub_field('acfe_form_user_map_description'),
|
286 |
-
'role' => get_sub_field('acfe_form_user_map_role'),
|
287 |
-
);
|
288 |
|
|
|
|
|
|
|
|
|
289 |
// Fields
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
$_user_pass = $_user_pass_group['acfe_form_user_save_password'];
|
302 |
-
$_user_pass_custom = $_user_pass_group['acfe_form_user_save_password_custom'];
|
303 |
-
|
304 |
-
$_first_name_group = get_sub_field('acfe_form_user_save_first_name_group');
|
305 |
-
$_first_name = $_first_name_group['acfe_form_user_save_first_name'];
|
306 |
-
$_first_name_custom = $_first_name_group['acfe_form_user_save_first_name_custom'];
|
307 |
-
|
308 |
-
$_last_name_group = get_sub_field('acfe_form_user_save_last_name_group');
|
309 |
-
$_last_name = $_last_name_group['acfe_form_user_save_last_name'];
|
310 |
-
$_last_name_custom = $_last_name_group['acfe_form_user_save_last_name_custom'];
|
311 |
-
|
312 |
-
$_nickname_group = get_sub_field('acfe_form_user_save_nickname_group');
|
313 |
-
$_nickname = $_nickname_group['acfe_form_user_save_nickname'];
|
314 |
-
$_nickname_custom = $_nickname_group['acfe_form_user_save_nickname_custom'];
|
315 |
-
|
316 |
-
$_display_name_group = get_sub_field('acfe_form_user_save_display_name_group');
|
317 |
-
$_display_name = $_display_name_group['acfe_form_user_save_display_name'];
|
318 |
-
$_display_name_custom = $_display_name_group['acfe_form_user_save_display_name_custom'];
|
319 |
-
|
320 |
-
$_user_url_group = get_sub_field('acfe_form_user_save_website_group');
|
321 |
-
$_user_url = $_user_url_group['acfe_form_user_save_website'];
|
322 |
-
$_user_url_custom = $_user_url_group['acfe_form_user_save_website_custom'];
|
323 |
-
|
324 |
-
$_description_group = get_sub_field('acfe_form_user_save_description_group');
|
325 |
-
$_description = $_description_group['acfe_form_user_save_description'];
|
326 |
-
$_description_custom = $_description_group['acfe_form_user_save_description_custom'];
|
327 |
-
|
328 |
-
$_role = get_sub_field('acfe_form_user_save_role');
|
329 |
-
|
330 |
-
// args
|
331 |
-
$args = array();
|
332 |
-
|
333 |
-
// Insert user
|
334 |
-
$_user_id = 0;
|
335 |
|
336 |
-
//
|
337 |
-
if($
|
338 |
-
|
339 |
-
// Custom User ID
|
340 |
-
$_user_id = $_target;
|
341 |
-
|
342 |
-
// Current User
|
343 |
-
if($_target === 'current_user'){
|
344 |
-
|
345 |
-
$_user_id = get_current_user_id();
|
346 |
-
|
347 |
-
}
|
348 |
-
|
349 |
-
// Current Post Author
|
350 |
-
elseif($_target === 'current_post_author'){
|
351 |
-
|
352 |
-
if($post_info['type'] === 'post')
|
353 |
-
$_user_id = get_post_field('post_author', $post_info['id']);
|
354 |
-
|
355 |
-
// Invalid User ID
|
356 |
-
if(!$_user_id)
|
357 |
-
return;
|
358 |
-
|
359 |
-
}
|
360 |
|
361 |
-
|
362 |
-
$args['ID'] = $_user_id;
|
363 |
|
364 |
}
|
365 |
|
366 |
-
//
|
367 |
-
if(!empty($
|
368 |
-
|
369 |
-
$args['user_email'] = acfe_form_map_field_value($map['user_email'], $_POST['acf'], $_user_id);
|
370 |
-
|
371 |
-
}elseif($_user_email === 'custom'){
|
372 |
|
373 |
-
$
|
374 |
|
375 |
}
|
376 |
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
$args['user_login'] = acfe_form_map_field_value($map['user_login'], $_POST['acf'], $_user_id);
|
381 |
-
|
382 |
-
}elseif($_user_login === 'custom'){
|
383 |
|
384 |
-
|
|
|
385 |
|
386 |
}
|
387 |
|
388 |
-
//
|
389 |
-
if(
|
390 |
-
|
391 |
-
$args['user_pass'] = acfe_form_map_field_value($map['user_pass'], $_POST['acf'], $_user_id);
|
392 |
-
|
393 |
-
}elseif($_user_pass === 'generate_password'){
|
394 |
-
|
395 |
-
$args['user_pass'] = wp_generate_password(8, false);
|
396 |
-
|
397 |
-
}elseif($_user_pass === 'custom'){
|
398 |
|
399 |
-
$
|
400 |
|
401 |
}
|
402 |
|
403 |
-
//
|
404 |
-
|
405 |
-
|
406 |
-
$args['first_name'] = acfe_form_map_field_value($map['first_name'], $_POST['acf'], $_user_id);
|
407 |
-
|
408 |
-
}elseif($_first_name === 'custom'){
|
409 |
|
410 |
-
$
|
411 |
|
412 |
}
|
413 |
|
414 |
-
//
|
415 |
-
|
416 |
|
417 |
-
|
418 |
-
|
419 |
-
|
|
|
420 |
|
421 |
-
|
|
|
|
|
|
|
|
|
|
|
422 |
|
423 |
}
|
424 |
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
}elseif($_nickname === 'custom'){
|
431 |
|
432 |
-
$
|
433 |
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
|
|
|
|
438 |
|
439 |
-
$
|
440 |
|
441 |
-
|
|
|
|
|
|
|
|
|
|
|
442 |
|
443 |
-
|
444 |
|
445 |
-
|
446 |
-
|
447 |
-
// Website
|
448 |
-
if(!empty($map['user_url'])){
|
449 |
|
450 |
-
|
|
|
|
|
|
|
|
|
|
|
451 |
|
452 |
-
|
453 |
|
454 |
-
|
|
|
|
|
|
|
|
|
|
|
455 |
|
456 |
}
|
457 |
|
458 |
-
|
459 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
|
461 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
|
463 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
|
465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
|
|
|
|
|
|
|
|
|
|
471 |
|
472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
|
474 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
|
476 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
if($user_action === 'insert_user'){
|
488 |
|
489 |
-
|
|
|
|
|
|
|
|
|
490 |
|
491 |
-
$args =
|
492 |
|
493 |
}
|
494 |
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
|
|
|
|
502 |
|
503 |
-
$
|
|
|
504 |
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
|
|
509 |
|
510 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
|
512 |
-
|
|
|
|
|
|
|
|
|
|
|
513 |
|
514 |
-
|
|
|
515 |
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
$
|
521 |
-
|
522 |
-
// Filter
|
523 |
-
$pre_user_login = apply_filters('pre_user_login', $sanitized_user_login);
|
524 |
-
|
525 |
-
// Trim
|
526 |
-
$user_login = trim($pre_user_login);
|
527 |
-
|
528 |
-
$error = false;
|
529 |
|
530 |
-
|
|
|
531 |
|
532 |
-
|
|
|
533 |
|
534 |
-
|
|
|
535 |
|
536 |
-
|
|
|
537 |
|
538 |
-
|
539 |
-
|
540 |
-
if(username_exists($user_login)){
|
541 |
|
542 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
543 |
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
|
550 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
|
552 |
}
|
553 |
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
'user_login' => $user_login,
|
565 |
-
'user_nicename' => $user_nicename,
|
566 |
-
),
|
567 |
-
array(
|
568 |
-
'ID' => $_user_id
|
569 |
-
)
|
570 |
-
);
|
571 |
|
572 |
-
|
573 |
|
574 |
}
|
575 |
|
576 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
|
578 |
}
|
579 |
|
@@ -605,16 +792,38 @@ class acfe_form_user{
|
|
605 |
$form_name = acf_maybe_get($form, 'form_name');
|
606 |
|
607 |
// Get user array
|
608 |
-
$user_object =
|
609 |
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
616 |
|
617 |
-
|
618 |
|
619 |
}
|
620 |
|
@@ -625,15 +834,15 @@ class acfe_form_user{
|
|
625 |
|
626 |
if(!empty($save_meta)){
|
627 |
|
628 |
-
$
|
629 |
|
630 |
-
if(!empty($
|
631 |
|
632 |
// Backup original acf post data
|
633 |
$acf = $_POST['acf'];
|
634 |
|
635 |
// Save meta fields
|
636 |
-
acf_save_post('user_' . $_user_id, $
|
637 |
|
638 |
// Restore original acf post data
|
639 |
$_POST['acf'] = $acf;
|
@@ -644,6 +853,41 @@ class acfe_form_user{
|
|
644 |
|
645 |
}
|
646 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
647 |
function advanced_load($field){
|
648 |
|
649 |
$form_name = 'my_form';
|
@@ -659,16 +903,14 @@ add_filter('acfe/form/load/user_id/action=my-user-action', 'my_form_user_values_
|
|
659 |
</pre>
|
660 |
<br />
|
661 |
<pre>
|
|
|
|
|
|
|
|
|
|
|
662 |
add_filter('acfe/form/load/user_id/form=<?php echo $form_name; ?>', 'my_form_user_values_source', 10, 3);
|
663 |
function my_form_user_values_source($user_id, $form, $action){
|
664 |
|
665 |
-
/**
|
666 |
-
* @int $user_id User ID used as source
|
667 |
-
* @array $form The form settings
|
668 |
-
* @string $action The action alias name
|
669 |
-
*/
|
670 |
-
|
671 |
-
|
672 |
/**
|
673 |
* Force to load values from the user ID 12
|
674 |
*/
|
@@ -700,17 +942,15 @@ add_filter('acfe/form/submit/user_args/action=my-user-action', 'my_form_user_arg
|
|
700 |
</pre>
|
701 |
<br />
|
702 |
<pre>
|
|
|
|
|
|
|
|
|
|
|
|
|
703 |
add_filter('acfe/form/submit/user_args/form=<?php echo $form_name; ?>', 'my_form_user_args', 10, 4);
|
704 |
function my_form_user_args($args, $type, $form, $action){
|
705 |
|
706 |
-
/**
|
707 |
-
* @array $args The generated user arguments
|
708 |
-
* @string $type Action type: 'insert_user' or 'update_user'
|
709 |
-
* @array $form The form settings
|
710 |
-
* @string $action The action alias name
|
711 |
-
*/
|
712 |
-
|
713 |
-
|
714 |
/**
|
715 |
* Force specific first name if the action type is 'insert_user'
|
716 |
*/
|
@@ -761,19 +1001,17 @@ add_action('acfe/form/submit/user/action=my-user-action', 'my_form_user_save', 1
|
|
761 |
<br />
|
762 |
<pre>
|
763 |
/**
|
764 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
765 |
*/
|
766 |
-
add_action('acfe/form/submit/user/
|
767 |
function my_form_user_save($user_id, $type, $args, $form, $action){
|
768 |
|
769 |
-
/**
|
770 |
-
* @int $user_id The targeted user ID
|
771 |
-
* @string $type Action type: 'insert_user' or 'update_user'
|
772 |
-
* @array $args The generated user arguments
|
773 |
-
* @array $form The form settings
|
774 |
-
* @string $action The action alias name
|
775 |
-
*/
|
776 |
-
|
777 |
/**
|
778 |
* Get the form input value named 'my_field'
|
779 |
* This is the value entered by the user during the form submission
|
12 |
/*
|
13 |
* Form
|
14 |
*/
|
15 |
+
add_filter('acfe/form/load/user', array($this, 'load'), 1, 3);
|
16 |
+
add_action('acfe/form/validation/user', array($this, 'validation'), 1, 3);
|
17 |
+
add_action('acfe/form/prepare/user', array($this, 'prepare'), 1, 3);
|
18 |
+
add_action('acfe/form/submit/user', array($this, 'submit'), 1, 5);
|
19 |
|
20 |
/*
|
21 |
* Admin
|
22 |
*/
|
23 |
add_filter('acf/prepare_field/name=acfe_form_user_save_meta', array(acfe()->acfe_form, 'map_fields'));
|
24 |
+
add_filter('acf/prepare_field/name=acfe_form_user_load_meta', array(acfe()->acfe_form, 'map_fields'));
|
25 |
+
|
26 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_login_user', array(acfe()->acfe_form, 'map_fields_deep'));
|
27 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_login_pass', array(acfe()->acfe_form, 'map_fields_deep'));
|
28 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_login_remember', array(acfe()->acfe_form, 'map_fields_deep'));
|
29 |
+
|
30 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_target', array(acfe()->acfe_form, 'map_fields_deep'));
|
31 |
+
add_filter('acf/prepare_field/name=acfe_form_user_load_source', array(acfe()->acfe_form, 'map_fields_deep'));
|
32 |
+
|
33 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_email', array(acfe()->acfe_form, 'map_fields_deep'));
|
34 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_username', array(acfe()->acfe_form, 'map_fields_deep'));
|
35 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_password', array(acfe()->acfe_form, 'map_fields_deep'));
|
36 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_first_name', array(acfe()->acfe_form, 'map_fields_deep'));
|
37 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_last_name', array(acfe()->acfe_form, 'map_fields_deep'));
|
38 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_nickname', array(acfe()->acfe_form, 'map_fields_deep'));
|
39 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_display_name', array(acfe()->acfe_form, 'map_fields_deep'));
|
40 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_website', array(acfe()->acfe_form, 'map_fields_deep'));
|
41 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_description', array(acfe()->acfe_form, 'map_fields_deep'));
|
42 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_role', array(acfe()->acfe_form, 'map_fields_deep'));
|
43 |
+
|
44 |
+
add_filter('acf/prepare_field/name=acfe_form_user_map_email', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
45 |
+
add_filter('acf/prepare_field/name=acfe_form_user_map_username', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
46 |
+
add_filter('acf/prepare_field/name=acfe_form_user_map_password', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
47 |
+
add_filter('acf/prepare_field/name=acfe_form_user_map_first_name', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
48 |
+
add_filter('acf/prepare_field/name=acfe_form_user_map_last_name', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
49 |
+
add_filter('acf/prepare_field/name=acfe_form_user_map_nickname', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
50 |
+
add_filter('acf/prepare_field/name=acfe_form_user_map_display_name', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
51 |
+
add_filter('acf/prepare_field/name=acfe_form_user_map_website', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
52 |
+
add_filter('acf/prepare_field/name=acfe_form_user_map_description', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
53 |
+
add_filter('acf/prepare_field/name=acfe_form_user_map_role', array(acfe()->acfe_form, 'map_fields_deep_no_custom'));
|
54 |
+
|
55 |
+
add_filter('acf/prepare_field/name=acfe_form_user_save_target', array($this, 'prepare_choices'), 5);
|
56 |
+
add_filter('acf/prepare_field/name=acfe_form_user_load_source', array($this, 'prepare_choices'), 5);
|
57 |
+
|
58 |
+
add_action('acf/render_field/name=acfe_form_user_advanced_load', array($this, 'advanced_load'));
|
59 |
+
add_action('acf/render_field/name=acfe_form_user_advanced_save_args', array($this, 'advanced_save_args'));
|
60 |
+
add_action('acf/render_field/name=acfe_form_user_advanced_save', array($this, 'advanced_save'));
|
61 |
|
62 |
}
|
63 |
|
64 |
+
function load($form, $current_post_id, $action){
|
65 |
|
66 |
+
// Form
|
67 |
$form_name = acf_maybe_get($form, 'form_name');
|
68 |
$form_id = acf_maybe_get($form, 'form_id');
|
|
|
69 |
|
70 |
// Action
|
71 |
$user_action = get_sub_field('acfe_form_user_action');
|
72 |
+
|
73 |
+
// Bail early if Log user
|
74 |
+
if($user_action === 'log_user')
|
75 |
+
return $form;
|
76 |
|
77 |
// Load values
|
78 |
$load_values = get_sub_field('acfe_form_user_load_values');
|
|
|
79 |
$load_meta = get_sub_field('acfe_form_user_load_meta');
|
80 |
|
81 |
// Load values
|
82 |
if(!$load_values)
|
83 |
return $form;
|
84 |
+
|
85 |
+
$_user_id = get_sub_field('acfe_form_user_load_source');
|
86 |
$_email = get_sub_field('acfe_form_user_map_email');
|
87 |
$_username = get_sub_field('acfe_form_user_map_username');
|
88 |
$_password = get_sub_field('acfe_form_user_map_password');
|
94 |
$_description = get_sub_field('acfe_form_user_map_description');
|
95 |
$_role = get_sub_field('acfe_form_user_map_role');
|
96 |
|
97 |
+
// Map {field:name} {get_field:name} {query_var:name}
|
98 |
+
$_user_id = acfe_form_map_field_value_load($_user_id, $current_post_id, $form);
|
99 |
+
$_email = acfe_form_map_field_value_load($_email, $current_post_id, $form);
|
100 |
+
$_username = acfe_form_map_field_value_load($_username, $current_post_id, $form);
|
101 |
+
$_password = acfe_form_map_field_value_load($_password, $current_post_id, $form);
|
102 |
+
$_first_name = acfe_form_map_field_value_load($_first_name, $current_post_id, $form);
|
103 |
+
$_last_name = acfe_form_map_field_value_load($_last_name, $current_post_id, $form);
|
104 |
+
$_nickname = acfe_form_map_field_value_load($_nickname, $current_post_id, $form);
|
105 |
+
$_display_name = acfe_form_map_field_value_load($_display_name, $current_post_id, $form);
|
106 |
+
$_website = acfe_form_map_field_value_load($_website, $current_post_id, $form);
|
107 |
+
$_description = acfe_form_map_field_value_load($_description, $current_post_id, $form);
|
108 |
+
$_role = acfe_form_map_field_value_load($_role, $current_post_id, $form);
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
$_user_id = apply_filters('acfe/form/load/user_id', $_user_id, $form, $action);
|
111 |
$_user_id = apply_filters('acfe/form/load/user_id/form=' . $form_name, $_user_id, $form, $action);
|
113 |
if(!empty($action))
|
114 |
$_user_id = apply_filters('acfe/form/load/user_id/action=' . $action, $_user_id, $form, $action);
|
115 |
|
|
|
|
|
|
|
116 |
// Invalid User ID
|
117 |
if(!$_user_id)
|
118 |
return $form;
|
128 |
|
129 |
$key = array_search($_email, $load_meta);
|
130 |
|
131 |
+
if($key !== false)
|
|
|
132 |
unset($load_meta[$key]);
|
133 |
+
|
134 |
+
$form['map'][$_email]['value'] = $user_data->user_email;
|
|
|
135 |
|
136 |
}
|
137 |
|
140 |
|
141 |
$key = array_search($_username, $load_meta);
|
142 |
|
143 |
+
if($key !== false)
|
|
|
144 |
unset($load_meta[$key]);
|
145 |
+
|
146 |
+
$form['map'][$_username]['value'] = $user_data->user_login;
|
147 |
+
$form['map'][$_username]['maxlength'] = 60;
|
|
|
148 |
|
149 |
}
|
150 |
|
153 |
|
154 |
$key = array_search($_password, $load_meta);
|
155 |
|
156 |
+
if($key !== false)
|
|
|
157 |
unset($load_meta[$key]);
|
158 |
+
|
159 |
+
//$form['map'][$_password]['value'] = $user_data->user_pass;
|
|
|
160 |
|
161 |
}
|
162 |
|
165 |
|
166 |
$key = array_search($_first_name, $load_meta);
|
167 |
|
168 |
+
if($key !== false)
|
|
|
169 |
unset($load_meta[$key]);
|
170 |
+
|
171 |
+
$form['map'][$_first_name]['value'] = $user_data->first_name;
|
|
|
172 |
|
173 |
}
|
174 |
|
177 |
|
178 |
$key = array_search($_last_name, $load_meta);
|
179 |
|
180 |
+
if($key !== false)
|
|
|
181 |
unset($load_meta[$key]);
|
182 |
+
|
183 |
+
$form['map'][$_last_name]['value'] = $user_data->last_name;
|
|
|
184 |
|
185 |
}
|
186 |
|
189 |
|
190 |
$key = array_search($_nickname, $load_meta);
|
191 |
|
192 |
+
if($key !== false)
|
|
|
193 |
unset($load_meta[$key]);
|
194 |
+
|
195 |
+
$form['map'][$_nickname]['value'] = $user_data->nickname;
|
|
|
196 |
|
197 |
}
|
198 |
|
201 |
|
202 |
$key = array_search($_display_name, $load_meta);
|
203 |
|
204 |
+
if($key !== false)
|
|
|
205 |
unset($load_meta[$key]);
|
206 |
+
|
207 |
+
$form['map'][$_display_name]['value'] = $user_data->display_name;
|
|
|
208 |
|
209 |
}
|
210 |
|
213 |
|
214 |
$key = array_search($_website, $load_meta);
|
215 |
|
216 |
+
if($key !== false)
|
|
|
217 |
unset($load_meta[$key]);
|
218 |
+
|
219 |
+
$form['map'][$_website]['value'] = $user_data->website;
|
|
|
220 |
|
221 |
}
|
222 |
|
225 |
|
226 |
$key = array_search($_description, $load_meta);
|
227 |
|
228 |
+
if($key !== false)
|
|
|
229 |
unset($load_meta[$key]);
|
230 |
+
|
231 |
+
$form['map'][$_description]['value'] = $user_data->description;
|
|
|
232 |
|
233 |
}
|
234 |
|
237 |
|
238 |
$key = array_search($_role, $load_meta);
|
239 |
|
240 |
+
if($key !== false)
|
|
|
241 |
unset($load_meta[$key]);
|
242 |
+
|
243 |
+
$form['map'][$_role]['value'] = implode(', ', $user_data->roles);
|
|
|
244 |
|
245 |
}
|
246 |
|
261 |
|
262 |
}
|
263 |
|
264 |
+
function validation($form, $current_post_id, $action){
|
|
|
|
|
|
|
|
|
265 |
|
266 |
// Action
|
267 |
$user_action = get_sub_field('acfe_form_user_action');
|
268 |
|
269 |
+
if($user_action !== 'log_user')
|
270 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
|
272 |
+
// Form
|
273 |
+
$form_name = acf_maybe_get($form, 'form_name');
|
274 |
+
$form_id = acf_maybe_get($form, 'form_id');
|
275 |
+
|
276 |
// Fields
|
277 |
+
$data = array(
|
278 |
+
'type' => get_sub_field('acfe_form_user_log_type'),
|
279 |
+
'login' => get_sub_field('acfe_form_user_save_login_user'),
|
280 |
+
'pass' => get_sub_field('acfe_form_user_save_login_pass'),
|
281 |
+
);
|
282 |
+
|
283 |
+
$data['login'] = acfe_form_map_field_value($data['login'], $current_post_id, $form);
|
284 |
+
$data['pass'] = acfe_form_map_field_value($data['pass'], $current_post_id, $form);
|
285 |
+
|
286 |
+
$login = false;
|
287 |
+
$pass = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
|
289 |
+
// Email
|
290 |
+
if(!empty($data['login'])){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
|
292 |
+
$login = $data['login'];
|
|
|
293 |
|
294 |
}
|
295 |
|
296 |
+
// Password
|
297 |
+
if(!empty($data['pass'])){
|
|
|
|
|
|
|
|
|
298 |
|
299 |
+
$pass = $data['pass'];
|
300 |
|
301 |
}
|
302 |
|
303 |
+
$pass = wp_specialchars_decode($pass);
|
304 |
+
|
305 |
+
if(empty($login) || empty($pass)){
|
|
|
|
|
|
|
306 |
|
307 |
+
acfe_add_validation_error('', 'An error has occured. Please try again');
|
308 |
+
return;
|
309 |
|
310 |
}
|
311 |
|
312 |
+
// Email
|
313 |
+
if($data['type'] === 'email'){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
|
315 |
+
$this->validate_user_login('email', $login, $pass);
|
316 |
|
317 |
}
|
318 |
|
319 |
+
// Username
|
320 |
+
elseif($data['type'] === 'username'){
|
|
|
|
|
|
|
|
|
321 |
|
322 |
+
$this->validate_user_login('username', $login, $pass);
|
323 |
|
324 |
}
|
325 |
|
326 |
+
// Email || Username
|
327 |
+
elseif($data['type'] === 'email_username'){
|
328 |
|
329 |
+
// Email
|
330 |
+
if(is_email($login)){
|
331 |
+
|
332 |
+
$this->validate_user_login('email', $login, $pass);
|
333 |
|
334 |
+
// Username
|
335 |
+
}else{
|
336 |
+
|
337 |
+
$this->validate_user_login('username', $login, $pass);
|
338 |
+
|
339 |
+
}
|
340 |
|
341 |
}
|
342 |
|
343 |
+
}
|
344 |
+
|
345 |
+
function validate_user_login($type = 'email', $login, $pass){
|
346 |
+
|
347 |
+
if($type === 'email'){
|
|
|
348 |
|
349 |
+
$login = sanitize_email($login);
|
350 |
|
351 |
+
if(empty($login) || !is_email($login)){
|
352 |
+
|
353 |
+
acfe_add_validation_error('', 'Invalid e-mail');
|
354 |
+
return;
|
355 |
+
|
356 |
+
}
|
357 |
|
358 |
+
$user = get_user_by('email', $login);
|
359 |
|
360 |
+
if(!$user || !wp_check_password($pass, $user->data->user_pass, $user->ID)){
|
361 |
+
|
362 |
+
acfe_add_validation_error('', 'Invalid e-mail or password');
|
363 |
+
return;
|
364 |
+
|
365 |
+
}
|
366 |
|
367 |
+
}elseif($type === 'username'){
|
368 |
|
369 |
+
$login = sanitize_user($login);
|
|
|
|
|
|
|
370 |
|
371 |
+
if(empty($login)){
|
372 |
+
|
373 |
+
acfe_add_validation_error('', 'Invalid username');
|
374 |
+
return;
|
375 |
+
|
376 |
+
}
|
377 |
|
378 |
+
$user = get_user_by('login', $login);
|
379 |
|
380 |
+
if(!$user || !wp_check_password($pass, $user->data->user_pass, $user->ID)){
|
381 |
+
|
382 |
+
acfe_add_validation_error('', 'Invalid username or password');
|
383 |
+
return;
|
384 |
+
|
385 |
+
}
|
386 |
|
387 |
}
|
388 |
|
389 |
+
}
|
390 |
+
|
391 |
+
function prepare($form, $current_post_id, $action){
|
392 |
+
|
393 |
+
// Form
|
394 |
+
$form_name = acf_maybe_get($form, 'form_name');
|
395 |
+
$form_id = acf_maybe_get($form, 'form_id');
|
396 |
+
|
397 |
+
// Action
|
398 |
+
$user_action = get_sub_field('acfe_form_user_action');
|
399 |
+
|
400 |
+
// Load values
|
401 |
+
$load_values = get_sub_field('acfe_form_user_load_values');
|
402 |
+
|
403 |
+
// Pre-process
|
404 |
+
$_description_group = get_sub_field('acfe_form_user_save_description_group');
|
405 |
+
$_description = $_description_group['acfe_form_user_save_description'];
|
406 |
+
$_description_custom = $_description_group['acfe_form_user_save_description_custom'];
|
407 |
+
|
408 |
+
if($_description === 'custom')
|
409 |
+
$_description = $_description_custom;
|
410 |
+
|
411 |
+
$map = array();
|
412 |
+
|
413 |
+
if($load_values){
|
414 |
+
|
415 |
+
// Mapping
|
416 |
+
$map = array(
|
417 |
+
'user_email' => get_sub_field( 'acfe_form_user_map_email' ),
|
418 |
+
'user_login' => get_sub_field( 'acfe_form_user_map_username' ),
|
419 |
+
'user_pass' => get_sub_field( 'acfe_form_user_map_password' ),
|
420 |
+
'first_name' => get_sub_field( 'acfe_form_user_map_first_name' ),
|
421 |
+
'last_name' => get_sub_field( 'acfe_form_user_map_last_name' ),
|
422 |
+
'nickname' => get_sub_field( 'acfe_form_user_map_nickname' ),
|
423 |
+
'display_name' => get_sub_field( 'acfe_form_user_map_display_name' ),
|
424 |
+
'user_url' => get_sub_field( 'acfe_form_user_map_website' ),
|
425 |
+
'description' => get_sub_field( 'acfe_form_user_map_description' ),
|
426 |
+
'role' => get_sub_field( 'acfe_form_user_map_role' ),
|
427 |
+
);
|
428 |
+
|
429 |
+
}
|
430 |
+
|
431 |
+
// Fields
|
432 |
+
$fields = array(
|
433 |
+
'target' => get_sub_field('acfe_form_user_save_target'),
|
434 |
+
|
435 |
+
'login_type' => get_sub_field('acfe_form_user_log_type'),
|
436 |
+
'login_user' => get_sub_field('acfe_form_user_save_login_user'),
|
437 |
+
'login_pass' => get_sub_field('acfe_form_user_save_login_pass'),
|
438 |
+
'login_remember' => get_sub_field('acfe_form_user_save_login_remember'),
|
439 |
+
|
440 |
+
'user_email' => get_sub_field('acfe_form_user_save_email'),
|
441 |
+
'user_login' => get_sub_field('acfe_form_user_save_username'),
|
442 |
+
'user_pass' => get_sub_field('acfe_form_user_save_password'),
|
443 |
+
'first_name' => get_sub_field('acfe_form_user_save_first_name'),
|
444 |
+
'last_name' => get_sub_field('acfe_form_user_save_last_name'),
|
445 |
+
'nickname' => get_sub_field('acfe_form_user_save_nickname'),
|
446 |
+
'display_name' => get_sub_field('acfe_form_user_save_display_name'),
|
447 |
+
'user_url' => get_sub_field('acfe_form_user_save_website'),
|
448 |
+
'description' => $_description,
|
449 |
+
'role' => get_sub_field('acfe_form_user_save_role'),
|
450 |
+
);
|
451 |
+
|
452 |
+
$data = acfe_form_map_vs_fields($map, $fields, $current_post_id, $form);
|
453 |
+
|
454 |
+
// args
|
455 |
+
$args = array();
|
456 |
+
|
457 |
+
// Insert user
|
458 |
+
$_user_id = 0;
|
459 |
+
|
460 |
+
// Insert || Update
|
461 |
+
if($user_action === 'insert_user' || $user_action === 'update_user'){
|
462 |
+
|
463 |
+
// Update user
|
464 |
+
if($user_action === 'update_user'){
|
465 |
+
|
466 |
+
$_user_id = $data['target'];
|
467 |
+
|
468 |
+
// Invalid User ID
|
469 |
+
if(!$_user_id)
|
470 |
+
return;
|
471 |
+
|
472 |
+
// ID
|
473 |
+
$args['ID'] = $_user_id;
|
474 |
+
|
475 |
+
}
|
476 |
|
477 |
+
// Email
|
478 |
+
if(!empty($data['user_email'])){
|
479 |
+
|
480 |
+
if(is_array($data['user_email']))
|
481 |
+
$data['user_email'] = acfe_array_to_string($data['user_email']);
|
482 |
+
|
483 |
+
$args['user_email'] = $data['user_email'];
|
484 |
+
|
485 |
+
}
|
486 |
|
487 |
+
// Username
|
488 |
+
if(!empty($data['user_login'])){
|
489 |
+
|
490 |
+
if(is_array($data['user_login']))
|
491 |
+
$data['user_login'] = acfe_array_to_string($data['user_login']);
|
492 |
+
|
493 |
+
$args['user_login'] = $data['user_login'];
|
494 |
+
|
495 |
+
}
|
496 |
|
497 |
+
// Password
|
498 |
+
if(!empty($data['user_pass'])){
|
499 |
+
|
500 |
+
if(is_array($data['user_pass']))
|
501 |
+
$data['user_pass'] = acfe_array_to_string($data['user_pass']);
|
502 |
+
|
503 |
+
$args['user_pass'] = $data['user_pass'];
|
504 |
+
|
505 |
+
}
|
506 |
|
507 |
+
// First name
|
508 |
+
if(!empty($data['first_name'])){
|
509 |
+
|
510 |
+
if(is_array($data['first_name']))
|
511 |
+
$data['first_name'] = acfe_array_to_string($data['first_name']);
|
512 |
+
|
513 |
+
$args['first_name'] = $data['first_name'];
|
514 |
+
|
515 |
+
}
|
516 |
|
517 |
+
// Last name
|
518 |
+
if(!empty($data['last_name'])){
|
519 |
+
|
520 |
+
if(is_array($data['last_name']))
|
521 |
+
$data['last_name'] = acfe_array_to_string($data['last_name']);
|
522 |
+
|
523 |
+
$args['last_name'] = $data['last_name'];
|
524 |
+
|
525 |
+
}
|
526 |
|
527 |
+
// Nickname
|
528 |
+
if(!empty($data['nickname'])){
|
529 |
+
|
530 |
+
if(is_array($data['nickname']))
|
531 |
+
$data['nickname'] = acfe_array_to_string($data['nickname']);
|
532 |
+
|
533 |
+
$args['nickname'] = $data['nickname'];
|
534 |
+
|
535 |
+
}
|
536 |
|
537 |
+
// Display name
|
538 |
+
if(!empty($data['display_name'])){
|
539 |
+
|
540 |
+
if(is_array($data['display_name']))
|
541 |
+
$data['display_name'] = acfe_array_to_string($data['display_name']);
|
542 |
+
|
543 |
+
$args['display_name'] = $data['display_name'];
|
544 |
+
|
545 |
+
}
|
546 |
|
547 |
+
// Website
|
548 |
+
if(!empty($data['user_url'])){
|
549 |
+
|
550 |
+
if(is_array($data['user_url']))
|
551 |
+
$data['user_url'] = acfe_array_to_string($data['user_url']);
|
552 |
+
|
553 |
+
$args['user_url'] = $data['user_url'];
|
554 |
+
|
555 |
+
}
|
|
|
556 |
|
557 |
+
// Description
|
558 |
+
if(!empty($data['description'])){
|
559 |
+
|
560 |
+
if(is_array($data['description']))
|
561 |
+
$data['description'] = acfe_array_to_string($data['description']);
|
562 |
|
563 |
+
$args['description'] = $data['description'];
|
564 |
|
565 |
}
|
566 |
|
567 |
+
// Role
|
568 |
+
if(!empty($data['role'])){
|
569 |
+
|
570 |
+
if(is_array($data['role']))
|
571 |
+
$data['role'] = acfe_array_to_string($data['role']);
|
572 |
+
|
573 |
+
$args['role'] = $data['role'];
|
574 |
+
|
575 |
+
}
|
576 |
|
577 |
+
$args = apply_filters('acfe/form/submit/user_args', $args, $user_action, $form, $action);
|
578 |
+
$args = apply_filters('acfe/form/submit/user_args/form=' . $form_name, $args, $user_action, $form, $action);
|
579 |
|
580 |
+
if(!empty($action))
|
581 |
+
$args = apply_filters('acfe/form/submit/user_args/action=' . $action, $args, $user_action, $form, $action);
|
582 |
+
|
583 |
+
if($args === false)
|
584 |
+
return false;
|
585 |
|
586 |
+
// Insert User
|
587 |
+
if($user_action === 'insert_user'){
|
588 |
+
|
589 |
+
// Bail early if no e-mail
|
590 |
+
if(!isset($args['user_email']))
|
591 |
+
return false;
|
592 |
+
|
593 |
+
// No login? Fallback to e-mail
|
594 |
+
if(!isset($args['user_login']))
|
595 |
+
$args['user_login'] = $args['user_email'];
|
596 |
+
|
597 |
+
// No password? Fallback to generated password
|
598 |
+
if(!isset($args['user_pass']))
|
599 |
+
$args['user_pass'] = wp_generate_password(8, false);
|
600 |
+
|
601 |
+
}
|
602 |
|
603 |
+
// Insert User
|
604 |
+
if($user_action === 'insert_user'){
|
605 |
+
|
606 |
+
$_insert_user = wp_insert_user($args);
|
607 |
+
|
608 |
+
}
|
609 |
|
610 |
+
// Update User
|
611 |
+
elseif($user_action === 'update_user'){
|
612 |
|
613 |
+
$_insert_user = wp_update_user($args);
|
614 |
+
|
615 |
+
if(!is_wp_error($_insert_user)){
|
616 |
+
|
617 |
+
$_user_id = $_insert_user;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
618 |
|
619 |
+
// Update User Login + Nicename
|
620 |
+
if(acf_maybe_get($args, 'user_login')){
|
621 |
|
622 |
+
// Sanitize
|
623 |
+
$sanitized_user_login = sanitize_user($args['user_login'], true);
|
624 |
|
625 |
+
// Filter
|
626 |
+
$pre_user_login = apply_filters('pre_user_login', $sanitized_user_login);
|
627 |
|
628 |
+
// Trim
|
629 |
+
$user_login = trim($pre_user_login);
|
630 |
|
631 |
+
$error = false;
|
|
|
|
|
632 |
|
633 |
+
if(empty($user_login)){
|
634 |
+
|
635 |
+
$error = new WP_Error('empty_user_login', __('Cannot create a user with an empty login name.'));
|
636 |
+
|
637 |
+
}elseif(mb_strlen($user_login) > 60){
|
638 |
+
|
639 |
+
$error = new WP_Error('user_login_too_long', __('Username may not be longer than 60 characters.'));
|
640 |
+
|
641 |
+
}
|
642 |
|
643 |
+
if(username_exists($user_login)){
|
644 |
+
|
645 |
+
$error = new WP_Error('existing_user_login', __('Sorry, that username already exists!'));
|
646 |
+
|
647 |
+
}
|
648 |
+
|
649 |
+
$user_nicename = sanitize_user($user_login, true);
|
650 |
+
|
651 |
+
if(mb_strlen($user_nicename) > 50){
|
652 |
+
|
653 |
+
$error = new WP_Error('user_nicename_too_long', __('Nicename may not be longer than 50 characters.'));
|
654 |
+
|
655 |
+
}
|
656 |
+
|
657 |
+
$user_nicename = sanitize_title($user_nicename);
|
658 |
|
659 |
+
$user_nicename = apply_filters('pre_user_nicename', $user_nicename);
|
660 |
+
|
661 |
+
if(!is_wp_error($error)){
|
662 |
+
|
663 |
+
global $wpdb;
|
664 |
+
|
665 |
+
$wpdb->update($wpdb->users,
|
666 |
+
array(
|
667 |
+
'user_login' => $user_login,
|
668 |
+
'user_nicename' => $user_nicename,
|
669 |
+
),
|
670 |
+
array(
|
671 |
+
'ID' => $_user_id
|
672 |
+
)
|
673 |
+
);
|
674 |
+
|
675 |
+
}
|
676 |
|
677 |
}
|
678 |
|
679 |
+
}
|
680 |
+
|
681 |
+
}
|
682 |
+
|
683 |
+
}
|
684 |
+
|
685 |
+
// Log User
|
686 |
+
elseif($user_action === 'log_user'){
|
687 |
+
|
688 |
+
$_insert_user = false;
|
689 |
+
|
690 |
+
$_login_user = false;
|
691 |
+
$_login_pass = false;
|
692 |
+
$_login_remember = false;
|
693 |
+
|
694 |
+
// Email
|
695 |
+
if(!empty($data['login_user'])){
|
696 |
+
|
697 |
+
$_login_user = $data['login_user'];
|
698 |
+
|
699 |
+
}
|
700 |
+
|
701 |
+
// Password
|
702 |
+
if(!empty($data['login_pass'])){
|
703 |
+
|
704 |
+
$_login_pass = $data['login_pass'];
|
705 |
+
|
706 |
+
}
|
707 |
+
|
708 |
+
// Remember me
|
709 |
+
if(!empty($data['login_remember'])){
|
710 |
+
|
711 |
+
$_login_remember = $data['login_remember'];
|
712 |
+
|
713 |
+
}
|
714 |
+
|
715 |
+
$_login_pass = wp_specialchars_decode($_login_pass);
|
716 |
+
|
717 |
+
// Email
|
718 |
+
if($data['login_type'] === 'email'){
|
719 |
+
|
720 |
+
$_login_user = sanitize_email($_login_user);
|
721 |
+
$user = get_user_by('email', $_login_user);
|
722 |
+
|
723 |
+
}
|
724 |
+
|
725 |
+
// Username
|
726 |
+
elseif($data['login_type'] === 'username'){
|
727 |
+
|
728 |
+
$_login_user = sanitize_user($_login_user);
|
729 |
+
$user = get_user_by('login', $_login_user);
|
730 |
+
|
731 |
+
}
|
732 |
+
|
733 |
+
// Email || Username
|
734 |
+
elseif($data['login_type'] === 'email_username'){
|
735 |
+
|
736 |
+
// Email
|
737 |
+
if(is_email($_login_user)){
|
738 |
|
739 |
+
$user = get_user_by('email', $_login_user);
|
740 |
+
|
741 |
+
// Username
|
742 |
+
}else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
743 |
|
744 |
+
$user = get_user_by('login', $_login_user);
|
745 |
|
746 |
}
|
747 |
|
748 |
}
|
749 |
+
|
750 |
+
$_login_remember = boolval($_login_remember);
|
751 |
+
|
752 |
+
// Login
|
753 |
+
$_insert_user = wp_signon(array(
|
754 |
+
'user_login' => $user->user_login,
|
755 |
+
'user_password' => $_login_pass,
|
756 |
+
'remember' => $_login_remember
|
757 |
+
), is_ssl());
|
758 |
+
|
759 |
+
// User Error
|
760 |
+
if(is_wp_error($_insert_user))
|
761 |
+
return;
|
762 |
+
|
763 |
+
$_insert_user = $_insert_user->ID;
|
764 |
|
765 |
}
|
766 |
|
792 |
$form_name = acf_maybe_get($form, 'form_name');
|
793 |
|
794 |
// Get user array
|
795 |
+
$user_object = get_user_by('ID', $_user_id);
|
796 |
|
797 |
+
if(isset($user_object->data)){
|
798 |
+
|
799 |
+
// return array
|
800 |
+
$user = json_decode(json_encode($user_object->data), true);
|
801 |
+
|
802 |
+
$user_object_meta = get_user_meta($user['ID']);
|
803 |
+
|
804 |
+
$user_meta = array();
|
805 |
+
|
806 |
+
foreach($user_object_meta as $k => $v){
|
807 |
+
|
808 |
+
if(!isset($v[0]))
|
809 |
+
continue;
|
810 |
+
|
811 |
+
$user_meta[$k] = $v[0];
|
812 |
+
|
813 |
+
}
|
814 |
+
|
815 |
+
$user_array = array_merge($user, $user_meta);
|
816 |
+
|
817 |
+
$user_array['permalink'] = get_author_posts_url($_user_id);
|
818 |
+
$user_array['admin_url'] = admin_url('user-edit.php?user_id=' . $_user_id);
|
819 |
+
|
820 |
+
$user_array = apply_filters('acfe/form/query_var/user', $user_array, $_user_id, $user_action, $args, $form, $action);
|
821 |
+
$user_array = apply_filters('acfe/form/query_var/user/form=' . $form_name, $user_array, $_user_id, $user_action, $args, $form, $action);
|
822 |
+
$user_array = apply_filters('acfe/form/query_var/user/action=' . $action, $user_array, $_user_id, $user_action, $args, $form, $action);
|
823 |
+
|
824 |
+
set_query_var($action, $user_array);
|
825 |
|
826 |
+
}
|
827 |
|
828 |
}
|
829 |
|
834 |
|
835 |
if(!empty($save_meta)){
|
836 |
|
837 |
+
$meta = acfe_form_filter_meta($save_meta, $_POST['acf']);
|
838 |
|
839 |
+
if(!empty($meta)){
|
840 |
|
841 |
// Backup original acf post data
|
842 |
$acf = $_POST['acf'];
|
843 |
|
844 |
// Save meta fields
|
845 |
+
acf_save_post('user_' . $_user_id, $meta);
|
846 |
|
847 |
// Restore original acf post data
|
848 |
$_POST['acf'] = $acf;
|
853 |
|
854 |
}
|
855 |
|
856 |
+
/**
|
857 |
+
* User: Select2 Choices
|
858 |
+
*/
|
859 |
+
function prepare_choices($field){
|
860 |
+
|
861 |
+
$field['choices']['current_user'] = 'Current User';
|
862 |
+
$field['choices']['current_post_author'] = 'Current Post Author';
|
863 |
+
|
864 |
+
if(acf_maybe_get($field, 'value')){
|
865 |
+
|
866 |
+
$field_type = acf_get_field_type('user');
|
867 |
+
|
868 |
+
// Clean value into an array of IDs.
|
869 |
+
$user_ids = array_map('intval', acf_array($field['value']));
|
870 |
+
|
871 |
+
// Find users in database (ensures all results are real).
|
872 |
+
$users = acf_get_users(array(
|
873 |
+
'include' => $user_ids
|
874 |
+
));
|
875 |
+
|
876 |
+
// Append.
|
877 |
+
if($users){
|
878 |
+
|
879 |
+
foreach($users as $user){
|
880 |
+
$field['choices'][$user->ID] = $field_type->get_result($user, $field);
|
881 |
+
}
|
882 |
+
|
883 |
+
}
|
884 |
+
|
885 |
+
}
|
886 |
+
|
887 |
+
return $field;
|
888 |
+
|
889 |
+
}
|
890 |
+
|
891 |
function advanced_load($field){
|
892 |
|
893 |
$form_name = 'my_form';
|
903 |
</pre>
|
904 |
<br />
|
905 |
<pre>
|
906 |
+
/**
|
907 |
+
* @int $user_id User ID used as source
|
908 |
+
* @array $form The form settings
|
909 |
+
* @string $action The action alias name
|
910 |
+
*/
|
911 |
add_filter('acfe/form/load/user_id/form=<?php echo $form_name; ?>', 'my_form_user_values_source', 10, 3);
|
912 |
function my_form_user_values_source($user_id, $form, $action){
|
913 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
914 |
/**
|
915 |
* Force to load values from the user ID 12
|
916 |
*/
|
942 |
</pre>
|
943 |
<br />
|
944 |
<pre>
|
945 |
+
/**
|
946 |
+
* @array $args The generated user arguments
|
947 |
+
* @string $type Action type: 'insert_user' or 'update_user'
|
948 |
+
* @array $form The form settings
|
949 |
+
* @string $action The action alias name
|
950 |
+
*/
|
951 |
add_filter('acfe/form/submit/user_args/form=<?php echo $form_name; ?>', 'my_form_user_args', 10, 4);
|
952 |
function my_form_user_args($args, $type, $form, $action){
|
953 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
954 |
/**
|
955 |
* Force specific first name if the action type is 'insert_user'
|
956 |
*/
|
1001 |
<br />
|
1002 |
<pre>
|
1003 |
/**
|
1004 |
+
* @int $user_id The targeted user ID
|
1005 |
+
* @string $type Action type: 'insert_user' or 'update_user'
|
1006 |
+
* @array $args The generated user arguments
|
1007 |
+
* @array $form The form settings
|
1008 |
+
* @string $action The action alias name
|
1009 |
+
*
|
1010 |
+
* Note: At this point the user is already saved into the database
|
1011 |
*/
|
1012 |
+
add_action('acfe/form/submit/user/form=<?php echo $form_name; ?>', 'my_form_user_save', 10, 5);
|
1013 |
function my_form_user_save($user_id, $type, $args, $form, $action){
|
1014 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1015 |
/**
|
1016 |
* Get the form input value named 'my_field'
|
1017 |
* This is the value entered by the user during the form submission
|
includes/modules/form/admin.php
CHANGED
@@ -3,6 +3,9 @@
|
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
|
|
|
|
|
|
6 |
if(!class_exists('acfe_form')):
|
7 |
|
8 |
class acfe_form{
|
@@ -13,6 +16,8 @@ class acfe_form{
|
|
13 |
public $posts = array();
|
14 |
public $users = array();
|
15 |
|
|
|
|
|
16 |
function __construct(){
|
17 |
|
18 |
// Post Type
|
@@ -29,9 +34,9 @@ class acfe_form{
|
|
29 |
add_filter('acf/pre_load_post_id', array($this, 'validate_post_id'), 10, 2);
|
30 |
|
31 |
// Fields
|
|
|
32 |
add_filter('acf/prepare_field/name=acfe_form_actions', array($this, 'prepare_actions'));
|
33 |
add_filter('acf/prepare_field/name=acfe_form_field_groups', array($this, 'field_groups_choices'));
|
34 |
-
add_filter('acf/prepare_field/name=acfe_form_email_files', array($this, 'prepare_email_files'));
|
35 |
|
36 |
// Format values
|
37 |
add_filter('acfe/form/format_value/type=post_object', array($this, 'format_value_post_object'), 5, 4);
|
@@ -43,47 +48,24 @@ class acfe_form{
|
|
43 |
add_filter('acfe/form/format_value/type=select', array($this, 'format_value_select'), 5, 4);
|
44 |
add_filter('acfe/form/format_value/type=checkbox', array($this, 'format_value_select'), 5, 4);
|
45 |
add_filter('acfe/form/format_value/type=radio', array($this, 'format_value_select'), 5, 4);
|
46 |
-
|
47 |
-
|
48 |
-
$this
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
);
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
$this->terms = array(
|
62 |
-
'acfe_form_term_save_target',
|
63 |
-
'acfe_form_term_save_parent',
|
64 |
-
'acfe_form_term_load_source',
|
65 |
-
);
|
66 |
-
|
67 |
-
foreach($this->terms as $tag){
|
68 |
-
|
69 |
-
add_filter('acf/prepare_field/name=' . $tag, array($this, 'prepare_value_term'));
|
70 |
-
|
71 |
-
}
|
72 |
-
|
73 |
-
// Users Actions
|
74 |
-
$this->users = array(
|
75 |
-
'acfe_form_post_save_post_author',
|
76 |
-
'acfe_form_user_save_target',
|
77 |
-
'acfe_form_user_load_source',
|
78 |
-
);
|
79 |
-
|
80 |
-
foreach($this->users as $tag){
|
81 |
-
|
82 |
-
add_filter('acf/prepare_field/name=' . $tag, array($this, 'prepare_value_user'));
|
83 |
-
|
84 |
-
}
|
85 |
|
86 |
// Ajax
|
|
|
87 |
add_action('wp_ajax_acf/fields/select/query', array($this, 'ajax_query_post'), 5);
|
88 |
add_action('wp_ajax_nopriv_acf/fields/select/query', array($this, 'ajax_query_post'), 5);
|
89 |
|
@@ -92,7 +74,7 @@ class acfe_form{
|
|
92 |
|
93 |
add_action('wp_ajax_acf/fields/select/query', array($this, 'ajax_query_term'), 5);
|
94 |
add_action('wp_ajax_nopriv_acf/fields/select/query', array($this, 'ajax_query_term'), 5);
|
95 |
-
|
96 |
}
|
97 |
|
98 |
function init(){
|
@@ -131,7 +113,10 @@ class acfe_form{
|
|
131 |
'edit_post' => acf_get_setting('capability'),
|
132 |
'delete_post' => acf_get_setting('capability'),
|
133 |
'read_post' => acf_get_setting('capability'),
|
134 |
-
)
|
|
|
|
|
|
|
135 |
));
|
136 |
|
137 |
}
|
@@ -169,25 +154,6 @@ class acfe_form{
|
|
169 |
|
170 |
function load_list(){
|
171 |
|
172 |
-
// Posts per page
|
173 |
-
add_filter('edit_posts_per_page', function(){
|
174 |
-
return 999;
|
175 |
-
});
|
176 |
-
|
177 |
-
// Order
|
178 |
-
add_action('pre_get_posts', function($query){
|
179 |
-
|
180 |
-
if(!$query->is_main_query())
|
181 |
-
return;
|
182 |
-
|
183 |
-
if(!acf_maybe_get($_REQUEST,'orderby'))
|
184 |
-
$query->set('orderby', 'name');
|
185 |
-
|
186 |
-
if(!acf_maybe_get($_REQUEST,'order'))
|
187 |
-
$query->set('order', 'ASC');
|
188 |
-
|
189 |
-
});
|
190 |
-
|
191 |
// Columns
|
192 |
add_filter('manage_edit-' . $this->post_type . '_columns', array($this, 'admin_columns'));
|
193 |
add_action('manage_' . $this->post_type . '_posts_custom_column', array($this, 'admin_columns_html'), 10, 2);
|
@@ -199,12 +165,102 @@ class acfe_form{
|
|
199 |
// vars
|
200 |
$this->fields_groups = $this->get_fields_groups();
|
201 |
|
202 |
-
add_action('add_meta_boxes',
|
203 |
-
|
204 |
-
add_filter('acf/pre_render_fields', array($this, 'render_integration'), 10, 2);
|
205 |
|
206 |
// Misc actions
|
207 |
-
add_action('post_submitbox_misc_actions',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
}
|
210 |
|
@@ -372,36 +428,116 @@ class acfe_form{
|
|
372 |
|
373 |
function add_meta_boxes(){
|
374 |
|
375 |
-
|
376 |
-
|
377 |
-
if(empty($data))
|
378 |
-
return;
|
379 |
-
|
380 |
add_meta_box(
|
381 |
-
|
382 |
// ID
|
383 |
-
'acfe-form-
|
384 |
|
385 |
// Title
|
386 |
-
|
387 |
|
388 |
// Render
|
389 |
-
array($this, '
|
390 |
|
391 |
// Screen
|
392 |
$this->post_type,
|
393 |
|
394 |
// Position
|
395 |
-
'
|
396 |
|
397 |
// Priority
|
398 |
-
'
|
399 |
|
400 |
);
|
401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
}
|
403 |
|
404 |
-
function
|
405 |
|
406 |
foreach($this->fields_groups as $field_group){ ?>
|
407 |
|
@@ -453,8 +589,8 @@ class acfe_form{
|
|
453 |
|
454 |
<tr class="acf-row">
|
455 |
<td width="25%"><?php echo $field_label; ?></td>
|
456 |
-
<td width="25%"><?php echo $field['name']; ?></td>
|
457 |
-
<td width="25%"><code><?php echo $field_key; ?></code></td>
|
458 |
<td width="25%"><?php echo $type_label; ?></td>
|
459 |
</tr>
|
460 |
|
@@ -554,6 +690,17 @@ class acfe_form{
|
|
554 |
|
555 |
}
|
556 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
557 |
function prepare_actions($field){
|
558 |
|
559 |
$field['instructions'] = 'Add actions on form submission';
|
@@ -569,33 +716,210 @@ class acfe_form{
|
|
569 |
return $field;
|
570 |
|
571 |
}
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
|
585 |
function map_fields_deep($field){
|
586 |
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
|
596 |
-
$field['choices'] =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
|
598 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
599 |
|
600 |
return $field;
|
601 |
|
@@ -614,7 +938,7 @@ class acfe_form{
|
|
614 |
|
615 |
}
|
616 |
|
617 |
-
function get_fields_choices($deep = false){
|
618 |
|
619 |
$data = $this->fields_groups;
|
620 |
$choices = array();
|
@@ -657,7 +981,7 @@ class acfe_form{
|
|
657 |
// Deep
|
658 |
}else{
|
659 |
|
660 |
-
$this->get_fields_choices_recursive($choices[$field_group_title], $field);
|
661 |
|
662 |
}
|
663 |
|
@@ -671,7 +995,7 @@ class acfe_form{
|
|
671 |
|
672 |
}
|
673 |
|
674 |
-
function get_fields_choices_recursive(&$choices, $field){
|
675 |
|
676 |
$label = '';
|
677 |
|
@@ -681,13 +1005,27 @@ class acfe_form{
|
|
681 |
$label .= !empty($field['label']) ? $field['label'] : '(' . __('no label', 'acf') . ')';
|
682 |
$label .= $field['required'] ? ' *' : '';
|
683 |
|
684 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
685 |
|
686 |
if(isset($field['sub_fields']) && !empty($field['sub_fields'])){
|
687 |
|
688 |
foreach($field['sub_fields'] as $s_field){
|
689 |
|
690 |
-
$this->get_fields_choices_recursive($choices, $s_field);
|
691 |
|
692 |
}
|
693 |
|
@@ -702,28 +1040,68 @@ class acfe_form{
|
|
702 |
$form_name = $args['form_name'];
|
703 |
|
704 |
$mapped_field_groups = $this->get_fields_groups($form_id);
|
|
|
705 |
$mapped_fields = array();
|
706 |
|
707 |
if(!empty($mapped_field_groups)){
|
708 |
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
727 |
foreach($matches[1] as $i => $field_key){
|
728 |
|
729 |
$field = false;
|
@@ -764,7 +1142,7 @@ class acfe_form{
|
|
764 |
|
765 |
ob_start();
|
766 |
|
767 |
-
acf_render_fields($fields,
|
768 |
|
769 |
$render_field = ob_get_clean();
|
770 |
|
@@ -777,23 +1155,24 @@ class acfe_form{
|
|
777 |
// Match {field_group:key}
|
778 |
if(preg_match_all('/{field_group:(.*?)}/', $content, $matches)){
|
779 |
|
780 |
-
|
781 |
|
782 |
foreach($matches[1] as $i => $field_group_key){
|
783 |
|
784 |
$fields = false;
|
785 |
-
|
786 |
-
|
787 |
-
if(strpos($field_group_key, 'group_') === 0){
|
788 |
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
|
|
793 |
|
794 |
-
|
|
|
795 |
|
796 |
-
foreach($
|
797 |
|
798 |
if($field_group['title'] !== $field_group_key)
|
799 |
continue;
|
@@ -804,8 +1183,8 @@ class acfe_form{
|
|
804 |
}
|
805 |
|
806 |
}
|
807 |
-
|
808 |
-
|
809 |
|
810 |
if(!$fields){
|
811 |
|
@@ -816,7 +1195,7 @@ class acfe_form{
|
|
816 |
|
817 |
ob_start();
|
818 |
|
819 |
-
acf_render_fields($fields,
|
820 |
|
821 |
$render_fields = ob_get_clean();
|
822 |
|
@@ -846,6 +1225,23 @@ class acfe_form{
|
|
846 |
|
847 |
}
|
848 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
849 |
// User
|
850 |
function format_value_user($value, $_value, $post_id, $field){
|
851 |
|
@@ -915,7 +1311,11 @@ class acfe_form{
|
|
915 |
|
916 |
foreach($value as $i => $v){
|
917 |
|
918 |
-
$
|
|
|
|
|
|
|
|
|
919 |
|
920 |
}
|
921 |
|
@@ -945,10 +1345,16 @@ class acfe_form{
|
|
945 |
|
946 |
}
|
947 |
|
948 |
-
function map_fields_values(
|
949 |
|
950 |
-
if(empty($array))
|
951 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
952 |
|
953 |
foreach($array as $field_key => $value){
|
954 |
|
@@ -969,9 +1375,9 @@ class acfe_form{
|
|
969 |
'value' => $value,
|
970 |
);
|
971 |
|
972 |
-
if(is_array($value)){
|
973 |
|
974 |
-
$this->map_fields_values($
|
975 |
|
976 |
}
|
977 |
|
@@ -981,132 +1387,97 @@ class acfe_form{
|
|
981 |
|
982 |
}
|
983 |
|
984 |
-
function map_field_value($content, $
|
985 |
-
|
986 |
-
if(!$acf)
|
987 |
-
$acf = $_POST['acf'];
|
988 |
-
|
989 |
-
if(!$acf)
|
990 |
-
$acf = array();
|
991 |
|
992 |
-
|
|
|
993 |
|
994 |
-
//
|
995 |
-
if(
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
if($field['key'] !== $content)
|
1003 |
-
continue;
|
1004 |
-
|
1005 |
-
return $field['value'];
|
1006 |
-
|
1007 |
-
}
|
1008 |
-
|
1009 |
}
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
foreach($matches[1] as $i => $name){
|
1018 |
-
|
1019 |
-
$query_var = get_query_var($name);
|
1020 |
-
|
1021 |
-
if(strpos($name, ':') !== false){
|
1022 |
-
|
1023 |
-
$explode = explode(':', $name);
|
1024 |
-
|
1025 |
-
$query_var = get_query_var($explode[0]);
|
1026 |
-
|
1027 |
-
if(is_array($query_var) && isset($query_var[$explode[1]])){
|
1028 |
-
|
1029 |
-
$query_var = $query_var[$explode[1]];
|
1030 |
-
|
1031 |
-
}
|
1032 |
-
|
1033 |
-
}
|
1034 |
-
|
1035 |
-
$content = str_replace('{query_var:' . $name . '}', $query_var, $content);
|
1036 |
-
|
1037 |
-
}
|
1038 |
-
|
1039 |
-
}
|
1040 |
-
|
1041 |
-
// Match {field:key}
|
1042 |
-
if(preg_match_all('/{field:(.*?)}/', $content, $matches)){
|
1043 |
-
|
1044 |
-
foreach($matches[1] as $i => $field_key){
|
1045 |
-
|
1046 |
-
if(!empty($data)){
|
1047 |
-
|
1048 |
-
foreach($data as $field){
|
1049 |
-
|
1050 |
-
if($field['name'] !== $field_key && $field['key'] !== $field_key)
|
1051 |
-
continue;
|
1052 |
-
|
1053 |
-
$content = str_replace('{field:' . $field_key . '}', $this->format_value($field['value'], $post_id, $field['field']), $content);
|
1054 |
-
break;
|
1055 |
-
|
1056 |
-
}
|
1057 |
-
|
1058 |
-
}
|
1059 |
-
|
1060 |
-
$content = str_replace('{field:' . $field_key . '}', '', $content);
|
1061 |
-
|
1062 |
-
}
|
1063 |
-
|
1064 |
-
}
|
1065 |
-
|
1066 |
-
// Match {fields}
|
1067 |
-
if(preg_match('/{fields}/', $content, $matches)){
|
1068 |
-
|
1069 |
-
$content_html = '';
|
1070 |
-
|
1071 |
-
if(!empty($data)){
|
1072 |
-
|
1073 |
-
foreach($data as $field){
|
1074 |
-
|
1075 |
-
$label = !empty($field['label']) ? $field['label'] : $field['name'];
|
1076 |
-
|
1077 |
-
$content_html .= $label . ': ' . $this->format_value($field['value'], $post_id, $field['field']) . "<br/>\n";
|
1078 |
-
|
1079 |
-
}
|
1080 |
-
|
1081 |
-
}
|
1082 |
-
|
1083 |
-
$content = str_replace('{fields}', $content_html, $content);
|
1084 |
-
|
1085 |
-
}
|
1086 |
-
|
1087 |
-
return $content;
|
1088 |
-
|
1089 |
}
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1105 |
}
|
1106 |
-
|
1107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1108 |
|
1109 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1110 |
|
1111 |
function filter_meta($meta, $acf){
|
1112 |
|
@@ -1136,209 +1507,6 @@ class acfe_form{
|
|
1136 |
|
1137 |
}
|
1138 |
|
1139 |
-
function render_integration($fields, $post_id){
|
1140 |
-
|
1141 |
-
$_fields = $fields;
|
1142 |
-
$last_field = end($_fields);
|
1143 |
-
|
1144 |
-
if(!$last_field || $last_field['name'] !== 'acfe_form_instruction_placement')
|
1145 |
-
return $fields;
|
1146 |
-
|
1147 |
-
$form_id = $post_id;
|
1148 |
-
$form_name = get_field('acfe_form_name', $form_id);
|
1149 |
-
|
1150 |
-
$fields[] = array(
|
1151 |
-
'type' => 'tab',
|
1152 |
-
'name' => '',
|
1153 |
-
'label' => 'Integration',
|
1154 |
-
'value' => '',
|
1155 |
-
);
|
1156 |
-
|
1157 |
-
$fields[] = array(
|
1158 |
-
'type' => 'message',
|
1159 |
-
'name' => '',
|
1160 |
-
'label' => 'Shortcode',
|
1161 |
-
'value' => '',
|
1162 |
-
'message' => '<code>[acfe_form name="' . $form_name . '"]</code> or <code>[acfe_form ID="' . $form_id . '"]</code>',
|
1163 |
-
'new_lines' => false,
|
1164 |
-
);
|
1165 |
-
|
1166 |
-
ob_start();
|
1167 |
-
?>
|
1168 |
-
<pre><?php get_header(); ?>
|
1169 |
-
|
1170 |
-
<!-- <?php echo get_the_title($form_id); ?> -->
|
1171 |
-
<?php acfe_form('<?php echo $form_name; ?>'); ?>
|
1172 |
-
|
1173 |
-
<?php get_footer(); ?></pre>
|
1174 |
-
<?php $html = ob_get_clean();
|
1175 |
-
|
1176 |
-
$fields[] = array(
|
1177 |
-
'type' => 'message',
|
1178 |
-
'name' => '',
|
1179 |
-
'label' => 'PHP Form Integration',
|
1180 |
-
'value' => '',
|
1181 |
-
'message' => $html,
|
1182 |
-
'new_lines' => false,
|
1183 |
-
);
|
1184 |
-
|
1185 |
-
if(!empty($this->fields_groups)){
|
1186 |
-
|
1187 |
-
foreach($this->fields_groups as $field_group){
|
1188 |
-
|
1189 |
-
if(empty($field_group['fields']))
|
1190 |
-
continue;
|
1191 |
-
|
1192 |
-
$_fields = $field_group['fields'];
|
1193 |
-
break;
|
1194 |
-
|
1195 |
-
}
|
1196 |
-
|
1197 |
-
if(!empty($_fields)){
|
1198 |
-
|
1199 |
-
$field = $_fields[0];
|
1200 |
-
|
1201 |
-
$_form_name = str_replace('-', '_', $form_name);
|
1202 |
-
$_field_name = str_replace('-', '_', sanitize_title($field['name']));
|
1203 |
-
|
1204 |
-
// Field Validation
|
1205 |
-
|
1206 |
-
ob_start();
|
1207 |
-
?>
|
1208 |
-
<pre><?php
|
1209 |
-
|
1210 |
-
add_filter('acf/validate_value/name=<?php echo $field['name']; ?>', 'my_<?php echo $_field_name; ?>_validation', 10, 4);
|
1211 |
-
function my_<?php echo $_field_name; ?>_validation($valid, $value, $field, $input){
|
1212 |
-
|
1213 |
-
/**
|
1214 |
-
* Perform custom validation on a field's value
|
1215 |
-
* Reference: <a href="https://www.advancedcustomfields.com/resources/acf-validate_value/" target="_blank">https://www.advancedcustomfields.com/resources/acf-validate_value/</a>
|
1216 |
-
*/
|
1217 |
-
|
1218 |
-
if(!$valid)
|
1219 |
-
return $valid;
|
1220 |
-
|
1221 |
-
if($value === 'Hello')
|
1222 |
-
$valid = 'Hello is not allowed';
|
1223 |
-
|
1224 |
-
return $valid;
|
1225 |
-
|
1226 |
-
}</pre>
|
1227 |
-
<?php $html = ob_get_clean();
|
1228 |
-
|
1229 |
-
$fields[] = array(
|
1230 |
-
'type' => 'message',
|
1231 |
-
'name' => '',
|
1232 |
-
'label' => 'PHP Field Validation',
|
1233 |
-
'value' => '',
|
1234 |
-
'message' => $html,
|
1235 |
-
'new_lines' => false,
|
1236 |
-
);
|
1237 |
-
|
1238 |
-
|
1239 |
-
// Form Validation
|
1240 |
-
|
1241 |
-
ob_start();
|
1242 |
-
?>
|
1243 |
-
<pre><?php
|
1244 |
-
|
1245 |
-
add_action('acfe/form/validation/form=<?php echo $form_name; ?>', 'my_<?php echo $_form_name; ?>_validation', 10, 2);
|
1246 |
-
function my_<?php echo $_form_name; ?>_validation($form, $post_id){
|
1247 |
-
|
1248 |
-
/**
|
1249 |
-
* @array $form Form arguments
|
1250 |
-
* @int/string $post_id Current post id
|
1251 |
-
*/
|
1252 |
-
|
1253 |
-
|
1254 |
-
/**
|
1255 |
-
* Get the form input value named '<?php echo $field['name']; ?>'
|
1256 |
-
* This is the value entered by the user during the form submission
|
1257 |
-
*/
|
1258 |
-
$<?php echo $_field_name; ?> = get_field('<?php echo $field['name']; ?>');
|
1259 |
-
$<?php echo $_field_name; ?>_unformatted = get_field('<?php echo $field['name']; ?>', false, false);
|
1260 |
-
|
1261 |
-
if($<?php echo $_field_name; ?> === 'Hello'){
|
1262 |
-
|
1263 |
-
acfe_add_validation_error('<?php echo $field['name']; ?>', 'Hello is not allowed');
|
1264 |
-
|
1265 |
-
}
|
1266 |
-
|
1267 |
-
|
1268 |
-
/**
|
1269 |
-
* Get the field value '<?php echo $field['name']; ?>' from the post ID 145
|
1270 |
-
*/
|
1271 |
-
$post_<?php echo $_field_name; ?> = get_field('<?php echo $field['name']; ?>', 145);
|
1272 |
-
$post_<?php echo $_field_name; ?>_unformatted = get_field('<?php echo $field['name']; ?>', 145, false);
|
1273 |
-
|
1274 |
-
}</pre>
|
1275 |
-
<?php $html = ob_get_clean();
|
1276 |
-
|
1277 |
-
$fields[] = array(
|
1278 |
-
'type' => 'message',
|
1279 |
-
'name' => '',
|
1280 |
-
'label' => 'PHP Form Validation',
|
1281 |
-
'value' => '',
|
1282 |
-
'message' => $html,
|
1283 |
-
'new_lines' => false,
|
1284 |
-
);
|
1285 |
-
|
1286 |
-
|
1287 |
-
// Form Submission
|
1288 |
-
|
1289 |
-
ob_start();
|
1290 |
-
?>
|
1291 |
-
<pre><?php
|
1292 |
-
|
1293 |
-
add_action('acfe/form/submit/form=<?php echo $form_name; ?>', 'my_<?php echo $_form_name; ?>_submit', 10, 2);
|
1294 |
-
function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
1295 |
-
|
1296 |
-
/**
|
1297 |
-
* @array $form Form arguments
|
1298 |
-
* @int/string $post_id Current post id
|
1299 |
-
*/
|
1300 |
-
|
1301 |
-
|
1302 |
-
/**
|
1303 |
-
* Get the form input value named '<?php echo $field['name']; ?>'
|
1304 |
-
* This is the value entered by the user during the form submission
|
1305 |
-
*/
|
1306 |
-
$<?php echo $_field_name; ?> = get_field('<?php echo $field['name']; ?>');
|
1307 |
-
$<?php echo $_field_name; ?>_unformatted = get_field('<?php echo $field['name']; ?>', false, false);
|
1308 |
-
|
1309 |
-
if($<?php echo $_field_name; ?> === 'do_something'){
|
1310 |
-
|
1311 |
-
// Do something
|
1312 |
-
|
1313 |
-
}
|
1314 |
-
|
1315 |
-
|
1316 |
-
/**
|
1317 |
-
* Get the field value '<?php echo $field['name']; ?>' from the post ID 145
|
1318 |
-
*/
|
1319 |
-
$post_<?php echo $_field_name; ?> = get_field('<?php echo $field['name']; ?>', 145);
|
1320 |
-
$post_<?php echo $_field_name; ?>_unformatted = get_field('<?php echo $field['name']; ?>', 145, false);
|
1321 |
-
|
1322 |
-
}</pre>
|
1323 |
-
<?php $html = ob_get_clean();
|
1324 |
-
|
1325 |
-
$fields[] = array(
|
1326 |
-
'type' => 'message',
|
1327 |
-
'name' => '',
|
1328 |
-
'label' => 'PHP Form Submit: Custom Action',
|
1329 |
-
'value' => '',
|
1330 |
-
'message' => $html,
|
1331 |
-
'new_lines' => false,
|
1332 |
-
);
|
1333 |
-
|
1334 |
-
}
|
1335 |
-
|
1336 |
-
}
|
1337 |
-
|
1338 |
-
return $fields;
|
1339 |
-
|
1340 |
-
}
|
1341 |
-
|
1342 |
/**
|
1343 |
* List: Columns
|
1344 |
*/
|
@@ -1364,7 +1532,7 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1364 |
// Name
|
1365 |
if($column == 'name'){
|
1366 |
|
1367 |
-
echo '<code style="
|
1368 |
|
1369 |
}
|
1370 |
|
@@ -1520,678 +1688,1438 @@ function my_<?php echo $_form_name; ?>_submit($form, $post_id){
|
|
1520 |
// Field groups
|
1521 |
elseif($column == 'shortcode'){
|
1522 |
|
1523 |
-
echo '<code style="
|
1524 |
|
1525 |
}
|
1526 |
|
1527 |
}
|
1528 |
|
1529 |
-
|
1530 |
-
* Post: Select2 Ajax
|
1531 |
-
*/
|
1532 |
-
function ajax_query_post(){
|
1533 |
|
1534 |
-
|
1535 |
-
die();
|
1536 |
|
1537 |
-
|
1538 |
-
|
1539 |
|
1540 |
-
|
1541 |
-
if(!$response)
|
1542 |
-
return;
|
1543 |
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
|
|
|
|
1548 |
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
// load field
|
1561 |
-
$field = acf_get_field($options['field_key']);
|
1562 |
-
if(!$field)
|
1563 |
-
return false;
|
1564 |
-
|
1565 |
-
// Target field name
|
1566 |
-
if(!in_array($field['name'], $this->posts))
|
1567 |
-
return false;
|
1568 |
|
1569 |
-
|
|
|
|
|
1570 |
|
1571 |
-
|
1572 |
-
$results = array();
|
1573 |
-
$args = array();
|
1574 |
-
$s = false;
|
1575 |
-
$is_search = false;
|
1576 |
|
1577 |
-
|
1578 |
-
|
1579 |
-
$args['paged'] = $options['paged'];
|
1580 |
|
1581 |
-
|
1582 |
-
if($options['s'] !== ''){
|
1583 |
-
|
1584 |
-
// strip slashes (search may be integer)
|
1585 |
-
$s = wp_unslash( strval($options['s']) );
|
1586 |
-
|
1587 |
-
// update vars
|
1588 |
-
$args['s'] = $s;
|
1589 |
-
$is_search = true;
|
1590 |
-
|
1591 |
-
}
|
1592 |
|
1593 |
-
|
1594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1595 |
|
1596 |
-
//
|
1597 |
-
|
1598 |
|
1599 |
-
//
|
1600 |
-
|
1601 |
-
return false;
|
1602 |
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
$children[] = array(
|
1615 |
-
'id' => $options['value'],
|
1616 |
-
'text' => $options['value'],
|
1617 |
-
);
|
1618 |
-
|
1619 |
-
}
|
1620 |
-
|
1621 |
-
$results[] = array(
|
1622 |
-
'text' => 'Generic',
|
1623 |
-
'children' => $children
|
1624 |
-
);
|
1625 |
|
1626 |
-
|
|
|
|
|
1627 |
|
1628 |
-
|
1629 |
-
foreach(array_keys($groups) as $group_title){
|
1630 |
-
|
1631 |
-
// vars
|
1632 |
-
$posts = acf_extract_var($groups, $group_title);
|
1633 |
-
|
1634 |
-
// data
|
1635 |
-
$data = array(
|
1636 |
-
'text' => $group_title,
|
1637 |
-
'children' => array()
|
1638 |
-
);
|
1639 |
-
|
1640 |
-
// convert post objects to post titles
|
1641 |
-
foreach(array_keys($posts) as $post_id){
|
1642 |
-
|
1643 |
-
$posts[$post_id] = $field_type->get_post_title($posts[$post_id], $field, $options['post_id'], $is_search);
|
1644 |
-
|
1645 |
-
}
|
1646 |
-
|
1647 |
-
// order posts by search
|
1648 |
-
if($is_search && empty($args['orderby'])){
|
1649 |
-
|
1650 |
-
$posts = acf_order_by_search($posts, $args['s']);
|
1651 |
-
|
1652 |
-
}
|
1653 |
-
|
1654 |
-
// append to $data
|
1655 |
-
foreach(array_keys($posts) as $post_id){
|
1656 |
-
|
1657 |
-
$data['children'][] = $field_type->get_post_result($post_id, $posts[$post_id]);
|
1658 |
-
|
1659 |
-
}
|
1660 |
-
|
1661 |
-
// append to $results
|
1662 |
-
$results[] = $data;
|
1663 |
-
|
1664 |
-
}
|
1665 |
|
|
|
|
|
1666 |
|
1667 |
-
|
1668 |
-
$post_type = acf_get_array($args['post_type']);
|
1669 |
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1681 |
|
1682 |
-
//
|
1683 |
-
return $response;
|
1684 |
|
1685 |
}
|
1686 |
|
|
|
1687 |
/**
|
1688 |
-
*
|
1689 |
*/
|
1690 |
-
|
|
|
|
|
|
|
|
|
1691 |
|
1692 |
-
|
1693 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1694 |
|
1695 |
-
|
|
|
|
|
1696 |
|
1697 |
-
|
1698 |
|
1699 |
-
$field['
|
|
|
|
|
|
|
1700 |
|
1701 |
}
|
1702 |
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1707 |
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
if($posts){
|
1712 |
-
|
1713 |
-
foreach(array_keys($posts) as $i){
|
1714 |
-
|
1715 |
-
// vars
|
1716 |
-
$post = acf_extract_var($posts, $i);
|
1717 |
-
|
1718 |
-
// append to choices
|
1719 |
-
$field['choices'][$post->ID] = $field_type->get_post_title( $post, $field );
|
1720 |
-
|
1721 |
-
}
|
1722 |
-
|
1723 |
-
}
|
1724 |
|
1725 |
-
return $
|
1726 |
|
1727 |
}
|
1728 |
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
|
|
1733 |
|
1734 |
-
|
1735 |
-
die();
|
1736 |
|
1737 |
-
|
1738 |
-
|
|
|
|
|
1739 |
|
1740 |
-
|
1741 |
-
|
1742 |
-
return;
|
1743 |
|
1744 |
-
|
1745 |
-
acf_send_ajax_results($response);
|
1746 |
|
1747 |
}
|
1748 |
|
1749 |
-
|
|
|
1750 |
|
1751 |
-
|
1752 |
-
|
1753 |
-
'post_id' => 0,
|
1754 |
-
's' => '',
|
1755 |
-
'field_key' => '',
|
1756 |
-
'paged' => 1,
|
1757 |
-
'value' => '',
|
1758 |
-
));
|
1759 |
|
1760 |
-
|
1761 |
-
$field = acf_get_field($options['field_key']);
|
1762 |
-
if(!$field)
|
1763 |
-
return false;
|
1764 |
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
|
|
1768 |
|
1769 |
-
|
1770 |
-
|
1771 |
-
$args = array();
|
1772 |
-
$s = false;
|
1773 |
-
$is_search = false;
|
1774 |
|
1775 |
-
|
1776 |
-
$args['posts_per_page'] = 20;
|
1777 |
-
$args['paged'] = $options['paged'];
|
1778 |
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
$s = wp_unslash( strval($options['s']) );
|
1784 |
-
|
1785 |
-
// update vars
|
1786 |
-
$args['s'] = $s;
|
1787 |
-
$is_search = true;
|
1788 |
-
|
1789 |
-
}
|
1790 |
|
1791 |
-
|
1792 |
-
'number' => $args['posts_per_page'],
|
1793 |
-
'offset' => ($args['paged'] - 1) * $args['posts_per_page'],
|
1794 |
-
);
|
1795 |
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
|
|
1799 |
|
1800 |
-
|
1801 |
-
if(empty($groups))
|
1802 |
-
return false;
|
1803 |
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
);
|
1812 |
|
1813 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1814 |
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1819 |
|
1820 |
}
|
1821 |
|
1822 |
-
$results[] = array(
|
1823 |
-
'text' => 'Generic',
|
1824 |
-
'children' => $children
|
1825 |
-
);
|
1826 |
-
|
1827 |
}
|
1828 |
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1834 |
|
1835 |
-
|
1836 |
-
$data = array(
|
1837 |
-
'text' => $group_title,
|
1838 |
-
'children' => array()
|
1839 |
-
);
|
1840 |
|
1841 |
-
if($
|
1842 |
|
1843 |
-
$
|
1844 |
|
1845 |
-
|
1846 |
-
|
1847 |
-
// append to $data
|
1848 |
-
foreach($terms as $term_id => $name){
|
1849 |
|
1850 |
-
$
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
|
|
1854 |
|
1855 |
}
|
1856 |
|
1857 |
-
|
1858 |
-
$results[] = $data;
|
1859 |
|
1860 |
}
|
1861 |
|
1862 |
-
// vars
|
1863 |
-
$response = array(
|
1864 |
-
'results' => $results,
|
1865 |
-
'limit' => $args['posts_per_page']
|
1866 |
-
);
|
1867 |
-
|
1868 |
-
// return
|
1869 |
-
return $response;
|
1870 |
-
|
1871 |
}
|
1872 |
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
|
|
|
|
|
|
|
|
1884 |
|
1885 |
-
|
1886 |
-
|
1887 |
-
$field['choices'][$field['value']] = $field['value'];
|
1888 |
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1899 |
|
1900 |
-
$
|
1901 |
|
1902 |
}
|
1903 |
|
1904 |
-
return $field;
|
1905 |
-
|
1906 |
}
|
1907 |
|
1908 |
-
|
1909 |
-
* User: Select2 Ajax
|
1910 |
-
*/
|
1911 |
-
function ajax_query_user(){
|
1912 |
-
|
1913 |
-
if(!acf_verify_ajax())
|
1914 |
-
die();
|
1915 |
-
|
1916 |
-
// get choices
|
1917 |
-
$response = $this->get_ajax_query_user($_POST);
|
1918 |
-
|
1919 |
-
// return
|
1920 |
-
if(!$response)
|
1921 |
-
return;
|
1922 |
-
|
1923 |
-
// return ajax
|
1924 |
-
acf_send_ajax_results($response);
|
1925 |
-
|
1926 |
-
}
|
1927 |
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
// load field
|
1941 |
-
$field = acf_get_field($options['field_key']);
|
1942 |
-
if(!$field)
|
1943 |
-
return false;
|
1944 |
-
|
1945 |
-
// Target field name
|
1946 |
-
if(!in_array($field['name'], $this->users))
|
1947 |
-
return false;
|
1948 |
-
|
1949 |
-
$field_type = acf_get_field_type('user');
|
1950 |
-
|
1951 |
-
// vars
|
1952 |
-
$results = array();
|
1953 |
-
$args = array();
|
1954 |
-
$s = false;
|
1955 |
-
$is_search = false;
|
1956 |
-
|
1957 |
-
// paged
|
1958 |
-
$args['users_per_page'] = 20;
|
1959 |
-
$args['paged'] = $options['paged'];
|
1960 |
-
|
1961 |
-
// search
|
1962 |
-
if($options['s'] !== ''){
|
1963 |
-
|
1964 |
-
// strip slashes (search may be integer)
|
1965 |
-
$s = wp_unslash( strval($options['s']) );
|
1966 |
-
|
1967 |
-
// update vars
|
1968 |
-
$args['s'] = $s;
|
1969 |
-
$is_search = true;
|
1970 |
-
|
1971 |
-
}
|
1972 |
|
1973 |
-
//
|
1974 |
-
|
1975 |
|
1976 |
-
|
1977 |
-
|
1978 |
-
}
|
1979 |
|
1980 |
-
|
1981 |
-
if($is_search){
|
1982 |
|
1983 |
-
|
1984 |
-
$args['search'] = '*' . $options['s'] . '*';
|
1985 |
-
|
1986 |
-
// add reference
|
1987 |
-
$field_type->field = $field;
|
1988 |
-
|
1989 |
-
// add filter to modify search colums
|
1990 |
-
add_filter('user_search_columns', array($field_type, 'user_search_columns'), 10, 3);
|
1991 |
|
1992 |
}
|
1993 |
|
1994 |
-
|
1995 |
-
$groups = acf_get_grouped_users($args);
|
1996 |
-
|
1997 |
-
if(!$is_search && $args['paged'] === 1){
|
1998 |
-
|
1999 |
-
$children = array();
|
2000 |
|
2001 |
-
$
|
2002 |
-
'id' => 'current_user',
|
2003 |
-
'text' => 'Current User',
|
2004 |
-
);
|
2005 |
|
2006 |
-
$
|
2007 |
-
'id' => 'current_post_author',
|
2008 |
-
'text' => 'Current Post Author',
|
2009 |
-
);
|
2010 |
|
2011 |
-
|
2012 |
|
2013 |
-
$
|
2014 |
-
|
2015 |
-
'text' => $options['value'],
|
2016 |
-
);
|
2017 |
|
2018 |
-
|
2019 |
-
|
2020 |
-
$results[] = array(
|
2021 |
-
'text' => 'Generic',
|
2022 |
-
'children' => $children
|
2023 |
-
);
|
2024 |
-
|
2025 |
-
}
|
2026 |
-
|
2027 |
-
// loop
|
2028 |
-
if(!empty($groups)){
|
2029 |
-
|
2030 |
-
foreach(array_keys($groups) as $group_title){
|
2031 |
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
'text' => $group_title,
|
2036 |
-
'children' => array()
|
2037 |
-
);
|
2038 |
|
2039 |
-
|
2040 |
-
foreach( array_keys($users) as $user_id ) {
|
2041 |
|
2042 |
-
$
|
|
|
2043 |
|
2044 |
-
|
2045 |
-
|
2046 |
-
// order by search
|
2047 |
-
if( $is_search && empty($args['orderby']) ) {
|
2048 |
|
2049 |
-
|
|
|
2050 |
|
2051 |
-
|
2052 |
-
|
2053 |
-
// append to $data
|
2054 |
-
foreach( $users as $id => $title ) {
|
2055 |
|
2056 |
-
|
2057 |
-
'id' => $id,
|
2058 |
-
'text' => $title
|
2059 |
-
);
|
2060 |
|
2061 |
}
|
2062 |
|
2063 |
-
// append to $r
|
2064 |
-
$results[] = $data;
|
2065 |
-
|
2066 |
}
|
2067 |
|
2068 |
-
//
|
2069 |
-
|
2070 |
-
|
2071 |
-
$results = $results[0]['children'];
|
2072 |
-
|
2073 |
-
}
|
2074 |
}
|
2075 |
|
2076 |
-
// vars
|
2077 |
-
$response = array(
|
2078 |
-
'results' => $results,
|
2079 |
-
'limit' => $args['users_per_page']
|
2080 |
-
);
|
2081 |
-
|
2082 |
-
// return
|
2083 |
-
return $response;
|
2084 |
-
|
2085 |
}
|
2086 |
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2091 |
|
2092 |
-
|
2093 |
-
|
2094 |
|
2095 |
-
$
|
2096 |
|
2097 |
-
if(
|
2098 |
|
2099 |
-
$
|
2100 |
|
2101 |
}
|
2102 |
|
2103 |
-
$
|
2104 |
-
$field['choices']['current_post_author'] = 'Current Post Author';
|
2105 |
-
|
2106 |
-
$field_type = acf_get_field_type('user');
|
2107 |
-
|
2108 |
-
// Clean value into an array of IDs.
|
2109 |
-
$user_ids = array_map('intval', acf_array($field['value']));
|
2110 |
-
|
2111 |
-
// Find users in database (ensures all results are real).
|
2112 |
-
$users = acf_get_users(array(
|
2113 |
-
'include' => $user_ids
|
2114 |
-
));
|
2115 |
|
2116 |
-
|
2117 |
-
if($users){
|
2118 |
|
2119 |
-
foreach($
|
2120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2121 |
}
|
2122 |
|
2123 |
}
|
2124 |
|
2125 |
-
|
|
|
2126 |
|
2127 |
}
|
2128 |
|
2129 |
-
|
2130 |
-
|
2131 |
-
// initialize
|
2132 |
-
acfe()->acfe_form = new acfe_form();
|
2133 |
-
|
2134 |
-
endif;
|
2135 |
-
|
2136 |
-
function acfe_form_render_fields($content, $post_id, $args){
|
2137 |
-
|
2138 |
-
return acfe()->acfe_form->render_fields($content, $post_id, $args);
|
2139 |
-
|
2140 |
-
}
|
2141 |
-
|
2142 |
-
function acfe_form_map_field_value($field, $acf, $post_id = 0){
|
2143 |
-
|
2144 |
-
return acfe()->acfe_form->map_field_value($field, $acf, $post_id);
|
2145 |
-
|
2146 |
-
}
|
2147 |
-
|
2148 |
-
function acfe_form_map_field_get_value($field){
|
2149 |
-
|
2150 |
-
return acfe()->acfe_form->map_field_get_value($field);
|
2151 |
-
|
2152 |
-
}
|
2153 |
-
|
2154 |
-
function acfe_form_filter_meta($meta, $acf){
|
2155 |
-
|
2156 |
-
return acfe()->acfe_form->filter_meta($meta, $acf);
|
2157 |
|
2158 |
}
|
2159 |
|
2160 |
-
function
|
2161 |
|
2162 |
-
|
2163 |
-
return $content;
|
2164 |
|
2165 |
-
|
2166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2167 |
|
2168 |
-
|
2169 |
-
if(preg_match_all('/{query_var:(.*?)}/', $content, $matches)){
|
2170 |
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
if(strpos($name, ':') !== false){
|
2176 |
-
|
2177 |
-
$explode = explode(':', $name);
|
2178 |
-
|
2179 |
-
$query_var = get_query_var($explode[0]);
|
2180 |
-
|
2181 |
-
if(is_array($query_var) && isset($query_var[$explode[1]])){
|
2182 |
-
|
2183 |
-
$query_var = $query_var[$explode[1]];
|
2184 |
-
|
2185 |
-
}
|
2186 |
-
|
2187 |
-
}
|
2188 |
-
|
2189 |
-
$content = str_replace('{query_var:' . $name . '}', $query_var, $content);
|
2190 |
-
|
2191 |
-
}
|
2192 |
|
2193 |
}
|
2194 |
|
2195 |
-
return $
|
2196 |
|
2197 |
}
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
+
// Register notices store.
|
7 |
+
acf_register_store('acfe/form')->prop('multisite', true);
|
8 |
+
|
9 |
if(!class_exists('acfe_form')):
|
10 |
|
11 |
class acfe_form{
|
16 |
public $posts = array();
|
17 |
public $users = array();
|
18 |
|
19 |
+
public $query_vars = array();
|
20 |
+
|
21 |
function __construct(){
|
22 |
|
23 |
// Post Type
|
34 |
add_filter('acf/pre_load_post_id', array($this, 'validate_post_id'), 10, 2);
|
35 |
|
36 |
// Fields
|
37 |
+
add_filter('acf/load_value/name=acfe_form_custom_html_enable', array($this, 'prepare_custom_html'), 10, 3);
|
38 |
add_filter('acf/prepare_field/name=acfe_form_actions', array($this, 'prepare_actions'));
|
39 |
add_filter('acf/prepare_field/name=acfe_form_field_groups', array($this, 'field_groups_choices'));
|
|
|
40 |
|
41 |
// Format values
|
42 |
add_filter('acfe/form/format_value/type=post_object', array($this, 'format_value_post_object'), 5, 4);
|
48 |
add_filter('acfe/form/format_value/type=select', array($this, 'format_value_select'), 5, 4);
|
49 |
add_filter('acfe/form/format_value/type=checkbox', array($this, 'format_value_select'), 5, 4);
|
50 |
add_filter('acfe/form/format_value/type=radio', array($this, 'format_value_select'), 5, 4);
|
51 |
+
add_filter('acfe/form/format_value/type=google_map', array($this, 'format_value_google_map'), 5, 4);
|
52 |
+
|
53 |
+
add_action('acf/render_field/name=acfe_form_validation_advanced_field_validation', array($this, 'doc_validation_field'));
|
54 |
+
add_action('acf/render_field/name=acfe_form_validation_advanced_form_validation', array($this, 'doc_validation_form'));
|
55 |
+
add_action('acf/render_field/name=acfe_form_submission_advanced_submission', array($this, 'doc_submission'));
|
56 |
+
|
57 |
+
add_action('acf/render_field/name=acfe_form_cheatsheet_field', array($this, 'doc_field'));
|
58 |
+
add_action('acf/render_field/name=acfe_form_cheatsheet_fields', array($this, 'doc_fields'));
|
59 |
+
add_action('acf/render_field/name=acfe_form_cheatsheet_get_field', array($this, 'doc_get_field'));
|
60 |
+
add_action('acf/render_field/name=acfe_form_cheatsheet_query_var', array($this, 'doc_query_var'));
|
61 |
+
add_action('acf/render_field/name=acfe_form_cheatsheet_current_post', array($this, 'doc_current_post'));
|
62 |
+
add_action('acf/render_field/name=acfe_form_cheatsheet_current_term', array($this, 'doc_current_term'));
|
63 |
+
add_action('acf/render_field/name=acfe_form_cheatsheet_current_user', array($this, 'doc_current_user'));
|
64 |
+
add_action('acf/render_field/name=acfe_form_cheatsheet_current_author', array($this, 'doc_current_author'));
|
65 |
+
add_action('acf/render_field/name=acfe_form_cheatsheet_current_form', array($this, 'doc_current_form'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
// Ajax
|
68 |
+
/*
|
69 |
add_action('wp_ajax_acf/fields/select/query', array($this, 'ajax_query_post'), 5);
|
70 |
add_action('wp_ajax_nopriv_acf/fields/select/query', array($this, 'ajax_query_post'), 5);
|
71 |
|
74 |
|
75 |
add_action('wp_ajax_acf/fields/select/query', array($this, 'ajax_query_term'), 5);
|
76 |
add_action('wp_ajax_nopriv_acf/fields/select/query', array($this, 'ajax_query_term'), 5);
|
77 |
+
*/
|
78 |
}
|
79 |
|
80 |
function init(){
|
113 |
'edit_post' => acf_get_setting('capability'),
|
114 |
'delete_post' => acf_get_setting('capability'),
|
115 |
'read_post' => acf_get_setting('capability'),
|
116 |
+
),
|
117 |
+
'acfe_admin_ppp' => 999,
|
118 |
+
'acfe_admin_orderby' => 'title',
|
119 |
+
'acfe_admin_order' => 'ASC',
|
120 |
));
|
121 |
|
122 |
}
|
154 |
|
155 |
function load_list(){
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
// Columns
|
158 |
add_filter('manage_edit-' . $this->post_type . '_columns', array($this, 'admin_columns'));
|
159 |
add_action('manage_' . $this->post_type . '_posts_custom_column', array($this, 'admin_columns_html'), 10, 2);
|
165 |
// vars
|
166 |
$this->fields_groups = $this->get_fields_groups();
|
167 |
|
168 |
+
add_action('add_meta_boxes', array($this, 'add_meta_boxes'));
|
|
|
|
|
169 |
|
170 |
// Misc actions
|
171 |
+
add_action('post_submitbox_misc_actions', array($this, 'misc_actions'));
|
172 |
+
|
173 |
+
// Actions
|
174 |
+
$form_id = $_REQUEST['post'];
|
175 |
+
|
176 |
+
if(have_rows('acfe_form_actions', $form_id)):
|
177 |
+
|
178 |
+
while(have_rows('acfe_form_actions', $form_id)): the_row();
|
179 |
+
|
180 |
+
$action = get_row_layout();
|
181 |
+
|
182 |
+
// Custom Action
|
183 |
+
if($action === 'custom')
|
184 |
+
continue;
|
185 |
+
|
186 |
+
$alias = get_sub_field('acfe_form_custom_alias');
|
187 |
+
$query_var = get_sub_field('acfe_form_custom_query_var');
|
188 |
+
|
189 |
+
$action_label = '';
|
190 |
+
$action_type = '';
|
191 |
+
|
192 |
+
if($action === 'post'){
|
193 |
+
|
194 |
+
$action_label = 'Post';
|
195 |
+
|
196 |
+
$post_action = get_sub_field('acfe_form_post_action');
|
197 |
+
|
198 |
+
if($post_action === 'insert_post'){
|
199 |
+
|
200 |
+
$action_type = 'Create Post';
|
201 |
+
|
202 |
+
}elseif($post_action === 'update_post'){
|
203 |
+
|
204 |
+
$action_type = 'Update Post';
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
|
209 |
+
}elseif($action === 'term'){
|
210 |
+
|
211 |
+
$action_label = 'Term';
|
212 |
+
|
213 |
+
$term_action = get_sub_field('acfe_form_term_action');
|
214 |
+
|
215 |
+
if($term_action === 'insert_term'){
|
216 |
+
|
217 |
+
$action_type = 'Create Term';
|
218 |
+
|
219 |
+
}elseif($term_action === 'update_term'){
|
220 |
+
|
221 |
+
$action_type = 'Update Term';
|
222 |
+
|
223 |
+
}
|
224 |
+
|
225 |
+
}elseif($action === 'user'){
|
226 |
+
|
227 |
+
$action_label = 'User';
|
228 |
+
|
229 |
+
$term_action = get_sub_field('acfe_form_user_action');
|
230 |
+
|
231 |
+
if($term_action === 'insert_user'){
|
232 |
+
|
233 |
+
$action_type = 'Create User';
|
234 |
+
|
235 |
+
}elseif($term_action === 'update_user'){
|
236 |
+
|
237 |
+
$action_type = 'Update User';
|
238 |
+
|
239 |
+
}elseif($term_action === 'log_user'){
|
240 |
+
|
241 |
+
$action_type = 'Log User';
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
}elseif($action === 'email'){
|
246 |
+
|
247 |
+
$action_label = 'E-mail';
|
248 |
+
$action_type = 'Send';
|
249 |
+
|
250 |
+
}
|
251 |
+
|
252 |
+
if(empty($alias) || empty($query_var))
|
253 |
+
continue;
|
254 |
+
|
255 |
+
$this->query_vars[] = array(
|
256 |
+
'action' => $action,
|
257 |
+
'action_label' => $action_label,
|
258 |
+
'action_type' => $action_type,
|
259 |
+
'alias' => $alias
|
260 |
+
);
|
261 |
+
|
262 |
+
endwhile;
|
263 |
+
endif;
|
264 |
|
265 |
}
|
266 |
|
428 |
|
429 |
function add_meta_boxes(){
|
430 |
|
431 |
+
// Add Instructions
|
|
|
|
|
|
|
|
|
432 |
add_meta_box(
|
433 |
+
|
434 |
// ID
|
435 |
+
'acfe-form-integration',
|
436 |
|
437 |
// Title
|
438 |
+
'Integration',
|
439 |
|
440 |
// Render
|
441 |
+
array($this, 'render_form_integration_meta_box'),
|
442 |
|
443 |
// Screen
|
444 |
$this->post_type,
|
445 |
|
446 |
// Position
|
447 |
+
'side',
|
448 |
|
449 |
// Priority
|
450 |
+
'core'
|
451 |
|
452 |
);
|
453 |
|
454 |
+
$data = $this->fields_groups;
|
455 |
+
|
456 |
+
if(!empty($data)){
|
457 |
+
|
458 |
+
add_meta_box(
|
459 |
+
|
460 |
+
// ID
|
461 |
+
'acfe-form-details',
|
462 |
+
|
463 |
+
// Title
|
464 |
+
__('Fields', 'acf'),
|
465 |
+
|
466 |
+
// Render
|
467 |
+
array($this, 'render_form_details_meta_box'),
|
468 |
+
|
469 |
+
// Screen
|
470 |
+
$this->post_type,
|
471 |
+
|
472 |
+
// Position
|
473 |
+
'normal',
|
474 |
+
|
475 |
+
// Priority
|
476 |
+
'default'
|
477 |
+
|
478 |
+
);
|
479 |
+
|
480 |
+
}
|
481 |
+
|
482 |
+
}
|
483 |
+
|
484 |
+
function render_form_integration_meta_box($post){
|
485 |
+
|
486 |
+
$form_id = $post->ID;
|
487 |
+
$form_name = get_field('acfe_form_name', $form_id);
|
488 |
+
|
489 |
+
?>
|
490 |
+
<div class="acf-field">
|
491 |
+
|
492 |
+
<div class="acf-label">
|
493 |
+
<label>Shortcodes:</label>
|
494 |
+
</div>
|
495 |
+
|
496 |
+
<div class="acf-input">
|
497 |
+
|
498 |
+
<code>[acfe_form ID="<?php echo $form_id; ?>"]</code><br /><br />
|
499 |
+
<code>[acfe_form name="<?php echo $form_name; ?>"]</code>
|
500 |
+
|
501 |
+
</div>
|
502 |
+
|
503 |
+
</div>
|
504 |
+
|
505 |
+
<div class="acf-field">
|
506 |
+
|
507 |
+
<div class="acf-label">
|
508 |
+
<label>PHP code:</label>
|
509 |
+
</div>
|
510 |
+
|
511 |
+
<div class="acf-input">
|
512 |
+
|
513 |
+
<pre><?php get_header(); ?>
|
514 |
+
|
515 |
+
<!-- <?php echo get_the_title($form_id); ?> -->
|
516 |
+
<?php acfe_form('<?php echo $form_name; ?>'); ?>
|
517 |
+
|
518 |
+
<?php get_footer(); ?></pre>
|
519 |
+
|
520 |
+
</div>
|
521 |
+
|
522 |
+
</div>
|
523 |
+
|
524 |
+
<script type="text/javascript">
|
525 |
+
if(typeof acf !== 'undefined'){
|
526 |
+
|
527 |
+
acf.newPostbox(<?php echo wp_json_encode(array(
|
528 |
+
'id' => 'acfe-form-integration',
|
529 |
+
'key' => '',
|
530 |
+
'style' => 'default',
|
531 |
+
'label' => 'top',
|
532 |
+
'edit' => false
|
533 |
+
)); ?>);
|
534 |
+
|
535 |
+
}
|
536 |
+
</script>
|
537 |
+
<?php
|
538 |
}
|
539 |
|
540 |
+
function render_form_details_meta_box($array, $data){
|
541 |
|
542 |
foreach($this->fields_groups as $field_group){ ?>
|
543 |
|
589 |
|
590 |
<tr class="acf-row">
|
591 |
<td width="25%"><?php echo $field_label; ?></td>
|
592 |
+
<td width="25%"><code style="font-size:12px;"><?php echo $field['name']; ?></code></td>
|
593 |
+
<td width="25%"><code style="font-size:12px;"><?php echo $field_key; ?></code></td>
|
594 |
<td width="25%"><?php echo $type_label; ?></td>
|
595 |
</tr>
|
596 |
|
690 |
|
691 |
}
|
692 |
|
693 |
+
function prepare_custom_html($value, $post_id, $field){
|
694 |
+
|
695 |
+
$custom_html = trim(get_field('acfe_form_custom_html', $post_id));
|
696 |
+
|
697 |
+
if($value === false && !empty($custom_html))
|
698 |
+
$value = true;
|
699 |
+
|
700 |
+
return $value;
|
701 |
+
|
702 |
+
}
|
703 |
+
|
704 |
function prepare_actions($field){
|
705 |
|
706 |
$field['instructions'] = 'Add actions on form submission';
|
716 |
return $field;
|
717 |
|
718 |
}
|
719 |
+
|
720 |
+
function map_fields_deep_no_custom($field){
|
721 |
+
|
722 |
+
$choices = array();
|
723 |
+
|
724 |
+
if(!empty($field['choices'])){
|
725 |
+
|
726 |
+
$generic = true;
|
727 |
+
|
728 |
+
if(is_array($field['choices']) && count($field['choices']) === 1){
|
729 |
+
|
730 |
+
reset($field['choices']);
|
731 |
+
$key = key($field['choices']);
|
732 |
+
|
733 |
+
if(acf_is_field_key($key))
|
734 |
+
$generic = false;
|
735 |
+
|
736 |
+
}
|
737 |
+
|
738 |
+
if($generic)
|
739 |
+
$choices['Generic'] = $field['choices'];
|
740 |
+
|
741 |
+
}
|
742 |
+
|
743 |
+
$fields_choices = $this->get_fields_choices(true, $field);
|
744 |
+
|
745 |
+
if(!empty($fields_choices)){
|
746 |
+
|
747 |
+
$field['choices'] = array_merge($choices, $fields_choices);
|
748 |
+
|
749 |
+
}
|
750 |
+
|
751 |
+
return $field;
|
752 |
+
|
753 |
+
}
|
754 |
|
755 |
function map_fields_deep($field){
|
756 |
|
757 |
+
// Map Fields
|
758 |
+
$fields_choices = $this->get_fields_choices(true, $field);
|
759 |
+
|
760 |
+
if(!empty($fields_choices)){
|
761 |
+
|
762 |
+
$field['choices'] = array_merge($field['choices'], $fields_choices);
|
763 |
+
|
764 |
+
}
|
765 |
+
|
766 |
+
if($field['type'] === 'select'){
|
767 |
+
|
768 |
+
// Query Vars
|
769 |
+
if(!empty($this->query_vars)){
|
770 |
+
|
771 |
+
parse_str($field['prefix'], $output);
|
772 |
+
$keys = acfe_array_keys_r($output);
|
773 |
+
|
774 |
+
if(acf_maybe_get($keys, 1) !== 'field_acfe_form_actions')
|
775 |
+
return $field;
|
776 |
+
|
777 |
+
foreach($this->query_vars as $row => $query_var){
|
778 |
+
|
779 |
+
$field_row = acf_maybe_get($keys, 2);
|
780 |
+
$field_row = str_replace('row-', '', $field_row);
|
781 |
+
|
782 |
+
if((is_numeric($field_row) && $field_row > $row) || $field_row === 'acfcloneindex'){
|
783 |
+
|
784 |
+
$action = $query_var['action'];
|
785 |
+
$action_label = $query_var['action_label'];
|
786 |
+
$action_type = $query_var['action_type'];
|
787 |
+
$alias = $query_var['alias'];
|
788 |
+
|
789 |
+
$tags = array();
|
790 |
+
|
791 |
+
if($action === 'post'){
|
792 |
+
|
793 |
+
$tags = array(
|
794 |
+
"{query_var:$alias:id}" => 'Post ID',
|
795 |
+
"{query_var:$alias:post_title}" => 'Title',
|
796 |
+
"{query_var:$alias:permalink}" => 'Permalink',
|
797 |
+
"{query_var:$alias:admin_url}" => 'Admin URL',
|
798 |
+
);
|
799 |
+
|
800 |
+
}
|
801 |
+
|
802 |
+
elseif($action === 'term'){
|
803 |
+
|
804 |
+
$tags = array(
|
805 |
+
"{query_var:$alias:id}" => 'Term ID',
|
806 |
+
"{query_var:$alias:name}" => 'Name',
|
807 |
+
"{query_var:$alias:permalink}" => 'Permalink',
|
808 |
+
"{query_var:$alias:admin_url}" => 'Admin URL',
|
809 |
+
);
|
810 |
+
|
811 |
+
}
|
812 |
+
|
813 |
+
elseif($action === 'user'){
|
814 |
+
|
815 |
+
$tags = array(
|
816 |
+
"{query_var:$alias:id}" => 'User ID',
|
817 |
+
"{query_var:$alias:user_email}" => 'E-mail',
|
818 |
+
"{query_var:$alias:permalink}" => 'Permalink',
|
819 |
+
);
|
820 |
+
|
821 |
+
}
|
822 |
+
|
823 |
+
elseif($action === 'email'){
|
824 |
+
|
825 |
+
$tags = array(
|
826 |
+
"{query_var:$alias:from}" => 'From',
|
827 |
+
"{query_var:$alias:to}" => 'To',
|
828 |
+
"{query_var:$alias:content}" => 'Content',
|
829 |
+
);
|
830 |
+
|
831 |
+
}
|
832 |
+
|
833 |
+
foreach($tags as $tag_key => $tag_value){
|
834 |
+
|
835 |
+
$field['choices']["Action: $action_type ($alias)"][$tag_key] = $tag_value . ' ' . $tag_key;
|
836 |
+
|
837 |
+
}
|
838 |
+
|
839 |
+
}
|
840 |
+
|
841 |
+
}
|
842 |
+
}
|
843 |
+
|
844 |
+
// Templates Tags Examples
|
845 |
+
$field['choices']["Current: Post"]['{current:post:id}'] = 'Post ID {current:post:id}';
|
846 |
+
$field['choices']["Current: Post"]['{current:post:post_title}'] = 'Title {current:post:post_title}';
|
847 |
+
$field['choices']["Current: Post"]['{current:post:permalink}'] = 'Permalink {current:post:permalink}';
|
848 |
+
$field['choices']["Current: Post"]['{current:post:post_author}'] = 'Author {current:post:post_author}';
|
849 |
|
850 |
+
$field['choices']["Current: Term"]['{current:term:id}'] = 'Term ID {current:term:id}';
|
851 |
+
$field['choices']["Current: Term"]['{current:term:name}'] = 'Name {current:term:name}';
|
852 |
+
$field['choices']["Current: Term"]['{current:term:permalink}'] = 'Permalink {current:term:permalink}';
|
853 |
+
|
854 |
+
$field['choices']["Current: User"]['{current:user:id}'] = 'User ID {current:user:id}';
|
855 |
+
$field['choices']["Current: User"]['{current:user:user_email}'] = 'E-mail {current:user:user_email}';
|
856 |
+
$field['choices']["Current: User"]['{current:user:permalink}'] = 'Permalink {current:user:permalink}';
|
857 |
+
|
858 |
+
$field['choices']["Current: Author"]['{current:author:id}'] = 'Author ID {current:author:id}';
|
859 |
+
$field['choices']["Current: Author"]['{current:author:user_email}'] = 'E-mail {current:author:user_email}';
|
860 |
+
$field['choices']["Current: Author"]['{current:author:permalink}'] = 'Permalink {current:author:permalink}';
|
861 |
+
|
862 |
+
$field['choices']["Current: Form"]['{current:form:id}'] = 'Form ID {current:form:id}';
|
863 |
+
$field['choices']["Current: Form"]['{current:form:title}'] = 'Title {current:form:title}';
|
864 |
+
$field['choices']["Current: Form"]['{current:form:name}'] = 'Name {current:form:name}';
|
865 |
|
866 |
}
|
867 |
+
|
868 |
+
// Clean Choices
|
869 |
+
if(!empty($field['choices'])){
|
870 |
+
|
871 |
+
$sub_values = array();
|
872 |
+
|
873 |
+
foreach($field['choices'] as $category => $values){
|
874 |
+
|
875 |
+
// Generate available values
|
876 |
+
if(is_array($values)){
|
877 |
+
|
878 |
+
$sub_values = array_merge($sub_values, $values);
|
879 |
+
|
880 |
+
// Generate 'Generic'
|
881 |
+
}else{
|
882 |
+
|
883 |
+
unset($field['choices'][$category]);
|
884 |
+
|
885 |
+
$field['choices']['Generic'][$category] = $values;
|
886 |
+
|
887 |
+
}
|
888 |
+
|
889 |
+
}
|
890 |
+
|
891 |
+
// Compare available vs Generic
|
892 |
+
if(isset($field['choices']['Generic'])){
|
893 |
+
|
894 |
+
foreach($field['choices']['Generic'] as $k => $generic){
|
895 |
+
|
896 |
+
if(!isset($sub_values[$k]))
|
897 |
+
continue;
|
898 |
+
|
899 |
+
// Cleanup
|
900 |
+
unset($field['choices']['Generic'][$k]);
|
901 |
+
|
902 |
+
}
|
903 |
+
|
904 |
+
if(empty($field['choices']['Generic']))
|
905 |
+
unset($field['choices']['Generic']);
|
906 |
+
|
907 |
+
}
|
908 |
+
|
909 |
+
// Move Generic to Top
|
910 |
+
if(isset($field['choices']['Generic'])){
|
911 |
+
|
912 |
+
$new_generic = array(
|
913 |
+
'Generic' => $field['choices']['Generic']
|
914 |
+
);
|
915 |
+
|
916 |
+
unset($field['choices']['Generic']);
|
917 |
+
|
918 |
+
$field['choices'] = array_merge($new_generic, $field['choices']);
|
919 |
+
|
920 |
+
}
|
921 |
+
|
922 |
+
}
|
923 |
|
924 |
return $field;
|
925 |
|
938 |
|
939 |
}
|
940 |
|
941 |
+
function get_fields_choices($deep = false, $original_field = array()){
|
942 |
|
943 |
$data = $this->fields_groups;
|
944 |
$choices = array();
|
981 |
// Deep
|
982 |
}else{
|
983 |
|
984 |
+
$this->get_fields_choices_recursive($choices[$field_group_title], $field, $original_field);
|
985 |
|
986 |
}
|
987 |
|
995 |
|
996 |
}
|
997 |
|
998 |
+
function get_fields_choices_recursive(&$choices, $field, $original_field){
|
999 |
|
1000 |
$label = '';
|
1001 |
|
1005 |
$label .= !empty($field['label']) ? $field['label'] : '(' . __('no label', 'acf') . ')';
|
1006 |
$label .= $field['required'] ? ' *' : '';
|
1007 |
|
1008 |
+
/*
|
1009 |
+
if(acf_maybe_get($original_field, 'type') === 'select'){
|
1010 |
+
|
1011 |
+
$label = $label . ' <code style="font-size:12px;">{field:' . $field['name'] . '}</code>';
|
1012 |
+
|
1013 |
+
}else{
|
1014 |
+
|
1015 |
+
$label = $label . ' (' . $field['key'] . ')';
|
1016 |
+
|
1017 |
+
}
|
1018 |
+
*/
|
1019 |
+
|
1020 |
+
$label = $label . ' (' . $field['key'] . ')';
|
1021 |
+
|
1022 |
+
$choices[$field['key']] = $label;
|
1023 |
|
1024 |
if(isset($field['sub_fields']) && !empty($field['sub_fields'])){
|
1025 |
|
1026 |
foreach($field['sub_fields'] as $s_field){
|
1027 |
|
1028 |
+
$this->get_fields_choices_recursive($choices, $s_field, $original_field);
|
1029 |
|
1030 |
}
|
1031 |
|
1040 |
$form_name = $args['form_name'];
|
1041 |
|
1042 |
$mapped_field_groups = $this->get_fields_groups($form_id);
|
1043 |
+
$mapped_field_groups_keys = wp_list_pluck($mapped_field_groups, 'key');
|
1044 |
$mapped_fields = array();
|
1045 |
|
1046 |
if(!empty($mapped_field_groups)){
|
1047 |
|
1048 |
+
$post = acf_get_post_id_info($post_id);
|
1049 |
+
|
1050 |
+
// Apply Field Groups Rules
|
1051 |
+
if($post['type'] === 'post' && $args['field_groups_rules']){
|
1052 |
+
|
1053 |
+
$filter = array(
|
1054 |
+
'post_id' => $post_id,
|
1055 |
+
'post_type' => get_post_type($post_id),
|
1056 |
+
);
|
1057 |
+
|
1058 |
+
$filtered = array();
|
1059 |
+
|
1060 |
+
foreach($mapped_field_groups as $field_group){
|
1061 |
+
|
1062 |
+
// Deleted field group
|
1063 |
+
if(!isset($field_group['location']))
|
1064 |
+
continue;
|
1065 |
+
|
1066 |
+
// Force active
|
1067 |
+
$field_group['active'] = true;
|
1068 |
+
|
1069 |
+
if(acf_get_field_group_visibility($field_group, $filter)){
|
1070 |
+
|
1071 |
+
$filtered[] = $field_group;
|
1072 |
+
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
$mapped_field_groups = $filtered;
|
1078 |
+
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
if(!empty($mapped_field_groups)){
|
1082 |
+
|
1083 |
+
$mapped_field_groups_keys = wp_list_pluck($mapped_field_groups, 'key');
|
1084 |
+
|
1085 |
+
foreach($mapped_field_groups as $field_group){
|
1086 |
+
|
1087 |
+
if(empty($field_group['fields']))
|
1088 |
+
continue;
|
1089 |
+
|
1090 |
+
foreach($field_group['fields'] as $field){
|
1091 |
+
|
1092 |
+
$mapped_fields[] = $field;
|
1093 |
+
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
}
|
1097 |
+
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
// Match {field:key}
|
1103 |
+
if(preg_match_all('/{field:(.*?)}/', $content, $matches)){
|
1104 |
+
|
1105 |
foreach($matches[1] as $i => $field_key){
|
1106 |
|
1107 |
$field = false;
|
1142 |
|
1143 |
ob_start();
|
1144 |
|
1145 |
+
acf_render_fields($fields, false, $args['field_el'], $args['instruction_placement']);
|
1146 |
|
1147 |
$render_field = ob_get_clean();
|
1148 |
|
1155 |
// Match {field_group:key}
|
1156 |
if(preg_match_all('/{field_group:(.*?)}/', $content, $matches)){
|
1157 |
|
1158 |
+
//$field_groups = acf_get_field_groups();
|
1159 |
|
1160 |
foreach($matches[1] as $i => $field_group_key){
|
1161 |
|
1162 |
$fields = false;
|
1163 |
+
|
1164 |
+
if(!empty($mapped_field_groups)){
|
|
|
1165 |
|
1166 |
+
// Field group key
|
1167 |
+
if(strpos($field_group_key, 'group_') === 0){
|
1168 |
+
|
1169 |
+
if(in_array($field_group_key, $mapped_field_groups_keys))
|
1170 |
+
$fields = acf_get_fields($field_group_key);
|
1171 |
|
1172 |
+
// Field group title
|
1173 |
+
}else{
|
1174 |
|
1175 |
+
foreach($mapped_field_groups as $field_group){
|
1176 |
|
1177 |
if($field_group['title'] !== $field_group_key)
|
1178 |
continue;
|
1183 |
}
|
1184 |
|
1185 |
}
|
1186 |
+
|
1187 |
+
}
|
1188 |
|
1189 |
if(!$fields){
|
1190 |
|
1195 |
|
1196 |
ob_start();
|
1197 |
|
1198 |
+
acf_render_fields($fields, false, $args['field_el'], $args['instruction_placement']);
|
1199 |
|
1200 |
$render_fields = ob_get_clean();
|
1201 |
|
1225 |
|
1226 |
}
|
1227 |
|
1228 |
+
// Google Map
|
1229 |
+
function format_value_google_map($value, $_value, $post_id, $field){
|
1230 |
+
|
1231 |
+
if(is_string($value)){
|
1232 |
+
|
1233 |
+
$value = json_decode(wp_unslash($value), true);
|
1234 |
+
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
$value = acf_get_array($value);
|
1238 |
+
|
1239 |
+
$address = acf_maybe_get($value, 'address');
|
1240 |
+
|
1241 |
+
return $address;
|
1242 |
+
|
1243 |
+
}
|
1244 |
+
|
1245 |
// User
|
1246 |
function format_value_user($value, $_value, $post_id, $field){
|
1247 |
|
1311 |
|
1312 |
foreach($value as $i => $v){
|
1313 |
|
1314 |
+
$key = '';
|
1315 |
+
if(!is_numeric($i))
|
1316 |
+
$key = $i . ': ';
|
1317 |
+
|
1318 |
+
$return[] = $key . $this->format_value_array($v);
|
1319 |
|
1320 |
}
|
1321 |
|
1345 |
|
1346 |
}
|
1347 |
|
1348 |
+
function map_fields_values(&$data = array(), $array = array()){
|
1349 |
|
1350 |
+
if(empty($array)){
|
1351 |
+
|
1352 |
+
if(!acf_maybe_get_POST('acf'))
|
1353 |
+
return array();
|
1354 |
+
|
1355 |
+
$array = $_POST['acf'];
|
1356 |
+
|
1357 |
+
}
|
1358 |
|
1359 |
foreach($array as $field_key => $value){
|
1360 |
|
1375 |
'value' => $value,
|
1376 |
);
|
1377 |
|
1378 |
+
if(is_array($value) && !empty($value)){
|
1379 |
|
1380 |
+
$this->map_fields_values($data, $value);
|
1381 |
|
1382 |
}
|
1383 |
|
1387 |
|
1388 |
}
|
1389 |
|
1390 |
+
function map_field_value($content, $post_id = 0, $form = array()){
|
|
|
|
|
|
|
|
|
|
|
|
|
1391 |
|
1392 |
+
// Get store
|
1393 |
+
$store = acf_get_store('acfe/form');
|
1394 |
|
1395 |
+
// Store found
|
1396 |
+
if(!$store->has('data')){
|
1397 |
+
|
1398 |
+
$data = $this->map_fields_values();
|
1399 |
+
|
1400 |
+
// Set Store: ACF meta
|
1401 |
+
$store->set('data', $data);
|
1402 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1403 |
}
|
1404 |
+
|
1405 |
+
$is_array = false;
|
1406 |
+
|
1407 |
+
if(is_array($content)){
|
1408 |
+
|
1409 |
+
$is_array = true;
|
1410 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1411 |
}
|
1412 |
+
|
1413 |
+
$content = acf_array($content);
|
1414 |
+
|
1415 |
+
foreach($content as &$c){
|
1416 |
+
|
1417 |
+
// Match field_abcdef123456
|
1418 |
+
$c = acfe_form_map_field_key($c);
|
1419 |
+
|
1420 |
+
// Match {field:name} {field:key}
|
1421 |
+
$c = acfe_form_map_field($c);
|
1422 |
+
|
1423 |
+
// Match {fields}
|
1424 |
+
$c = acfe_form_map_fields($c);
|
1425 |
+
|
1426 |
+
// Match current_post {current:post:id}
|
1427 |
+
$c = acfe_form_map_current($c, $post_id, $form);
|
1428 |
+
|
1429 |
+
// Match {get_field:name} {get_field:name:123}
|
1430 |
+
$c = acfe_form_map_get_field($c, $post_id);
|
1431 |
+
|
1432 |
+
// Match {query_var:name} {query_var:name:key}
|
1433 |
+
$c = acfe_form_map_query_var($c);
|
1434 |
+
|
1435 |
}
|
1436 |
+
|
1437 |
+
if($is_array)
|
1438 |
+
return $content;
|
1439 |
+
|
1440 |
+
if(isset($content[0]))
|
1441 |
+
return $content[0];
|
1442 |
+
|
1443 |
+
return false;
|
1444 |
|
1445 |
}
|
1446 |
+
|
1447 |
+
function map_field_value_load($content, $post_id = 0, $form = array()){
|
1448 |
+
|
1449 |
+
$is_array = false;
|
1450 |
+
|
1451 |
+
if(is_array($content)){
|
1452 |
+
|
1453 |
+
$is_array = true;
|
1454 |
+
|
1455 |
+
}
|
1456 |
+
|
1457 |
+
$content = acf_array($content);
|
1458 |
+
|
1459 |
+
foreach($content as &$c) {
|
1460 |
+
|
1461 |
+
// Match current_post {current:post:id}
|
1462 |
+
$c = acfe_form_map_current($c, $post_id, $form);
|
1463 |
+
|
1464 |
+
// Match {get_field:name} {get_field:name:123}
|
1465 |
+
$c = acfe_form_map_get_field($c, $post_id);
|
1466 |
+
|
1467 |
+
// Match {query_var:name} {query_var:name:key}
|
1468 |
+
$c = acfe_form_map_query_var($c);
|
1469 |
+
|
1470 |
+
}
|
1471 |
+
|
1472 |
+
if($is_array)
|
1473 |
+
return $content;
|
1474 |
+
|
1475 |
+
if(isset($content[0]))
|
1476 |
+
return $content[0];
|
1477 |
+
|
1478 |
+
return false;
|
1479 |
+
|
1480 |
+
}
|
1481 |
|
1482 |
function filter_meta($meta, $acf){
|
1483 |
|
1507 |
|
1508 |
}
|
1509 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1510 |
/**
|
1511 |
* List: Columns
|
1512 |
*/
|
1532 |
// Name
|
1533 |
if($column == 'name'){
|
1534 |
|
1535 |
+
echo '<code style="font-size: 12px;">' . get_field('acfe_form_name', $post_id) . '</code>';
|
1536 |
|
1537 |
}
|
1538 |
|
1688 |
// Field groups
|
1689 |
elseif($column == 'shortcode'){
|
1690 |
|
1691 |
+
echo '<code style="font-size: 12px;">[acfe_form name="' . get_field('acfe_form_name', $post_id) . '"]</code>';
|
1692 |
|
1693 |
}
|
1694 |
|
1695 |
}
|
1696 |
|
1697 |
+
function doc_validation_field($field){
|
|
|
|
|
|
|
1698 |
|
1699 |
+
$form_name = 'my_form';
|
|
|
1700 |
|
1701 |
+
if(acf_maybe_get($field, 'value'))
|
1702 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
1703 |
|
1704 |
+
?>You may use the following hooks:<br /><br />
|
|
|
|
|
1705 |
|
1706 |
+
<pre>/**
|
1707 |
+
* Perform custom validation on a field's value
|
1708 |
+
* Reference: <a href="https://www.advancedcustomfields.com/resources/acf-validate_value/" target="_blank">https://www.advancedcustomfields.com/resources/acf-validate_value/</a>
|
1709 |
+
*/
|
1710 |
+
add_filter('acf/validate_value/name=my_field', 'my_field_validation', 10, 4);
|
1711 |
+
function my_field_validation($valid, $value, $field, $input){
|
1712 |
|
1713 |
+
if(!$valid)
|
1714 |
+
return $valid;
|
1715 |
+
|
1716 |
+
if($value === 'Hello')
|
1717 |
+
$valid = 'Hello is not allowed';
|
1718 |
+
|
1719 |
+
return $valid;
|
1720 |
+
|
1721 |
+
}</pre>
|
1722 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1723 |
|
1724 |
+
}
|
1725 |
+
|
1726 |
+
function doc_validation_form($field){
|
1727 |
|
1728 |
+
$form_name = 'my_form';
|
|
|
|
|
|
|
|
|
1729 |
|
1730 |
+
if(acf_maybe_get($field, 'value'))
|
1731 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
|
|
1732 |
|
1733 |
+
?>You may use the following hooks:<br /><br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1734 |
|
1735 |
+
<pre>/**
|
1736 |
+
* @array $form Form arguments
|
1737 |
+
* @int/string $post_id Current post id
|
1738 |
+
*/
|
1739 |
+
add_action('acfe/form/validation/form=<?php echo $form_name; ?>', 'my_form_validation', 10, 2);
|
1740 |
+
function my_form_validation($form, $post_id){
|
1741 |
+
|
1742 |
+
/**
|
1743 |
+
* Get the form input value named 'my_field'
|
1744 |
+
* This is the value entered by the user during the form submission
|
1745 |
+
*/
|
1746 |
+
$my_field = get_field('my_field');
|
1747 |
+
$my_field_unformatted = get_field('my_field', false, false);
|
1748 |
+
|
1749 |
+
if($my_field === 'Hello'){
|
1750 |
|
1751 |
+
// Add validation error
|
1752 |
+
acfe_add_validation_error('my_field', 'Hello is not allowed');
|
1753 |
|
1754 |
+
// Add general validation error
|
1755 |
+
acfe_add_validation_error('', 'There is an error');
|
|
|
1756 |
|
1757 |
+
}
|
1758 |
+
|
1759 |
+
|
1760 |
+
/**
|
1761 |
+
* Get the field value 'my_field' from the post ID 145
|
1762 |
+
*/
|
1763 |
+
$post_my_field = get_field('my_field', 145);
|
1764 |
+
$post_my_field_unformatted = get_field('my_field', 145, false);
|
1765 |
+
|
1766 |
+
}</pre>
|
1767 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1768 |
|
1769 |
+
}
|
1770 |
+
|
1771 |
+
function doc_submission($field){
|
1772 |
|
1773 |
+
$form_name = 'my_form';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1774 |
|
1775 |
+
if(acf_maybe_get($field, 'value'))
|
1776 |
+
$form_name = get_field('acfe_form_name', $field['value']);
|
1777 |
|
1778 |
+
?>You may use the following hooks:<br /><br />
|
|
|
1779 |
|
1780 |
+
<pre>
|
1781 |
+
add_action('acfe/form/submit', 'my_form_submit', 10, 2);
|
1782 |
+
add_action('acfe/form/submit/form=<?php echo $form_name; ?>', 'my_form_submit', 10, 2);</pre>
|
1783 |
+
|
1784 |
+
<br />
|
1785 |
|
1786 |
+
<pre>/**
|
1787 |
+
* @array $form Form arguments
|
1788 |
+
* @int/string $post_id Current post id
|
1789 |
+
*/
|
1790 |
+
add_action('acfe/form/submit/form=<?php echo $form_name; ?>', 'my_form_submit', 10, 2);
|
1791 |
+
function my_form_submit($form, $post_id){
|
1792 |
+
|
1793 |
+
/**
|
1794 |
+
* Get the form input value named 'my_field'
|
1795 |
+
* This is the value entered by the user during the form submission
|
1796 |
+
*/
|
1797 |
+
$my_field = get_field('my_field');
|
1798 |
+
$my_field_unformatted = get_field('my_field', false, false);
|
1799 |
+
|
1800 |
+
if($my_field === 'Hello'){
|
1801 |
|
1802 |
+
// Do something
|
|
|
1803 |
|
1804 |
}
|
1805 |
|
1806 |
+
|
1807 |
/**
|
1808 |
+
* Get the field value 'my_field' from the post ID 145
|
1809 |
*/
|
1810 |
+
$post_my_field = get_field('my_field', 145);
|
1811 |
+
$post_my_field_unformatted = get_field('my_field', 145, false);
|
1812 |
+
|
1813 |
+
}</pre>
|
1814 |
+
<?php
|
1815 |
|
1816 |
+
}
|
1817 |
+
|
1818 |
+
function doc_field($field){
|
1819 |
+
?>
|
1820 |
+
<table class="acf-table">
|
1821 |
+
<tbody>
|
1822 |
+
<tr class="acf-row">
|
1823 |
+
<td width="35%"><code>{field:field_5e5c07b6dfae9}</code></td>
|
1824 |
+
<td>User input</td>
|
1825 |
+
</tr>
|
1826 |
+
<tr class="acf-row">
|
1827 |
+
<td width="35%"><code>{field:my_field}</code></td>
|
1828 |
+
<td>User input</td>
|
1829 |
+
</tr>
|
1830 |
+
<tr class="acf-row">
|
1831 |
+
<td width="35%"><code>{field:my_field:false}</code></td>
|
1832 |
+
<td>User input (unformatted)</td>
|
1833 |
+
</tr>
|
1834 |
+
</tbody>
|
1835 |
+
</table>
|
1836 |
+
<?php
|
1837 |
+
}
|
1838 |
+
|
1839 |
+
function doc_fields($field){
|
1840 |
+
?>
|
1841 |
+
<table class="acf-table">
|
1842 |
+
<tbody>
|
1843 |
+
<tr class="acf-row">
|
1844 |
+
<td width="35%"><code>{fields}</code></td>
|
1845 |
+
<td>My text: User input<br /><br />My textarea: User input<br /><br />My date: 2020-03-01</td>
|
1846 |
+
</tr>
|
1847 |
+
</tbody>
|
1848 |
+
</table>
|
1849 |
+
<?php
|
1850 |
+
}
|
1851 |
+
|
1852 |
+
function doc_get_field($field){
|
1853 |
+
?>
|
1854 |
+
<table class="acf-table">
|
1855 |
+
<tbody>
|
1856 |
+
<tr class="acf-row">
|
1857 |
+
<td width="35%"><code>{get_field:my_field}</code></td>
|
1858 |
+
<td>DB value (current post)</td>
|
1859 |
+
</tr>
|
1860 |
+
<tr class="acf-row">
|
1861 |
+
<td width="35%"><code>{get_field:my_field:current}</code></td>
|
1862 |
+
<td>DB value (current post)</td>
|
1863 |
+
</tr>
|
1864 |
+
<tr class="acf-row">
|
1865 |
+
<td width="35%"><code>{get_field:my_field:128}</code></td>
|
1866 |
+
<td>DB value (post:128)</td>
|
1867 |
+
</tr>
|
1868 |
+
<tr class="acf-row">
|
1869 |
+
<td width="35%"><code>{get_field:my_field:128:false}</code></td>
|
1870 |
+
<td>DB value (post:128 - unformatted)</td>
|
1871 |
+
</tr>
|
1872 |
+
</tbody>
|
1873 |
+
</table>
|
1874 |
+
<?php
|
1875 |
+
}
|
1876 |
+
|
1877 |
+
function doc_query_var($field){
|
1878 |
+
?>
|
1879 |
+
<table class="acf-table">
|
1880 |
+
<tbody>
|
1881 |
+
<tr class="acf-row">
|
1882 |
+
<td width="35%"><code>{query_var:name}</code></td>
|
1883 |
+
<td>value</td>
|
1884 |
+
</tr>
|
1885 |
+
<tr class="acf-row">
|
1886 |
+
<td width="35%"><code>{query_var:name:key}</code></td>
|
1887 |
+
<td>Array value</td>
|
1888 |
+
</tr>
|
1889 |
+
</tbody>
|
1890 |
+
</table>
|
1891 |
+
|
1892 |
+
<br />
|
1893 |
+
|
1894 |
+
<table class="acf-table">
|
1895 |
+
<tbody>
|
1896 |
+
<tr class="acf-row">
|
1897 |
+
<td width="35%"><code>{query_var:my-post-action:ID}</code></td>
|
1898 |
+
<td>128</td>
|
1899 |
+
</tr>
|
1900 |
+
<tr class="acf-row">
|
1901 |
+
<td width="35%"><code>{query_var:my-post-action:post_title}</code></td>
|
1902 |
+
<td>Title</td>
|
1903 |
+
</tr>
|
1904 |
+
<tr class="acf-row">
|
1905 |
+
<td width="35%"><code>{query_var:my-post-action:permalink}</code></td>
|
1906 |
+
<td><?php echo home_url('my-post'); ?></td>
|
1907 |
+
</tr>
|
1908 |
+
<tr class="acf-row">
|
1909 |
+
<td width="35%"><code>{query_var:my-post-action:...}</code></td>
|
1910 |
+
<td>(See <code>{current:post}</code> tags)</td>
|
1911 |
+
</tr>
|
1912 |
+
</tbody>
|
1913 |
+
</table>
|
1914 |
+
|
1915 |
+
<br />
|
1916 |
+
|
1917 |
+
<table class="acf-table">
|
1918 |
+
<tbody>
|
1919 |
+
<tr class="acf-row">
|
1920 |
+
<td width="35%"><code>{query_var:my-term-action:ID}</code></td>
|
1921 |
+
<td>23</td>
|
1922 |
+
</tr>
|
1923 |
+
<tr class="acf-row">
|
1924 |
+
<td width="35%"><code>{query_var:my-term-action:name}</code></td>
|
1925 |
+
<td>Term</td>
|
1926 |
+
</tr>
|
1927 |
+
<tr class="acf-row">
|
1928 |
+
<td width="35%"><code>{query_var:my-term-action:permalink}</code></td>
|
1929 |
+
<td><?php echo home_url('taxonomy/term'); ?></td>
|
1930 |
+
</tr>
|
1931 |
+
<tr class="acf-row">
|
1932 |
+
<td width="35%"><code>{query_var:my-term-action:...}</code></td>
|
1933 |
+
<td>(See <code>{current:term}</code> tags)</td>
|
1934 |
+
</tr>
|
1935 |
+
</tbody>
|
1936 |
+
</table>
|
1937 |
+
|
1938 |
+
<br />
|
1939 |
+
|
1940 |
+
<table class="acf-table">
|
1941 |
+
<tbody>
|
1942 |
+
<tr class="acf-row">
|
1943 |
+
<td width="35%"><code>{query_var:my-user-action:ID}</code></td>
|
1944 |
+
<td>1</td>
|
1945 |
+
</tr>
|
1946 |
+
<tr class="acf-row">
|
1947 |
+
<td width="35%"><code>{query_var:my-user-action:user_email}</code></td>
|
1948 |
+
<td>user@domain.com</td>
|
1949 |
+
</tr>
|
1950 |
+
<tr class="acf-row">
|
1951 |
+
<td width="35%"><code>{query_var:my-user-action:display_name}</code></td>
|
1952 |
+
<td>John Doe</td>
|
1953 |
+
</tr>
|
1954 |
+
<tr class="acf-row">
|
1955 |
+
<td width="35%"><code>{query_var:my-user-action:...}</code></td>
|
1956 |
+
<td>(See <code>{current:user}</code> tags)</td>
|
1957 |
+
</tr>
|
1958 |
+
</tbody>
|
1959 |
+
</table>
|
1960 |
+
|
1961 |
+
<br />
|
1962 |
+
|
1963 |
+
<table class="acf-table">
|
1964 |
+
<tbody>
|
1965 |
+
<tr class="acf-row">
|
1966 |
+
<td width="35%"><code>{query_var:my-email-action:from}</code></td>
|
1967 |
+
<td>Website <email@domain.com></td>
|
1968 |
+
</tr>
|
1969 |
+
<tr class="acf-row">
|
1970 |
+
<td width="35%"><code>{query_var:my-email-action:to}</code></td>
|
1971 |
+
<td>email@domain.com</td>
|
1972 |
+
</tr>
|
1973 |
+
<tr class="acf-row">
|
1974 |
+
<td width="35%"><code>{query_var:my-email-action:subject}</code></td>
|
1975 |
+
<td>Subject</td>
|
1976 |
+
</tr>
|
1977 |
+
<tr class="acf-row">
|
1978 |
+
<td width="35%"><code>{query_var:my-user-action:content}</code></td>
|
1979 |
+
<td>Content</td>
|
1980 |
+
</tr>
|
1981 |
+
</tbody>
|
1982 |
+
</table>
|
1983 |
+
<?php
|
1984 |
+
}
|
1985 |
+
|
1986 |
+
function doc_current_post($field){
|
1987 |
+
?>
|
1988 |
+
<table class="acf-table">
|
1989 |
+
<tbody>
|
1990 |
+
<tr class="acf-row">
|
1991 |
+
<td width="35%"><code>{current:post}</code></td>
|
1992 |
+
<td>128</td>
|
1993 |
+
</tr>
|
1994 |
+
<tr class="acf-row">
|
1995 |
+
<td width="35%"><code>{current:post:ID}</code></td>
|
1996 |
+
<td>128</td>
|
1997 |
+
</tr>
|
1998 |
+
<tr class="acf-row">
|
1999 |
+
<td width="35%"><code>{current:post:post_author}</code></td>
|
2000 |
+
<td>1</td>
|
2001 |
+
</tr>
|
2002 |
+
<tr class="acf-row">
|
2003 |
+
<td width="35%"><code>{current:post:post_date}</code></td>
|
2004 |
+
<td>2020-03-01 20:07:48</td>
|
2005 |
+
</tr>
|
2006 |
+
<tr class="acf-row">
|
2007 |
+
<td width="35%"><code>{current:post:post_date_gmt}</code></td>
|
2008 |
+
<td>2020-03-01 19:07:48</td>
|
2009 |
+
</tr>
|
2010 |
+
<tr class="acf-row">
|
2011 |
+
<td width="35%"><code>{current:post:post_content}</code></td>
|
2012 |
+
<td>Content</td>
|
2013 |
+
</tr>
|
2014 |
+
<tr class="acf-row">
|
2015 |
+
<td width="35%"><code>{current:post:post_title}</code></td>
|
2016 |
+
<td>Title</td>
|
2017 |
+
</tr>
|
2018 |
+
<tr class="acf-row">
|
2019 |
+
<td width="35%"><code>{current:post:post_excerpt}</code></td>
|
2020 |
+
<td>Excerpt</td>
|
2021 |
+
</tr>
|
2022 |
+
<tr class="acf-row">
|
2023 |
+
<td width="35%"><code>{current:post:permalink}</code></td>
|
2024 |
+
<td><?php echo home_url('my-post'); ?></td>
|
2025 |
+
</tr>
|
2026 |
+
<tr class="acf-row">
|
2027 |
+
<td width="35%"><code>{current:post:admin_url}</code></td>
|
2028 |
+
<td><?php echo admin_url('post.php?post=128&action=edit'); ?></td>
|
2029 |
+
</tr>
|
2030 |
+
<tr class="acf-row">
|
2031 |
+
<td width="35%"><code>{current:post:post_status}</code></td>
|
2032 |
+
<td>publish</td>
|
2033 |
+
</tr>
|
2034 |
+
<tr class="acf-row">
|
2035 |
+
<td width="35%"><code>{current:post:comment_status}</code></td>
|
2036 |
+
<td>closed</td>
|
2037 |
+
</tr>
|
2038 |
+
<tr class="acf-row">
|
2039 |
+
<td width="35%"><code>{current:post:ping_status}</code></td>
|
2040 |
+
<td>closed</td>
|
2041 |
+
</tr>
|
2042 |
+
<tr class="acf-row">
|
2043 |
+
<td width="35%"><code>{current:post:post_password}</code></td>
|
2044 |
+
<td>password</td>
|
2045 |
+
</tr>
|
2046 |
+
<tr class="acf-row">
|
2047 |
+
<td width="35%"><code>{current:post:post_name}</code></td>
|
2048 |
+
<td>name</td>
|
2049 |
+
</tr>
|
2050 |
+
<tr class="acf-row">
|
2051 |
+
<td width="35%"><code>{current:post:to_ping}</code></td>
|
2052 |
+
<td></td>
|
2053 |
+
</tr>
|
2054 |
+
<tr class="acf-row">
|
2055 |
+
<td width="35%"><code>{current:post:pinged}</code></td>
|
2056 |
+
<td></td>
|
2057 |
+
</tr>
|
2058 |
+
<tr class="acf-row">
|
2059 |
+
<td width="35%"><code>{current:post:post_modified}</code></td>
|
2060 |
+
<td>2020-03-01 20:07:48</td>
|
2061 |
+
</tr>
|
2062 |
+
<tr class="acf-row">
|
2063 |
+
<td width="35%"><code>{current:post:post_modified_gmt}</code></td>
|
2064 |
+
<td>2020-03-01 19:07:48</td>
|
2065 |
+
</tr>
|
2066 |
+
<tr class="acf-row">
|
2067 |
+
<td width="35%"><code>{current:post:post_content_filtered}</code></td>
|
2068 |
+
<td></td>
|
2069 |
+
</tr>
|
2070 |
+
<tr class="acf-row">
|
2071 |
+
<td width="35%"><code>{current:post:post_parent}</code></td>
|
2072 |
+
<td>0</td>
|
2073 |
+
</tr>
|
2074 |
+
<tr class="acf-row">
|
2075 |
+
<td width="35%"><code>{current:post:guid}</code></td>
|
2076 |
+
<td><?php echo home_url('?page_id=128'); ?></td>
|
2077 |
+
</tr>
|
2078 |
+
<tr class="acf-row">
|
2079 |
+
<td width="35%"><code>{current:post:menu_order}</code></td>
|
2080 |
+
<td>0</td>
|
2081 |
+
</tr>
|
2082 |
+
<tr class="acf-row">
|
2083 |
+
<td width="35%"><code>{current:post:post_type}</code></td>
|
2084 |
+
<td>page</td>
|
2085 |
+
</tr>
|
2086 |
+
<tr class="acf-row">
|
2087 |
+
<td width="35%"><code>{current:post:post_mime_type}</code></td>
|
2088 |
+
<td></td>
|
2089 |
+
</tr>
|
2090 |
+
<tr class="acf-row">
|
2091 |
+
<td width="35%"><code>{current:post:comment_count}</code></td>
|
2092 |
+
<td>0</td>
|
2093 |
+
</tr>
|
2094 |
+
<tr class="acf-row">
|
2095 |
+
<td width="35%"><code>{current:post:filter}</code></td>
|
2096 |
+
<td>raw</td>
|
2097 |
+
</tr>
|
2098 |
+
|
2099 |
+
</tbody>
|
2100 |
+
</table>
|
2101 |
+
<?php
|
2102 |
+
}
|
2103 |
+
|
2104 |
+
function doc_current_term($field){
|
2105 |
+
?>
|
2106 |
+
<table class="acf-table">
|
2107 |
+
<tbody>
|
2108 |
+
<tr class="acf-row">
|
2109 |
+
<td width="35%"><code>{current:term}</code></td>
|
2110 |
+
<td>23</td>
|
2111 |
+
</tr>
|
2112 |
+
<tr class="acf-row">
|
2113 |
+
<td width="35%"><code>{current:term:ID}</code></td>
|
2114 |
+
<td>23</td>
|
2115 |
+
</tr>
|
2116 |
+
<tr class="acf-row">
|
2117 |
+
<td width="35%"><code>{current:term:term_id}</code></td>
|
2118 |
+
<td>23</td>
|
2119 |
+
</tr>
|
2120 |
+
<tr class="acf-row">
|
2121 |
+
<td width="35%"><code>{current:term:name}</code></td>
|
2122 |
+
<td>Term</td>
|
2123 |
+
</tr>
|
2124 |
+
<tr class="acf-row">
|
2125 |
+
<td width="35%"><code>{current:term:slug}</code></td>
|
2126 |
+
<td>term</td>
|
2127 |
+
</tr>
|
2128 |
+
<tr class="acf-row">
|
2129 |
+
<td width="35%"><code>{current:term:permalink}</code></td>
|
2130 |
+
<td><?php echo home_url('taxonomy/term'); ?></td>
|
2131 |
+
</tr>
|
2132 |
+
<tr class="acf-row">
|
2133 |
+
<td width="35%"><code>{current:term:admin_url}</code></td>
|
2134 |
+
<td><?php echo admin_url('term.php?tag_ID=23'); ?></td>
|
2135 |
+
</tr>
|
2136 |
+
<tr class="acf-row">
|
2137 |
+
<td width="35%"><code>{current:term:term_group}</code></td>
|
2138 |
+
<td>0</td>
|
2139 |
+
</tr>
|
2140 |
+
<tr class="acf-row">
|
2141 |
+
<td width="35%"><code>{current:term:term_taxonomy_id}</code></td>
|
2142 |
+
<td>23</td>
|
2143 |
+
</tr>
|
2144 |
+
<tr class="acf-row">
|
2145 |
+
<td width="35%"><code>{current:term:taxonomy}</code></td>
|
2146 |
+
<td>taxonomy</td>
|
2147 |
+
</tr>
|
2148 |
+
<tr class="acf-row">
|
2149 |
+
<td width="35%"><code>{current:term:description}</code></td>
|
2150 |
+
<td>Content</td>
|
2151 |
+
</tr>
|
2152 |
+
<tr class="acf-row">
|
2153 |
+
<td width="35%"><code>{current:term:parent}</code></td>
|
2154 |
+
<td>0</td>
|
2155 |
+
</tr>
|
2156 |
+
<tr class="acf-row">
|
2157 |
+
<td width="35%"><code>{current:term:count}</code></td>
|
2158 |
+
<td>0</td>
|
2159 |
+
</tr>
|
2160 |
+
<tr class="acf-row">
|
2161 |
+
<td width="35%"><code>{current:term:filter}</code></td>
|
2162 |
+
<td>raw</td>
|
2163 |
+
</tr>
|
2164 |
+
</tbody>
|
2165 |
+
</table>
|
2166 |
+
<?php
|
2167 |
+
}
|
2168 |
+
|
2169 |
+
function doc_current_user($field){
|
2170 |
+
?>
|
2171 |
+
<table class="acf-table">
|
2172 |
+
<tbody>
|
2173 |
+
<tr class="acf-row">
|
2174 |
+
<td width="35%"><code>{current:user}</code></td>
|
2175 |
+
<td>1</td>
|
2176 |
+
</tr>
|
2177 |
+
<tr class="acf-row">
|
2178 |
+
<td width="35%"><code>{current:user:ID}</code></td>
|
2179 |
+
<td>1</td>
|
2180 |
+
</tr>
|
2181 |
+
<tr class="acf-row">
|
2182 |
+
<td width="35%"><code>{current:user:user_login}</code></td>
|
2183 |
+
<td>login</td>
|
2184 |
+
</tr>
|
2185 |
+
<tr class="acf-row">
|
2186 |
+
<td width="35%"><code>{current:user:user_pass}</code></td>
|
2187 |
+
<td>password_hash</td>
|
2188 |
+
</tr>
|
2189 |
+
<tr class="acf-row">
|
2190 |
+
<td width="35%"><code>{current:user:user_nicename}</code></td>
|
2191 |
+
<td>nicename</td>
|
2192 |
+
</tr>
|
2193 |
+
<tr class="acf-row">
|
2194 |
+
<td width="35%"><code>{current:user:user_email}</code></td>
|
2195 |
+
<td>user@domain.com</td>
|
2196 |
+
</tr>
|
2197 |
+
<tr class="acf-row">
|
2198 |
+
<td width="35%"><code>{current:user:user_url}</code></td>
|
2199 |
+
<td>https://www.website.com</td>
|
2200 |
+
</tr>
|
2201 |
+
<tr class="acf-row">
|
2202 |
+
<td width="35%"><code>{current:user:permalink}</code></td>
|
2203 |
+
<td><?php echo home_url('author/johndoe'); ?></td>
|
2204 |
+
</tr>
|
2205 |
+
<tr class="acf-row">
|
2206 |
+
<td width="35%"><code>{current:user:admin_url}</code></td>
|
2207 |
+
<td><?php echo admin_url('user-edit.php?user_id=1'); ?></td>
|
2208 |
+
</tr>
|
2209 |
+
<tr class="acf-row">
|
2210 |
+
<td width="35%"><code>{current:user:user_registered}</code></td>
|
2211 |
+
<td>2020-02-22 22:10:02</td>
|
2212 |
+
</tr>
|
2213 |
+
<tr class="acf-row">
|
2214 |
+
<td width="35%"><code>{current:user:user_activation_key}</code></td>
|
2215 |
+
<td></td>
|
2216 |
+
</tr>
|
2217 |
+
<tr class="acf-row">
|
2218 |
+
<td width="35%"><code>{current:user:user_status}</code></td>
|
2219 |
+
<td>0</td>
|
2220 |
+
</tr>
|
2221 |
+
<tr class="acf-row">
|
2222 |
+
<td width="35%"><code>{current:user:display_name}</code></td>
|
2223 |
+
<td>John Doe</td>
|
2224 |
+
</tr>
|
2225 |
+
<tr class="acf-row">
|
2226 |
+
<td width="35%"><code>{current:user:nickname}</code></td>
|
2227 |
+
<td>JohnDoe</td>
|
2228 |
+
</tr>
|
2229 |
+
<tr class="acf-row">
|
2230 |
+
<td width="35%"><code>{current:user:first_name}</code></td>
|
2231 |
+
<td>John</td>
|
2232 |
+
</tr>
|
2233 |
+
<tr class="acf-row">
|
2234 |
+
<td width="35%"><code>{current:user:last_name}</code></td>
|
2235 |
+
<td>Doe</td>
|
2236 |
+
</tr>
|
2237 |
+
<tr class="acf-row">
|
2238 |
+
<td width="35%"><code>{current:user:description}</code></td>
|
2239 |
+
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</td>
|
2240 |
+
</tr>
|
2241 |
+
<tr class="acf-row">
|
2242 |
+
<td width="35%"><code>{current:user:rich_editing}</code></td>
|
2243 |
+
<td>true</td>
|
2244 |
+
</tr>
|
2245 |
+
<tr class="acf-row">
|
2246 |
+
<td width="35%"><code>{current:user:syntax_highlighting}</code></td>
|
2247 |
+
<td>true</td>
|
2248 |
+
</tr>
|
2249 |
+
<tr class="acf-row">
|
2250 |
+
<td width="35%"><code>{current:user:comment_shortcuts}</code></td>
|
2251 |
+
<td>false</td>
|
2252 |
+
</tr>
|
2253 |
+
<tr class="acf-row">
|
2254 |
+
<td width="35%"><code>{current:user:admin_color}</code></td>
|
2255 |
+
<td>fresh</td>
|
2256 |
+
</tr>
|
2257 |
+
<tr class="acf-row">
|
2258 |
+
<td width="35%"><code>{current:user:use_ssl}</code></td>
|
2259 |
+
<td>1</td>
|
2260 |
+
</tr>
|
2261 |
+
<tr class="acf-row">
|
2262 |
+
<td width="35%"><code>{current:user:show_admin_bar_front}</code></td>
|
2263 |
+
<td>true</td>
|
2264 |
+
</tr>
|
2265 |
+
<tr class="acf-row">
|
2266 |
+
<td width="35%"><code>{current:user:locale}</code></td>
|
2267 |
+
<td></td>
|
2268 |
+
</tr>
|
2269 |
+
<tr class="acf-row">
|
2270 |
+
<td width="35%"><code>{current:user:wp_capabilities}</code></td>
|
2271 |
+
<td>a:1:{s:13:"administrator";b:1;}</td>
|
2272 |
+
</tr>
|
2273 |
+
<tr class="acf-row">
|
2274 |
+
<td width="35%"><code>{current:user:wp_user_level}</code></td>
|
2275 |
+
<td>10</td>
|
2276 |
+
</tr>
|
2277 |
+
<tr class="acf-row">
|
2278 |
+
<td width="35%"><code>{current:user:dismissed_wp_pointers}</code></td>
|
2279 |
+
<td></td>
|
2280 |
+
</tr>
|
2281 |
+
<tr class="acf-row">
|
2282 |
+
<td width="35%"><code>{current:user:show_welcome_panel}</code></td>
|
2283 |
+
<td>1</td>
|
2284 |
+
</tr>
|
2285 |
+
<tr class="acf-row">
|
2286 |
+
<td width="35%"><code>{current:user:show_welcome_panel}</code></td>
|
2287 |
+
<td>1</td>
|
2288 |
+
</tr>
|
2289 |
+
</tbody>
|
2290 |
+
</table>
|
2291 |
+
<?php
|
2292 |
+
}
|
2293 |
+
|
2294 |
+
function doc_current_author($field){
|
2295 |
+
?>
|
2296 |
+
<table class="acf-table">
|
2297 |
+
<tbody>
|
2298 |
+
<tr class="acf-row">
|
2299 |
+
<td width="35%"><code>{current:author}</code></td>
|
2300 |
+
<td>1</td>
|
2301 |
+
</tr>
|
2302 |
+
<tr class="acf-row">
|
2303 |
+
<td width="35%"><code>{current:author:ID}</code></td>
|
2304 |
+
<td>1</td>
|
2305 |
+
</tr>
|
2306 |
+
<tr class="acf-row">
|
2307 |
+
<td width="35%"><code>{current:author:user_login}</code></td>
|
2308 |
+
<td>login</td>
|
2309 |
+
</tr>
|
2310 |
+
<tr class="acf-row">
|
2311 |
+
<td width="35%"><code>{current:author:user_pass}</code></td>
|
2312 |
+
<td>password_hash</td>
|
2313 |
+
</tr>
|
2314 |
+
<tr class="acf-row">
|
2315 |
+
<td width="35%"><code>{current:author:user_nicename}</code></td>
|
2316 |
+
<td>nicename</td>
|
2317 |
+
</tr>
|
2318 |
+
<tr class="acf-row">
|
2319 |
+
<td width="35%"><code>{current:author:user_email}</code></td>
|
2320 |
+
<td>user@domain.com</td>
|
2321 |
+
</tr>
|
2322 |
+
<tr class="acf-row">
|
2323 |
+
<td width="35%"><code>{current:author:user_url}</code></td>
|
2324 |
+
<td>https://www.website.com</td>
|
2325 |
+
</tr>
|
2326 |
+
<tr class="acf-row">
|
2327 |
+
<td width="35%"><code>{current:author:permalink}</code></td>
|
2328 |
+
<td><?php echo home_url('author/johndoe'); ?></td>
|
2329 |
+
</tr>
|
2330 |
+
<tr class="acf-row">
|
2331 |
+
<td width="35%"><code>{current:author:admin_url}</code></td>
|
2332 |
+
<td><?php echo admin_url('user-edit.php?user_id=1'); ?></td>
|
2333 |
+
</tr>
|
2334 |
+
<tr class="acf-row">
|
2335 |
+
<td width="35%"><code>{current:author:user_registered}</code></td>
|
2336 |
+
<td>2020-02-22 22:10:02</td>
|
2337 |
+
</tr>
|
2338 |
+
<tr class="acf-row">
|
2339 |
+
<td width="35%"><code>{current:author:user_activation_key}</code></td>
|
2340 |
+
<td></td>
|
2341 |
+
</tr>
|
2342 |
+
<tr class="acf-row">
|
2343 |
+
<td width="35%"><code>{current:author:user_status}</code></td>
|
2344 |
+
<td>0</td>
|
2345 |
+
</tr>
|
2346 |
+
<tr class="acf-row">
|
2347 |
+
<td width="35%"><code>{current:author:display_name}</code></td>
|
2348 |
+
<td>John Doe</td>
|
2349 |
+
</tr>
|
2350 |
+
<tr class="acf-row">
|
2351 |
+
<td width="35%"><code>{current:author:nickname}</code></td>
|
2352 |
+
<td>JohnDoe</td>
|
2353 |
+
</tr>
|
2354 |
+
<tr class="acf-row">
|
2355 |
+
<td width="35%"><code>{current:author:first_name}</code></td>
|
2356 |
+
<td>John</td>
|
2357 |
+
</tr>
|
2358 |
+
<tr class="acf-row">
|
2359 |
+
<td width="35%"><code>{current:author:last_name}</code></td>
|
2360 |
+
<td>Doe</td>
|
2361 |
+
</tr>
|
2362 |
+
<tr class="acf-row">
|
2363 |
+
<td width="35%"><code>{current:author:description}</code></td>
|
2364 |
+
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</td>
|
2365 |
+
</tr>
|
2366 |
+
<tr class="acf-row">
|
2367 |
+
<td width="35%"><code>{current:author:rich_editing}</code></td>
|
2368 |
+
<td>true</td>
|
2369 |
+
</tr>
|
2370 |
+
<tr class="acf-row">
|
2371 |
+
<td width="35%"><code>{current:author:syntax_highlighting}</code></td>
|
2372 |
+
<td>true</td>
|
2373 |
+
</tr>
|
2374 |
+
<tr class="acf-row">
|
2375 |
+
<td width="35%"><code>{current:author:comment_shortcuts}</code></td>
|
2376 |
+
<td>false</td>
|
2377 |
+
</tr>
|
2378 |
+
<tr class="acf-row">
|
2379 |
+
<td width="35%"><code>{current:author:admin_color}</code></td>
|
2380 |
+
<td>fresh</td>
|
2381 |
+
</tr>
|
2382 |
+
<tr class="acf-row">
|
2383 |
+
<td width="35%"><code>{current:author:use_ssl}</code></td>
|
2384 |
+
<td>1</td>
|
2385 |
+
</tr>
|
2386 |
+
<tr class="acf-row">
|
2387 |
+
<td width="35%"><code>{current:author:show_admin_bar_front}</code></td>
|
2388 |
+
<td>true</td>
|
2389 |
+
</tr>
|
2390 |
+
<tr class="acf-row">
|
2391 |
+
<td width="35%"><code>{current:author:locale}</code></td>
|
2392 |
+
<td></td>
|
2393 |
+
</tr>
|
2394 |
+
<tr class="acf-row">
|
2395 |
+
<td width="35%"><code>{current:author:wp_capabilities}</code></td>
|
2396 |
+
<td>a:1:{s:13:"administrator";b:1;}</td>
|
2397 |
+
</tr>
|
2398 |
+
<tr class="acf-row">
|
2399 |
+
<td width="35%"><code>{current:author:wp_user_level}</code></td>
|
2400 |
+
<td>10</td>
|
2401 |
+
</tr>
|
2402 |
+
<tr class="acf-row">
|
2403 |
+
<td width="35%"><code>{current:author:dismissed_wp_pointers}</code></td>
|
2404 |
+
<td></td>
|
2405 |
+
</tr>
|
2406 |
+
<tr class="acf-row">
|
2407 |
+
<td width="35%"><code>{current:author:show_welcome_panel}</code></td>
|
2408 |
+
<td>1</td>
|
2409 |
+
</tr>
|
2410 |
+
<tr class="acf-row">
|
2411 |
+
<td width="35%"><code>{current:author:show_welcome_panel}</code></td>
|
2412 |
+
<td>1</td>
|
2413 |
+
</tr>
|
2414 |
+
</tbody>
|
2415 |
+
</table>
|
2416 |
+
<?php
|
2417 |
+
}
|
2418 |
+
|
2419 |
+
function doc_current_form($field){
|
2420 |
+
?>
|
2421 |
+
<table class="acf-table">
|
2422 |
+
<tbody>
|
2423 |
+
<tr class="acf-row">
|
2424 |
+
<td width="35%"><code>{current:form}</code></td>
|
2425 |
+
<td>11<br/></td>
|
2426 |
+
</tr>
|
2427 |
+
<tr class="acf-row">
|
2428 |
+
<td width="35%"><code>{current:form:ID}</code></td>
|
2429 |
+
<td>11<br/></td>
|
2430 |
+
</tr>
|
2431 |
+
<tr class="acf-row">
|
2432 |
+
<td width="35%"><code>{current:form:title}</code></td>
|
2433 |
+
<td>Form<br/></td>
|
2434 |
+
</tr>
|
2435 |
+
<tr class="acf-row">
|
2436 |
+
<td width="35%"><code>{current:form:name}</code></td>
|
2437 |
+
<td>form<br/></td>
|
2438 |
+
</tr>
|
2439 |
+
</tbody>
|
2440 |
+
</table>
|
2441 |
+
<?php
|
2442 |
+
}
|
2443 |
+
|
2444 |
+
}
|
2445 |
+
|
2446 |
+
// initialize
|
2447 |
+
acfe()->acfe_form = new acfe_form();
|
2448 |
+
|
2449 |
+
endif;
|
2450 |
+
|
2451 |
+
function acfe_form_render_fields($content, $post_id, $args){
|
2452 |
+
|
2453 |
+
return acfe()->acfe_form->render_fields($content, $post_id, $args);
|
2454 |
+
|
2455 |
+
}
|
2456 |
+
|
2457 |
+
function acfe_form_map_field_value($field, $post_id = 0, $form = array()){
|
2458 |
+
|
2459 |
+
return acfe()->acfe_form->map_field_value($field, $post_id, $form);
|
2460 |
+
|
2461 |
+
}
|
2462 |
+
|
2463 |
+
function acfe_form_map_field_value_load($field, $post_id = 0, $form = array()){
|
2464 |
+
|
2465 |
+
return acfe()->acfe_form->map_field_value_load($field, $post_id, $form);
|
2466 |
+
|
2467 |
+
}
|
2468 |
+
|
2469 |
+
function acfe_form_filter_meta($meta, $acf){
|
2470 |
+
|
2471 |
+
return acfe()->acfe_form->filter_meta($meta, $acf);
|
2472 |
+
|
2473 |
+
}
|
2474 |
+
|
2475 |
+
function acfe_form_format_value($value, $post_id = 0, $field){
|
2476 |
+
|
2477 |
+
return acfe()->acfe_form->format_value($value, $post_id, $field);
|
2478 |
+
|
2479 |
+
}
|
2480 |
+
|
2481 |
+
// Match field_abcdef123456
|
2482 |
+
function acfe_form_map_field_key($content){
|
2483 |
+
|
2484 |
+
if(empty($content) || !is_string($content))
|
2485 |
+
return $content;
|
2486 |
+
|
2487 |
+
if(!acf_is_field_key($content))
|
2488 |
+
return $content;
|
2489 |
+
|
2490 |
+
// Setup data
|
2491 |
+
$data = array();
|
2492 |
+
|
2493 |
+
$store = acf_get_store('acfe/form');
|
2494 |
+
|
2495 |
+
if($store->has('data')){
|
2496 |
+
|
2497 |
+
$data = $store->get('data');
|
2498 |
|
2499 |
+
}
|
2500 |
+
|
2501 |
+
if(!empty($data)){
|
2502 |
|
2503 |
+
foreach($data as $field){
|
2504 |
|
2505 |
+
if($field['key'] !== $content)
|
2506 |
+
continue;
|
2507 |
+
|
2508 |
+
return $field['value'];
|
2509 |
|
2510 |
}
|
2511 |
|
2512 |
+
}
|
2513 |
+
|
2514 |
+
return false;
|
2515 |
+
|
2516 |
+
}
|
2517 |
+
|
2518 |
+
function acfe_form_map_current($content, $post_id = 0, $form = array()){
|
2519 |
+
|
2520 |
+
if(empty($content) || !is_string($content))
|
2521 |
+
return $content;
|
2522 |
+
|
2523 |
+
// init
|
2524 |
+
$value = 0;
|
2525 |
+
|
2526 |
+
// Post
|
2527 |
+
$post = acf_get_post_id_info($post_id);
|
2528 |
+
|
2529 |
+
// Match current_post
|
2530 |
+
if($content === 'current_post'){
|
2531 |
|
2532 |
+
if($post['type'] === 'post')
|
2533 |
+
$value = $post['id'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2534 |
|
2535 |
+
return $value;
|
2536 |
|
2537 |
}
|
2538 |
|
2539 |
+
// Match current_post_parent
|
2540 |
+
elseif($content === 'current_post_parent'){
|
2541 |
+
|
2542 |
+
if($post['type'] === 'post')
|
2543 |
+
$value = get_post_field('post_parent', $post['id']);
|
2544 |
|
2545 |
+
return $value;
|
|
|
2546 |
|
2547 |
+
}
|
2548 |
+
|
2549 |
+
// Match current_post_author
|
2550 |
+
elseif($content === 'current_post_author'){
|
2551 |
|
2552 |
+
if($post['type'] === 'post')
|
2553 |
+
$value = get_post_field('post_author', $post['id']);
|
|
|
2554 |
|
2555 |
+
return $value;
|
|
|
2556 |
|
2557 |
}
|
2558 |
|
2559 |
+
// Match current_term
|
2560 |
+
if($content === 'current_term'){
|
2561 |
|
2562 |
+
if($post['type'] === 'term')
|
2563 |
+
$value = $post['id'];
|
|
|
|
|
|
|
|
|
|
|
|
|
2564 |
|
2565 |
+
return $value;
|
|
|
|
|
|
|
2566 |
|
2567 |
+
}
|
2568 |
+
|
2569 |
+
// Match current_term_parent
|
2570 |
+
elseif($content === 'current_term_parent'){
|
2571 |
|
2572 |
+
if($post['type'] === 'term')
|
2573 |
+
$value = get_term_field('parent', $post['id']);
|
|
|
|
|
|
|
2574 |
|
2575 |
+
return $value;
|
|
|
|
|
2576 |
|
2577 |
+
}
|
2578 |
+
|
2579 |
+
// Match current_user
|
2580 |
+
elseif($content === 'current_user'){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2581 |
|
2582 |
+
return get_current_user_id();
|
|
|
|
|
|
|
2583 |
|
2584 |
+
}
|
2585 |
+
|
2586 |
+
// Match generate_password
|
2587 |
+
elseif($content === 'generate_password'){
|
2588 |
|
2589 |
+
return wp_generate_password(8, false);
|
|
|
|
|
2590 |
|
2591 |
+
}
|
2592 |
+
|
2593 |
+
// Match {current:post:id}
|
2594 |
+
elseif(strpos($content, '{current:') !== false){
|
2595 |
+
|
2596 |
+
// Match {query_var:name}
|
2597 |
+
if(preg_match_all('/{current:(.*?)}/', $content, $matches)){
|
|
|
2598 |
|
2599 |
+
foreach($matches[1] as $i => $name){
|
2600 |
+
|
2601 |
+
$value = false;
|
2602 |
+
|
2603 |
+
if(strpos($name, ':') !== false){
|
2604 |
+
|
2605 |
+
$explode = explode(':', $name);
|
2606 |
+
|
2607 |
+
$type = $explode[0]; // post, term, user
|
2608 |
+
$field = $explode[1]; // id, post_parent, post_title
|
2609 |
+
|
2610 |
+
// {current:post:id}
|
2611 |
+
if($type === 'post' && $post['type'] === 'post'){
|
2612 |
+
|
2613 |
+
// id
|
2614 |
+
if(strtolower($field) === 'id' || strtolower($field) === 'post_id'){
|
2615 |
+
|
2616 |
+
$value = $post['id'];
|
2617 |
+
|
2618 |
+
}
|
2619 |
+
|
2620 |
+
// permalink
|
2621 |
+
elseif(strtolower($field) === 'permalink'){
|
2622 |
+
|
2623 |
+
$value = get_permalink($post['id']);
|
2624 |
+
|
2625 |
+
}
|
2626 |
+
|
2627 |
+
// admin url
|
2628 |
+
elseif(strtolower($field) === 'admin_url'){
|
2629 |
+
|
2630 |
+
$value = admin_url('post.php?post=' . $post['id'] . '&action=edit');
|
2631 |
+
|
2632 |
+
}
|
2633 |
+
|
2634 |
+
// other
|
2635 |
+
else{
|
2636 |
+
|
2637 |
+
$value = get_post_field($field, $post['id']);
|
2638 |
+
|
2639 |
+
}
|
2640 |
+
|
2641 |
+
}
|
2642 |
+
|
2643 |
+
// {current:term:id}
|
2644 |
+
elseif($type === 'term' && $post['type'] === 'term'){
|
2645 |
+
|
2646 |
+
// id
|
2647 |
+
if(strtolower($field) === 'id' || strtolower($field) === 'term_id'){
|
2648 |
+
|
2649 |
+
$value = $post['id'];
|
2650 |
+
|
2651 |
+
}
|
2652 |
+
|
2653 |
+
// permalink
|
2654 |
+
elseif(strtolower($field) === 'permalink'){
|
2655 |
+
|
2656 |
+
$value = get_term_link($post['id']);
|
2657 |
+
|
2658 |
+
}
|
2659 |
+
|
2660 |
+
// admin url
|
2661 |
+
elseif(strtolower($field) === 'admin_url'){
|
2662 |
+
|
2663 |
+
$value = admin_url('term.php?tag_ID=' . $post['id']);
|
2664 |
+
|
2665 |
+
}
|
2666 |
+
|
2667 |
+
// other
|
2668 |
+
else{
|
2669 |
+
|
2670 |
+
$value = get_term_field($field, $post['id']);
|
2671 |
+
|
2672 |
+
}
|
2673 |
+
|
2674 |
+
}
|
2675 |
+
|
2676 |
+
// {current:user:id}
|
2677 |
+
elseif($type === 'user'){
|
2678 |
+
|
2679 |
+
if(is_user_logged_in()){
|
2680 |
+
|
2681 |
+
$user_id = get_current_user_id();
|
2682 |
+
|
2683 |
+
// id
|
2684 |
+
if(strtolower($field) === 'id' || strtolower($field) === 'user_id'){
|
2685 |
+
|
2686 |
+
$value = $user_id;
|
2687 |
+
|
2688 |
+
}
|
2689 |
+
|
2690 |
+
// permalink
|
2691 |
+
elseif(strtolower($field) === 'permalink'){
|
2692 |
+
|
2693 |
+
$value = get_author_posts_url($user_id);
|
2694 |
+
|
2695 |
+
}
|
2696 |
+
|
2697 |
+
// admin url
|
2698 |
+
elseif(strtolower($field) === 'admin_url'){
|
2699 |
+
|
2700 |
+
$value = admin_url('user-edit.php?user_id=' . $user_id);
|
2701 |
+
|
2702 |
+
}
|
2703 |
+
|
2704 |
+
// other
|
2705 |
+
else{
|
2706 |
+
|
2707 |
+
$value = false;
|
2708 |
+
|
2709 |
+
$user_object = get_user_by('ID', $user_id);
|
2710 |
+
|
2711 |
+
if(isset($user_object->data)){
|
2712 |
+
|
2713 |
+
// return array
|
2714 |
+
$user = json_decode(json_encode($user_object->data), true);
|
2715 |
+
|
2716 |
+
$user_object_meta = get_user_meta($user_id);
|
2717 |
+
|
2718 |
+
$user_meta = array();
|
2719 |
+
|
2720 |
+
foreach($user_object_meta as $k => $v){
|
2721 |
+
|
2722 |
+
if(!isset($v[0]))
|
2723 |
+
continue;
|
2724 |
+
|
2725 |
+
$user_meta[$k] = $v[0];
|
2726 |
+
|
2727 |
+
}
|
2728 |
+
|
2729 |
+
$user = array_merge($user, $user_meta);
|
2730 |
+
|
2731 |
+
$value = acf_maybe_get($user, $field);
|
2732 |
+
|
2733 |
+
}
|
2734 |
+
|
2735 |
+
}
|
2736 |
+
|
2737 |
+
}
|
2738 |
+
|
2739 |
+
}
|
2740 |
+
|
2741 |
+
// {current:author:id}
|
2742 |
+
elseif($type === 'author' && $post['type'] === 'post'){
|
2743 |
+
|
2744 |
+
$user_id = get_post_field('post_author', $post['id']);
|
2745 |
+
|
2746 |
+
if($user_id){
|
2747 |
+
|
2748 |
+
// id
|
2749 |
+
if(strtolower($field) === 'id' || strtolower($field) === 'user_id'){
|
2750 |
+
|
2751 |
+
$value = $user_id;
|
2752 |
+
|
2753 |
+
}
|
2754 |
+
|
2755 |
+
// permalink
|
2756 |
+
elseif(strtolower($field) === 'permalink'){
|
2757 |
+
|
2758 |
+
$value = get_author_posts_url($user_id);
|
2759 |
+
|
2760 |
+
}
|
2761 |
+
|
2762 |
+
// admin url
|
2763 |
+
elseif(strtolower($field) === 'admin_url'){
|
2764 |
+
|
2765 |
+
$value = admin_url('user-edit.php?user_id=' . $user_id);
|
2766 |
+
|
2767 |
+
}
|
2768 |
+
|
2769 |
+
// other
|
2770 |
+
else{
|
2771 |
+
|
2772 |
+
$value = false;
|
2773 |
+
|
2774 |
+
$user_object = get_user_by('ID', $user_id);
|
2775 |
+
|
2776 |
+
if(isset($user_object->data)){
|
2777 |
+
|
2778 |
+
// return array
|
2779 |
+
$user = json_decode(json_encode($user_object->data), true);
|
2780 |
+
|
2781 |
+
$user_object_meta = get_user_meta($user_id);
|
2782 |
+
|
2783 |
+
$user_meta = array();
|
2784 |
+
|
2785 |
+
foreach($user_object_meta as $k => $v){
|
2786 |
+
|
2787 |
+
if(!isset($v[0]))
|
2788 |
+
continue;
|
2789 |
+
|
2790 |
+
$user_meta[$k] = $v[0];
|
2791 |
+
|
2792 |
+
}
|
2793 |
+
|
2794 |
+
$user = array_merge($user, $user_meta);
|
2795 |
+
|
2796 |
+
$value = acf_maybe_get($user, $field);
|
2797 |
+
|
2798 |
+
}
|
2799 |
+
|
2800 |
+
}
|
2801 |
+
|
2802 |
+
}
|
2803 |
+
|
2804 |
+
|
2805 |
+
}
|
2806 |
+
|
2807 |
+
// {current:form:id}
|
2808 |
+
elseif($type === 'form'){
|
2809 |
+
|
2810 |
+
if(strtolower($field) === 'id' || strtolower($field) === 'form_id'){
|
2811 |
+
|
2812 |
+
$value = acf_maybe_get($form, 'form_id');
|
2813 |
+
|
2814 |
+
}
|
2815 |
+
|
2816 |
+
elseif(strtolower($field) === 'name' || strtolower($field) === 'form_name'){
|
2817 |
+
|
2818 |
+
$value = acf_maybe_get($form, 'form_name');
|
2819 |
+
|
2820 |
+
}
|
2821 |
+
|
2822 |
+
elseif(strtolower($field) === 'title' || strtolower($field) === 'form_title'){
|
2823 |
+
|
2824 |
+
$form_id = acf_maybe_get($form, 'form_id');
|
2825 |
+
|
2826 |
+
if($form_id)
|
2827 |
+
$value = get_the_title($form_id);
|
2828 |
+
|
2829 |
+
}else{
|
2830 |
+
|
2831 |
+
$value = acf_maybe_get($form, $field);
|
2832 |
+
|
2833 |
+
}
|
2834 |
+
|
2835 |
+
}
|
2836 |
|
2837 |
+
}
|
2838 |
+
|
2839 |
+
// {current:post}
|
2840 |
+
elseif($name === 'post' && $post['type'] === 'post'){
|
2841 |
+
|
2842 |
+
$value = $post['id'];
|
2843 |
+
|
2844 |
+
}
|
2845 |
+
|
2846 |
+
// {current:term}
|
2847 |
+
elseif($name === 'term' && $post['type'] === 'term'){
|
2848 |
+
|
2849 |
+
$value = $post['id'];
|
2850 |
+
|
2851 |
+
}
|
2852 |
+
|
2853 |
+
// {current:user}
|
2854 |
+
elseif($name === 'user'){
|
2855 |
+
|
2856 |
+
$value = get_current_user_id();
|
2857 |
+
|
2858 |
+
}
|
2859 |
+
|
2860 |
+
// {current:author}
|
2861 |
+
elseif($name === 'author' && $post['type'] === 'post'){
|
2862 |
+
|
2863 |
+
$value = get_post_field('post_author', $post['id']);
|
2864 |
+
|
2865 |
+
}
|
2866 |
+
|
2867 |
+
// {current:form}
|
2868 |
+
elseif($name === 'form'){
|
2869 |
+
|
2870 |
+
$value = acf_maybe_get($form, 'form_id');
|
2871 |
+
|
2872 |
+
}
|
2873 |
+
|
2874 |
+
$content = str_replace('{current:' . $name . '}', $value, $content);
|
2875 |
|
2876 |
}
|
2877 |
|
|
|
|
|
|
|
|
|
|
|
2878 |
}
|
2879 |
|
2880 |
+
}
|
2881 |
+
|
2882 |
+
return $content;
|
2883 |
+
|
2884 |
+
}
|
2885 |
+
|
2886 |
+
// Match {query_var:name} {query_var:name:key}
|
2887 |
+
function acfe_form_map_query_var($content){
|
2888 |
+
|
2889 |
+
if(empty($content) || !is_string($content))
|
2890 |
+
return $content;
|
2891 |
+
|
2892 |
+
if(strpos($content, '{query_var:') === false)
|
2893 |
+
return $content;
|
2894 |
+
|
2895 |
+
// Match {query_var:name}
|
2896 |
+
if(preg_match_all('/{query_var:(.*?)}/', $content, $matches)){
|
2897 |
+
|
2898 |
+
foreach($matches[1] as $i => $name){
|
2899 |
|
2900 |
+
$query_var = get_query_var($name);
|
|
|
|
|
|
|
|
|
2901 |
|
2902 |
+
if(strpos($name, ':') !== false){
|
2903 |
|
2904 |
+
$explode = explode(':', $name);
|
2905 |
|
2906 |
+
$query_var = get_query_var($explode[0]);
|
|
|
|
|
|
|
2907 |
|
2908 |
+
if(is_array($query_var) && isset($query_var[$explode[1]])){
|
2909 |
+
|
2910 |
+
$query_var = $query_var[$explode[1]];
|
2911 |
+
|
2912 |
+
}
|
2913 |
|
2914 |
}
|
2915 |
|
2916 |
+
$content = str_replace('{query_var:' . $name . '}', $query_var, $content);
|
|
|
2917 |
|
2918 |
}
|
2919 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2920 |
}
|
2921 |
|
2922 |
+
return $content;
|
2923 |
+
|
2924 |
+
}
|
2925 |
+
|
2926 |
+
// Match {get_field:name} {get_field:name:123}
|
2927 |
+
function acfe_form_map_get_field($content, $post_id = 0){
|
2928 |
+
|
2929 |
+
if(empty($content) || !is_string($content))
|
2930 |
+
return $content;
|
2931 |
+
|
2932 |
+
if(strpos($content, '{get_field:') === false)
|
2933 |
+
return $content;
|
2934 |
+
|
2935 |
+
// Match {get_field:name}
|
2936 |
+
if(preg_match_all('/{get_field:(.*?)}/', $content, $matches)){
|
2937 |
|
2938 |
+
foreach($matches[1] as $i => $name){
|
|
|
|
|
2939 |
|
2940 |
+
if(strpos($name, ':') === false){
|
2941 |
+
|
2942 |
+
$get_field = get_field($name, $post_id);
|
2943 |
+
|
2944 |
+
}else{
|
2945 |
+
|
2946 |
+
$explode = explode(':', $name);
|
2947 |
+
|
2948 |
+
// Field
|
2949 |
+
$field = $explode[0];
|
2950 |
+
|
2951 |
+
// ID
|
2952 |
+
$id = $explode[1];
|
2953 |
+
|
2954 |
+
if($id === 'current')
|
2955 |
+
$id = $post_id;
|
2956 |
+
|
2957 |
+
// Format
|
2958 |
+
$format = true;
|
2959 |
+
|
2960 |
+
if(acf_maybe_get($explode, 2) === 'false')
|
2961 |
+
$format = false;
|
2962 |
+
|
2963 |
+
$get_field = get_field($field, $id, $format);
|
2964 |
+
|
2965 |
+
}
|
2966 |
|
2967 |
+
$content = str_replace('{get_field:' . $name . '}', $get_field, $content);
|
2968 |
|
2969 |
}
|
2970 |
|
|
|
|
|
2971 |
}
|
2972 |
|
2973 |
+
return $content;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2974 |
|
2975 |
+
}
|
2976 |
+
|
2977 |
+
// Match {field:name} {field:key}
|
2978 |
+
function acfe_form_map_field($content){
|
2979 |
+
|
2980 |
+
if(empty($content) || !is_string($content))
|
2981 |
+
return $content;
|
2982 |
+
|
2983 |
+
if(strpos($content, '{field:') === false)
|
2984 |
+
return $content;
|
2985 |
+
|
2986 |
+
if(preg_match_all('/{field:(.*?)}/', $content, $matches)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2987 |
|
2988 |
+
// Setup data
|
2989 |
+
$data = array();
|
2990 |
|
2991 |
+
$store = acf_get_store('acfe/form');
|
|
|
|
|
2992 |
|
2993 |
+
if($store->has('data')){
|
|
|
2994 |
|
2995 |
+
$data = $store->get('data');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2996 |
|
2997 |
}
|
2998 |
|
2999 |
+
foreach($matches[1] as $i => $field_key){
|
|
|
|
|
|
|
|
|
|
|
3000 |
|
3001 |
+
$format = true;
|
|
|
|
|
|
|
3002 |
|
3003 |
+
if(strpos($field_key, ':') !== false){
|
|
|
|
|
|
|
3004 |
|
3005 |
+
$explode = explode(':', $field_key);
|
3006 |
|
3007 |
+
$field_key = $explode[0]; // field_123abc
|
3008 |
+
$format = $explode[1]; // true / false
|
|
|
|
|
3009 |
|
3010 |
+
if($format === 'false')
|
3011 |
+
$format = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3012 |
|
3013 |
+
}
|
3014 |
+
|
3015 |
+
if(!empty($data)){
|
|
|
|
|
|
|
3016 |
|
3017 |
+
foreach($data as $field){
|
|
|
3018 |
|
3019 |
+
if($field['name'] !== $field_key && $field['key'] !== $field_key)
|
3020 |
+
continue;
|
3021 |
|
3022 |
+
// Value
|
3023 |
+
$value = $field['value'];
|
|
|
|
|
3024 |
|
3025 |
+
if($format)
|
3026 |
+
$value = acfe_form_format_value($field['value'], 0, $field['field']);
|
3027 |
|
3028 |
+
// Replace
|
3029 |
+
$content = str_replace('{field:' . $field_key . '}', $value, $content);
|
|
|
|
|
3030 |
|
3031 |
+
break;
|
|
|
|
|
|
|
3032 |
|
3033 |
}
|
3034 |
|
|
|
|
|
|
|
3035 |
}
|
3036 |
|
3037 |
+
// Fallback (clean)
|
3038 |
+
$content = str_replace('{field:' . $field_key . '}', '', $content);
|
3039 |
+
|
|
|
|
|
|
|
3040 |
}
|
3041 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3042 |
}
|
3043 |
|
3044 |
+
// Return
|
3045 |
+
return $content;
|
3046 |
+
|
3047 |
+
}
|
3048 |
+
|
3049 |
+
// Match {fields}
|
3050 |
+
function acfe_form_map_fields($content){
|
3051 |
+
|
3052 |
+
if(empty($content) || !is_string($content))
|
3053 |
+
return $content;
|
3054 |
+
|
3055 |
+
if(strpos($content, '{fields}') === false)
|
3056 |
+
return $content;
|
3057 |
+
|
3058 |
+
// Match {fields}
|
3059 |
+
if(preg_match('/{fields}/', $content, $matches)){
|
3060 |
|
3061 |
+
// Setup data
|
3062 |
+
$data = array();
|
3063 |
|
3064 |
+
$store = acf_get_store('acfe/form');
|
3065 |
|
3066 |
+
if($store->has('data')){
|
3067 |
|
3068 |
+
$data = $store->get('data');
|
3069 |
|
3070 |
}
|
3071 |
|
3072 |
+
$content_html = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3073 |
|
3074 |
+
if(!empty($data)){
|
|
|
3075 |
|
3076 |
+
foreach($data as $field){
|
3077 |
+
|
3078 |
+
// Label
|
3079 |
+
$label = !empty($field['label']) ? $field['label'] : $field['name'];
|
3080 |
+
|
3081 |
+
// Value
|
3082 |
+
$value = acfe_form_format_value($field['value'], 0, $field['field']);
|
3083 |
+
|
3084 |
+
// Add
|
3085 |
+
$content_html .= $label . ': ' . $value . "<br/>\n";
|
3086 |
+
|
3087 |
}
|
3088 |
|
3089 |
}
|
3090 |
|
3091 |
+
// Replace
|
3092 |
+
$content = str_replace('{fields}', $content_html, $content);
|
3093 |
|
3094 |
}
|
3095 |
|
3096 |
+
// Return
|
3097 |
+
return $content;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3098 |
|
3099 |
}
|
3100 |
|
3101 |
+
function acfe_form_map_vs_fields($map, $fields, $post_id = 0, $form = array()){
|
3102 |
|
3103 |
+
$return = array();
|
|
|
3104 |
|
3105 |
+
foreach($map as $mkey => $mval){
|
3106 |
+
|
3107 |
+
if(empty($mval))
|
3108 |
+
continue;
|
3109 |
+
|
3110 |
+
$return[$mkey] = acfe_form_map_field_value($mval, $post_id, $form);
|
3111 |
+
|
3112 |
+
}
|
3113 |
|
3114 |
+
foreach($fields as $fkey => $fvalue){
|
|
|
3115 |
|
3116 |
+
if(isset($return[$fkey]))
|
3117 |
+
continue;
|
3118 |
+
|
3119 |
+
$return[$fkey] = acfe_form_map_field_value($fvalue, $post_id, $form);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3120 |
|
3121 |
}
|
3122 |
|
3123 |
+
return $return;
|
3124 |
|
3125 |
}
|
includes/modules/form/field-group.php
CHANGED
@@ -7,6 +7,10 @@ acf_add_local_field_group(array(
|
|
7 |
'key' => 'group_acfe_dynamic_form',
|
8 |
'title' => 'Dynamic Form',
|
9 |
'fields' => array(
|
|
|
|
|
|
|
|
|
10 |
array(
|
11 |
'key' => 'field_acfe_form_tab_general',
|
12 |
'label' => 'General',
|
@@ -69,6 +73,26 @@ acf_add_local_field_group(array(
|
|
69 |
'return_format' => 'value',
|
70 |
'placeholder' => '',
|
71 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
array(
|
73 |
'key' => 'field_acfe_form_form_element',
|
74 |
'label' => 'Form element',
|
@@ -96,7 +120,6 @@ acf_add_local_field_group(array(
|
|
96 |
'type' => 'group',
|
97 |
'instructions' => 'Form class and id',
|
98 |
'required' => 0,
|
99 |
-
'conditional_logic' => 0,
|
100 |
'wrapper' => array(
|
101 |
'width' => '',
|
102 |
'class' => '',
|
@@ -209,7 +232,6 @@ acf_add_local_field_group(array(
|
|
209 |
'type' => 'group',
|
210 |
'instructions' => 'Add class to all fields',
|
211 |
'required' => 0,
|
212 |
-
'conditional_logic' => 0,
|
213 |
'wrapper' => array(
|
214 |
'width' => '',
|
215 |
'class' => '',
|
@@ -264,11 +286,11 @@ acf_add_local_field_group(array(
|
|
264 |
),
|
265 |
),
|
266 |
array(
|
267 |
-
'key' => '
|
268 |
-
'label' => '
|
269 |
-
'name' => '
|
270 |
-
'type' => '
|
271 |
-
'instructions' => '
|
272 |
'required' => 0,
|
273 |
'conditional_logic' => 0,
|
274 |
'wrapper' => array(
|
@@ -277,21 +299,21 @@ acf_add_local_field_group(array(
|
|
277 |
'id' => '',
|
278 |
),
|
279 |
'acfe_permissions' => '',
|
280 |
-
'
|
281 |
-
'
|
282 |
-
'
|
283 |
-
'
|
|
|
284 |
),
|
285 |
array(
|
286 |
'key' => 'field_acfe_form_custom_html',
|
287 |
'label' => 'HTML Form render',
|
288 |
'name' => 'acfe_form_custom_html',
|
289 |
'type' => 'acfe_code_editor',
|
290 |
-
'instructions' => 'Render your own customized HTML
|
291 |
Field groups may be included using <code>{field_group:group_key}</code><br/><code>{field_group:Group title}</code><br/><br/>
|
292 |
Fields may be included using <code>{field:field_key}</code><br/><code>{field:field_name}</code>',
|
293 |
'required' => 0,
|
294 |
-
'conditional_logic' => 0,
|
295 |
'wrapper' => array(
|
296 |
'width' => '',
|
297 |
'class' => '',
|
@@ -302,6 +324,34 @@ acf_add_local_field_group(array(
|
|
302 |
'placeholder' => '',
|
303 |
'maxlength' => '',
|
304 |
'rows' => 12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
),
|
306 |
array(
|
307 |
'key' => 'field_acfe_form_html_after_fields',
|
@@ -424,9 +474,13 @@ acf_add_local_field_group(array(
|
|
424 |
'maxlength' => '',
|
425 |
'rows' => 2,
|
426 |
),
|
|
|
|
|
|
|
|
|
427 |
array(
|
428 |
-
'key' => '
|
429 |
-
'label' => '
|
430 |
'name' => '',
|
431 |
'type' => 'tab',
|
432 |
'instructions' => '',
|
@@ -461,6 +515,26 @@ acf_add_local_field_group(array(
|
|
461 |
'ui_on_text' => '',
|
462 |
'ui_off_text' => '',
|
463 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
array(
|
465 |
'key' => 'field_acfe_form_hide_unload',
|
466 |
'label' => 'Hide confirmation on exit',
|
@@ -541,34 +615,13 @@ acf_add_local_field_group(array(
|
|
541 |
'append' => '',
|
542 |
'maxlength' => '',
|
543 |
),
|
544 |
-
|
545 |
-
array(
|
546 |
-
'key' => 'field_acfe_form_updated_message',
|
547 |
-
'label' => 'Success message',
|
548 |
-
'name' => 'acfe_form_updated_message',
|
549 |
-
'type' => 'wysiwyg',
|
550 |
-
'instructions' => 'A message displayed above the form after being redirected. Can also be empty for no message.<br /><br />You may use <code>{field:field_name}</code> <code>{field:field_key}</code> <code>{query_var:name}</code> <code>{query_var:name:key}</code>.',
|
551 |
-
'required' => 0,
|
552 |
-
'conditional_logic' => 0,
|
553 |
-
'wrapper' => array(
|
554 |
-
'width' => '',
|
555 |
-
'class' => '',
|
556 |
-
'id' => '',
|
557 |
-
),
|
558 |
-
'acfe_permissions' => '',
|
559 |
-
'default_value' => __('Post updated', 'acf'),
|
560 |
-
'tabs' => 'all',
|
561 |
-
'toolbar' => 'full',
|
562 |
-
'media_upload' => 1,
|
563 |
-
'delay' => 0,
|
564 |
-
),
|
565 |
array(
|
566 |
-
'key' => '
|
567 |
-
'label' => '
|
568 |
-
'name' => '
|
569 |
-
'type' => '
|
570 |
-
'
|
571 |
-
|
572 |
'required' => 0,
|
573 |
'conditional_logic' => 0,
|
574 |
'wrapper' => array(
|
@@ -577,37 +630,14 @@ acf_add_local_field_group(array(
|
|
577 |
'id' => '',
|
578 |
),
|
579 |
'acfe_permissions' => '',
|
580 |
-
'default_value' => '<div id="message" class="updated">%s</div>',
|
581 |
-
'placeholder' => '',
|
582 |
-
'maxlength' => '',
|
583 |
-
'rows' => 2,
|
584 |
-
),
|
585 |
-
array(
|
586 |
-
'key' => 'field_acfe_form_updated_hide_form',
|
587 |
-
'label' => 'Hide form',
|
588 |
-
'name' => 'acfe_form_updated_hide_form',
|
589 |
-
'type' => 'true_false',
|
590 |
-
'instructions' => 'Hide form on successful submission',
|
591 |
-
'required' => 0,
|
592 |
-
'conditional_logic' => array(),
|
593 |
-
'wrapper' => array(
|
594 |
-
'width' => '',
|
595 |
-
'class' => '',
|
596 |
-
'id' => '',
|
597 |
-
),
|
598 |
-
'acfe_permissions' => '',
|
599 |
-
'message' => '',
|
600 |
-
'default_value' => 0,
|
601 |
-
'ui' => 1,
|
602 |
-
'ui_on_text' => '',
|
603 |
-
'ui_off_text' => '',
|
604 |
),
|
605 |
array(
|
606 |
-
'key' => '
|
607 |
-
'label' => '
|
608 |
-
'name' => '
|
609 |
-
'type' => '
|
610 |
-
'
|
|
|
611 |
'required' => 0,
|
612 |
'conditional_logic' => 0,
|
613 |
'wrapper' => array(
|
@@ -616,12 +646,11 @@ acf_add_local_field_group(array(
|
|
616 |
'id' => '',
|
617 |
),
|
618 |
'acfe_permissions' => '',
|
619 |
-
'default_value' => '',
|
620 |
-
'placeholder' => '',
|
621 |
-
'prepend' => '',
|
622 |
-
'append' => '',
|
623 |
-
'maxlength' => '',
|
624 |
),
|
|
|
|
|
|
|
|
|
625 |
array(
|
626 |
'key' => 'field_acfe_form_tab_actions',
|
627 |
'label' => 'Actions',
|
@@ -677,12 +706,33 @@ acf_add_local_field_group(array(
|
|
677 |
'label' => 'Custom action',
|
678 |
'display' => 'row',
|
679 |
'sub_fields' => array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
array(
|
681 |
'key' => 'field_acfe_form_custom_action',
|
682 |
'label' => 'Action name',
|
683 |
'name' => 'acfe_form_custom_action',
|
684 |
'type' => 'acfe_slug',
|
685 |
-
'instructions' => '
|
686 |
'required' => 1,
|
687 |
'conditional_logic' => 0,
|
688 |
'wrapper' => array(
|
@@ -697,6 +747,75 @@ acf_add_local_field_group(array(
|
|
697 |
'append' => '',
|
698 |
'maxlength' => '',
|
699 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
700 |
),
|
701 |
'min' => '',
|
702 |
'max' => '',
|
@@ -711,6 +830,27 @@ acf_add_local_field_group(array(
|
|
711 |
'label' => 'Email action',
|
712 |
'display' => 'row',
|
713 |
'sub_fields' => array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
714 |
array(
|
715 |
'key' => 'field_acfe_form_email_custom_alias',
|
716 |
'label' => 'Action name',
|
@@ -731,34 +871,54 @@ acf_add_local_field_group(array(
|
|
731 |
'append' => '',
|
732 |
'maxlength' => '',
|
733 |
),
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
762 |
array(
|
763 |
'key' => 'field_acfe_form_email_from',
|
764 |
'label' => 'From',
|
@@ -779,10 +939,89 @@ acf_add_local_field_group(array(
|
|
779 |
'append' => '',
|
780 |
'maxlength' => '',
|
781 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
782 |
array(
|
783 |
-
'key' => '
|
784 |
-
'label' => '
|
785 |
-
'name' => '
|
786 |
'type' => 'text',
|
787 |
'instructions' => '',
|
788 |
'required' => 1,
|
@@ -794,26 +1033,7 @@ acf_add_local_field_group(array(
|
|
794 |
),
|
795 |
'acfe_permissions' => '',
|
796 |
'default_value' => '',
|
797 |
-
'placeholder' => '
|
798 |
-
'prepend' => '',
|
799 |
-
'append' => '',
|
800 |
-
),
|
801 |
-
array(
|
802 |
-
'key' => 'field_acfe_form_email_subject',
|
803 |
-
'label' => 'Subject',
|
804 |
-
'name' => 'acfe_form_email_subject',
|
805 |
-
'type' => 'text',
|
806 |
-
'instructions' => '',
|
807 |
-
'required' => 1,
|
808 |
-
'conditional_logic' => 0,
|
809 |
-
'wrapper' => array(
|
810 |
-
'width' => '',
|
811 |
-
'class' => '',
|
812 |
-
'id' => '',
|
813 |
-
),
|
814 |
-
'acfe_permissions' => '',
|
815 |
-
'default_value' => '',
|
816 |
-
'placeholder' => '',
|
817 |
'prepend' => '',
|
818 |
'append' => '',
|
819 |
'maxlength' => '',
|
@@ -823,7 +1043,7 @@ acf_add_local_field_group(array(
|
|
823 |
'label' => 'Content',
|
824 |
'name' => 'acfe_form_email_content',
|
825 |
'type' => 'wysiwyg',
|
826 |
-
'instructions' => 'Fields values may be included using <code>{field:field_key}</code> <code>{field:title}</code
|
827 |
'required' => 1,
|
828 |
'conditional_logic' => 0,
|
829 |
'wrapper' => array(
|
@@ -838,9 +1058,30 @@ acf_add_local_field_group(array(
|
|
838 |
'media_upload' => 1,
|
839 |
'delay' => 0,
|
840 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
841 |
array(
|
842 |
'key' => 'field_acfe_form_email_files',
|
843 |
-
'label' => '
|
844 |
'name' => 'acfe_form_email_files',
|
845 |
'type' => 'repeater',
|
846 |
'instructions' => '',
|
@@ -879,53 +1120,39 @@ acf_add_local_field_group(array(
|
|
879 |
),
|
880 |
'allow_null' => 0,
|
881 |
'multiple' => 0,
|
882 |
-
'ui' =>
|
883 |
'return_format' => 'value',
|
884 |
'ajax' => 0,
|
885 |
'placeholder' => '',
|
|
|
|
|
886 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
887 |
),
|
888 |
),
|
889 |
-
),
|
890 |
-
'min' => '',
|
891 |
-
'max' => '',
|
892 |
-
),
|
893 |
-
|
894 |
-
/*
|
895 |
-
* Layout: Option
|
896 |
-
*/
|
897 |
-
/*
|
898 |
-
'layout_option' => array(
|
899 |
-
'key' => 'layout_option',
|
900 |
-
'name' => 'option',
|
901 |
-
'label' => 'Option action',
|
902 |
-
'display' => 'row',
|
903 |
-
'sub_fields' => array(
|
904 |
-
array(
|
905 |
-
'key' => 'field_acfe_form_option_load',
|
906 |
-
'label' => 'Load values',
|
907 |
-
'name' => 'acfe_form_option_load',
|
908 |
-
'type' => 'true_false',
|
909 |
-
'instructions' => 'Fill inputs with available values',
|
910 |
-
'required' => 0,
|
911 |
-
'conditional_logic' => 0,
|
912 |
-
'wrapper' => array(
|
913 |
-
'width' => '',
|
914 |
-
'class' => '',
|
915 |
-
'id' => '',
|
916 |
-
),
|
917 |
-
'acfe_permissions' => '',
|
918 |
-
'message' => '',
|
919 |
-
'default_value' => 1,
|
920 |
-
'ui' => 1,
|
921 |
-
'ui_on_text' => '',
|
922 |
-
'ui_off_text' => '',
|
923 |
-
),
|
924 |
array(
|
925 |
-
'key' => '
|
926 |
-
'label' => '
|
927 |
-
'name' => '
|
928 |
-
'type' => '
|
929 |
'instructions' => '',
|
930 |
'required' => 0,
|
931 |
'conditional_logic' => 0,
|
@@ -935,14 +1162,18 @@ acf_add_local_field_group(array(
|
|
935 |
'id' => '',
|
936 |
),
|
937 |
'acfe_permissions' => '',
|
938 |
-
'
|
939 |
-
'
|
|
|
|
|
|
|
|
|
940 |
'sub_fields' => array(
|
941 |
array(
|
942 |
-
'key' => '
|
943 |
-
'label' => '',
|
944 |
-
'name' => '
|
945 |
-
'type' => '
|
946 |
'instructions' => '',
|
947 |
'required' => 0,
|
948 |
'conditional_logic' => 0,
|
@@ -952,54 +1183,38 @@ acf_add_local_field_group(array(
|
|
952 |
'id' => '',
|
953 |
),
|
954 |
'acfe_permissions' => '',
|
955 |
-
'
|
956 |
-
'custom' => 'Custom option name',
|
957 |
-
),
|
958 |
-
'default_value' => array(
|
959 |
-
),
|
960 |
-
'allow_null' => 0,
|
961 |
-
'multiple' => 0,
|
962 |
-
'ui' => 0,
|
963 |
-
'return_format' => 'value',
|
964 |
-
'ajax' => 0,
|
965 |
-
'placeholder' => '',
|
966 |
-
),
|
967 |
-
array(
|
968 |
-
'key' => 'field_acfe_form_option_name_custom',
|
969 |
-
'label' => '',
|
970 |
-
'name' => 'acfe_form_option_name_custom',
|
971 |
-
'type' => 'text',
|
972 |
-
'instructions' => '',
|
973 |
-
'required' => 1,
|
974 |
-
'conditional_logic' => array(
|
975 |
-
array(
|
976 |
-
array(
|
977 |
-
'field' => 'field_acfe_form_option_name',
|
978 |
-
'operator' => '==',
|
979 |
-
'value' => 'custom',
|
980 |
-
),
|
981 |
-
),
|
982 |
-
),
|
983 |
-
'wrapper' => array(
|
984 |
-
'width' => '',
|
985 |
-
'class' => '',
|
986 |
-
'id' => '',
|
987 |
-
),
|
988 |
-
'acfe_permissions' => '',
|
989 |
-
'default_value' => '',
|
990 |
-
'placeholder' => 'Option name or {field:name} *',
|
991 |
-
'prepend' => '',
|
992 |
-
'append' => '',
|
993 |
-
'maxlength' => '',
|
994 |
),
|
995 |
),
|
996 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
997 |
array(
|
998 |
-
'key' => '
|
999 |
-
'label' => '
|
1000 |
-
'name' => '
|
1001 |
-
'type' => '
|
1002 |
-
'
|
|
|
1003 |
'required' => 0,
|
1004 |
'conditional_logic' => 0,
|
1005 |
'wrapper' => array(
|
@@ -1008,21 +1223,27 @@ acf_add_local_field_group(array(
|
|
1008 |
'id' => '',
|
1009 |
),
|
1010 |
'acfe_permissions' => '',
|
1011 |
-
|
1012 |
-
|
1013 |
-
'
|
1014 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1015 |
),
|
1016 |
-
'
|
1017 |
-
'toggle' => 1,
|
1018 |
-
'return_format' => 'value',
|
1019 |
-
'save_custom' => 0,
|
1020 |
),
|
1021 |
),
|
1022 |
'min' => '',
|
1023 |
'max' => '',
|
1024 |
),
|
1025 |
-
*/
|
1026 |
|
1027 |
/*
|
1028 |
* Layout: Post
|
@@ -1033,9 +1254,13 @@ acf_add_local_field_group(array(
|
|
1033 |
'label' => 'Post action',
|
1034 |
'display' => 'row',
|
1035 |
'sub_fields' => array(
|
|
|
|
|
|
|
|
|
1036 |
array(
|
1037 |
-
'key' => '
|
1038 |
-
'label' => '
|
1039 |
'name' => '',
|
1040 |
'type' => 'tab',
|
1041 |
'instructions' => '',
|
@@ -1095,14 +1320,13 @@ acf_add_local_field_group(array(
|
|
1095 |
'append' => '',
|
1096 |
'maxlength' => '',
|
1097 |
),
|
1098 |
-
|
1099 |
'key' => 'field_acfe_form_post_custom_query_var',
|
1100 |
'label' => 'Query var',
|
1101 |
'name' => 'acfe_form_custom_query_var',
|
1102 |
'type' => 'true_false',
|
1103 |
'instructions' => 'Automatically create a query var with the data of the post that has been created/updated.<br />Retrieve data using <code>{query_var:my-action:post_title}</code> <code>{query_var:my-action:permalink}</code> template tags.',
|
1104 |
'required' => 0,
|
1105 |
-
'conditional_logic' => 0,
|
1106 |
'wrapper' => array(
|
1107 |
'width' => '',
|
1108 |
'class' => '',
|
@@ -1114,7 +1338,7 @@ acf_add_local_field_group(array(
|
|
1114 |
'ui' => 1,
|
1115 |
'ui_on_text' => '',
|
1116 |
'ui_off_text' => '',
|
1117 |
-
|
1118 |
array(
|
1119 |
array(
|
1120 |
'field' => 'field_acfe_form_post_custom_alias',
|
@@ -1123,12 +1347,33 @@ acf_add_local_field_group(array(
|
|
1123 |
),
|
1124 |
),
|
1125 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1126 |
array(
|
1127 |
'key' => 'field_acfe_form_post_save_target',
|
1128 |
'label' => 'Target',
|
1129 |
'name' => 'acfe_form_post_save_target',
|
1130 |
'type' => 'select',
|
1131 |
-
'instructions' => '
|
1132 |
'required' => 0,
|
1133 |
'conditional_logic' => array(
|
1134 |
array(
|
@@ -1147,15 +1392,15 @@ acf_add_local_field_group(array(
|
|
1147 |
'acfe_permissions' => '',
|
1148 |
'choices' => array(
|
1149 |
),
|
1150 |
-
'default_value' =>
|
1151 |
-
0 => 'current_post',
|
1152 |
-
),
|
1153 |
'allow_null' => 0,
|
1154 |
'multiple' => 0,
|
1155 |
'ui' => 1,
|
1156 |
-
'ajax' =>
|
1157 |
'return_format' => 'value',
|
1158 |
'placeholder' => '',
|
|
|
|
|
1159 |
),
|
1160 |
array(
|
1161 |
'key' => 'field_acfe_form_post_save_post_type',
|
@@ -1185,13 +1430,14 @@ acf_add_local_field_group(array(
|
|
1185 |
'allow_null' => 1,
|
1186 |
'placeholder' => 'Default',
|
1187 |
'multiple' => 0,
|
1188 |
-
'ui' =>
|
1189 |
'choices' => array(
|
1190 |
),
|
1191 |
'ajax' => 0,
|
1192 |
'layout' => '',
|
1193 |
'toggle' => 0,
|
1194 |
-
'
|
|
|
1195 |
),
|
1196 |
array(
|
1197 |
'key' => 'field_acfe_form_post_map_post_type_message',
|
@@ -1243,13 +1489,14 @@ acf_add_local_field_group(array(
|
|
1243 |
'allow_null' => 1,
|
1244 |
'placeholder' => 'Default',
|
1245 |
'multiple' => 0,
|
1246 |
-
'ui' =>
|
1247 |
'choices' => array(
|
1248 |
),
|
1249 |
'ajax' => 0,
|
1250 |
'layout' => '',
|
1251 |
'toggle' => 0,
|
1252 |
-
'
|
|
|
1253 |
),
|
1254 |
array(
|
1255 |
'key' => 'field_acfe_form_post_map_post_status_message',
|
@@ -1273,18 +1520,55 @@ acf_add_local_field_group(array(
|
|
1273 |
),
|
1274 |
'acfe_permissions' => '',
|
1275 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1276 |
array(
|
1277 |
-
'key' => '
|
1278 |
'label' => 'Post title',
|
1279 |
-
'name' => '
|
1280 |
-
'type' => '
|
1281 |
'instructions' => '',
|
1282 |
'required' => 0,
|
1283 |
'conditional_logic' => array(
|
1284 |
array(
|
1285 |
array(
|
1286 |
'field' => 'field_acfe_form_post_map_post_title',
|
1287 |
-
'operator' => '
|
1288 |
),
|
1289 |
),
|
1290 |
),
|
@@ -1294,78 +1578,54 @@ acf_add_local_field_group(array(
|
|
1294 |
'id' => '',
|
1295 |
),
|
1296 |
'acfe_permissions' => '',
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
'placeholder' => 'Default',
|
1326 |
-
'ajax' => 0,
|
1327 |
-
),
|
1328 |
array(
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
'type' => 'text',
|
1333 |
-
'instructions' => '',
|
1334 |
-
'required' => 1,
|
1335 |
-
'conditional_logic' => array(
|
1336 |
-
array(
|
1337 |
-
array(
|
1338 |
-
'field' => 'field_acfe_form_post_save_post_title',
|
1339 |
-
'operator' => '==',
|
1340 |
-
'value' => 'custom',
|
1341 |
-
),
|
1342 |
-
),
|
1343 |
-
),
|
1344 |
-
'wrapper' => array(
|
1345 |
-
'width' => '',
|
1346 |
-
'class' => '',
|
1347 |
-
'id' => '',
|
1348 |
),
|
1349 |
-
'acfe_permissions' => '',
|
1350 |
-
'default_value' => '',
|
1351 |
-
'placeholder' => 'Available tag: {field:name} *',
|
1352 |
-
'prepend' => '',
|
1353 |
-
'append' => '',
|
1354 |
-
'maxlength' => '',
|
1355 |
),
|
1356 |
),
|
1357 |
-
|
|
|
1358 |
array(
|
1359 |
-
'key' => '
|
1360 |
-
'label' => 'Post
|
1361 |
-
'name' => '
|
1362 |
'type' => 'acfe_dynamic_message',
|
1363 |
'instructions' => '',
|
1364 |
'required' => 0,
|
1365 |
'conditional_logic' => array(
|
1366 |
array(
|
1367 |
array(
|
1368 |
-
'field' => '
|
1369 |
'operator' => '!=empty',
|
1370 |
),
|
1371 |
),
|
@@ -1378,16 +1638,16 @@ acf_add_local_field_group(array(
|
|
1378 |
'acfe_permissions' => '',
|
1379 |
),
|
1380 |
array(
|
1381 |
-
'key' => '
|
1382 |
-
'label' => 'Post
|
1383 |
-
'name' => '
|
1384 |
'type' => 'group',
|
1385 |
'instructions' => '',
|
1386 |
'required' => 0,
|
1387 |
'conditional_logic' => array(
|
1388 |
array(
|
1389 |
array(
|
1390 |
-
'field' => '
|
1391 |
'operator' => '==empty',
|
1392 |
),
|
1393 |
),
|
@@ -1403,9 +1663,9 @@ acf_add_local_field_group(array(
|
|
1403 |
'acfe_group_modal' => 0,
|
1404 |
'sub_fields' => array(
|
1405 |
array(
|
1406 |
-
'key' => '
|
1407 |
'label' => '',
|
1408 |
-
'name' => '
|
1409 |
'type' => 'select',
|
1410 |
'instructions' => '',
|
1411 |
'required' => 0,
|
@@ -1417,29 +1677,30 @@ acf_add_local_field_group(array(
|
|
1417 |
),
|
1418 |
'acfe_permissions' => '',
|
1419 |
'choices' => array(
|
1420 |
-
'
|
1421 |
-
'custom' => 'Custom slug',
|
1422 |
),
|
1423 |
'default_value' => array(
|
1424 |
),
|
1425 |
'allow_null' => 1,
|
1426 |
'multiple' => 0,
|
1427 |
-
'ui' =>
|
1428 |
'return_format' => 'value',
|
1429 |
'placeholder' => 'Default',
|
1430 |
'ajax' => 0,
|
|
|
|
|
1431 |
),
|
1432 |
array(
|
1433 |
-
'key' => '
|
1434 |
'label' => '',
|
1435 |
-
'name' => '
|
1436 |
-
'type' => '
|
1437 |
'instructions' => '',
|
1438 |
-
'required' =>
|
1439 |
'conditional_logic' => array(
|
1440 |
array(
|
1441 |
array(
|
1442 |
-
'field' => '
|
1443 |
'operator' => '==',
|
1444 |
'value' => 'custom',
|
1445 |
),
|
@@ -1452,113 +1713,10 @@ acf_add_local_field_group(array(
|
|
1452 |
),
|
1453 |
'acfe_permissions' => '',
|
1454 |
'default_value' => '',
|
1455 |
-
'
|
1456 |
-
'
|
1457 |
-
'
|
1458 |
-
'
|
1459 |
-
),
|
1460 |
-
),
|
1461 |
-
),
|
1462 |
-
array(
|
1463 |
-
'key' => 'field_acfe_form_post_map_post_name_message',
|
1464 |
-
'label' => 'Post slug',
|
1465 |
-
'name' => 'acfe_form_post_map_post_name_message',
|
1466 |
-
'type' => 'acfe_dynamic_message',
|
1467 |
-
'instructions' => '',
|
1468 |
-
'required' => 0,
|
1469 |
-
'conditional_logic' => array(
|
1470 |
-
array(
|
1471 |
-
array(
|
1472 |
-
'field' => 'field_acfe_form_post_map_post_name',
|
1473 |
-
'operator' => '!=empty',
|
1474 |
-
),
|
1475 |
-
),
|
1476 |
-
),
|
1477 |
-
'wrapper' => array(
|
1478 |
-
'width' => '',
|
1479 |
-
'class' => '',
|
1480 |
-
'id' => '',
|
1481 |
-
),
|
1482 |
-
'acfe_permissions' => '',
|
1483 |
-
),
|
1484 |
-
array(
|
1485 |
-
'key' => 'field_acfe_form_post_save_post_content_group',
|
1486 |
-
'label' => 'Post content',
|
1487 |
-
'name' => 'acfe_form_post_save_post_content_group',
|
1488 |
-
'type' => 'group',
|
1489 |
-
'instructions' => '',
|
1490 |
-
'required' => 0,
|
1491 |
-
'conditional_logic' => array(
|
1492 |
-
array(
|
1493 |
-
array(
|
1494 |
-
'field' => 'field_acfe_form_post_map_post_content',
|
1495 |
-
'operator' => '==empty',
|
1496 |
-
),
|
1497 |
-
),
|
1498 |
-
),
|
1499 |
-
'wrapper' => array(
|
1500 |
-
'width' => '',
|
1501 |
-
'class' => '',
|
1502 |
-
'id' => '',
|
1503 |
-
),
|
1504 |
-
'acfe_permissions' => '',
|
1505 |
-
'layout' => 'block',
|
1506 |
-
'acfe_seamless_style' => true,
|
1507 |
-
'acfe_group_modal' => 0,
|
1508 |
-
'sub_fields' => array(
|
1509 |
-
array(
|
1510 |
-
'key' => 'field_acfe_form_post_save_post_content',
|
1511 |
-
'label' => '',
|
1512 |
-
'name' => 'acfe_form_post_save_post_content',
|
1513 |
-
'type' => 'select',
|
1514 |
-
'instructions' => '',
|
1515 |
-
'required' => 0,
|
1516 |
-
'conditional_logic' => 0,
|
1517 |
-
'wrapper' => array(
|
1518 |
-
'width' => '',
|
1519 |
-
'class' => '',
|
1520 |
-
'id' => '',
|
1521 |
-
),
|
1522 |
-
'acfe_permissions' => '',
|
1523 |
-
'choices' => array(
|
1524 |
-
'custom' => 'Custom content',
|
1525 |
-
),
|
1526 |
-
'default_value' => array(
|
1527 |
-
),
|
1528 |
-
'allow_null' => 1,
|
1529 |
-
'multiple' => 0,
|
1530 |
-
'ui' => 0,
|
1531 |
-
'return_format' => 'value',
|
1532 |
-
'placeholder' => 'Default',
|
1533 |
-
'ajax' => 0,
|
1534 |
-
),
|
1535 |
-
array(
|
1536 |
-
'key' => 'field_acfe_form_post_save_post_content_custom',
|
1537 |
-
'label' => '',
|
1538 |
-
'name' => 'acfe_form_post_save_post_content_custom',
|
1539 |
-
'type' => 'wysiwyg',
|
1540 |
-
'instructions' => '',
|
1541 |
-
'required' => 0,
|
1542 |
-
'conditional_logic' => array(
|
1543 |
-
array(
|
1544 |
-
array(
|
1545 |
-
'field' => 'field_acfe_form_post_save_post_content',
|
1546 |
-
'operator' => '==',
|
1547 |
-
'value' => 'custom',
|
1548 |
-
),
|
1549 |
-
),
|
1550 |
-
),
|
1551 |
-
'wrapper' => array(
|
1552 |
-
'width' => '',
|
1553 |
-
'class' => '',
|
1554 |
-
'id' => '',
|
1555 |
-
),
|
1556 |
-
'acfe_permissions' => '',
|
1557 |
-
'default_value' => '',
|
1558 |
-
'tabs' => 'all',
|
1559 |
-
'toolbar' => 'full',
|
1560 |
-
'media_upload' => 1,
|
1561 |
-
'delay' => 0,
|
1562 |
),
|
1563 |
),
|
1564 |
),
|
@@ -1612,9 +1770,11 @@ acf_add_local_field_group(array(
|
|
1612 |
'allow_null' => 1,
|
1613 |
'multiple' => 0,
|
1614 |
'ui' => 1,
|
1615 |
-
'ajax' =>
|
1616 |
'return_format' => 'value',
|
1617 |
'placeholder' => 'Default',
|
|
|
|
|
1618 |
),
|
1619 |
array(
|
1620 |
'key' => 'field_acfe_form_post_map_post_author_message',
|
@@ -1666,9 +1826,11 @@ acf_add_local_field_group(array(
|
|
1666 |
'allow_null' => 1,
|
1667 |
'multiple' => 0,
|
1668 |
'ui' => 1,
|
1669 |
-
'ajax' =>
|
1670 |
'return_format' => 'value',
|
1671 |
-
'placeholder' => '
|
|
|
|
|
1672 |
),
|
1673 |
array(
|
1674 |
'key' => 'field_acfe_form_post_map_post_parent_message',
|
@@ -1716,9 +1878,9 @@ acf_add_local_field_group(array(
|
|
1716 |
'taxonomy' => '',
|
1717 |
'field_type' => 'select',
|
1718 |
'default_value' => '',
|
1719 |
-
'return_format' => '
|
1720 |
'allow_null' => 1,
|
1721 |
-
'placeholder' => '
|
1722 |
'multiple' => 1,
|
1723 |
'ui' => 1,
|
1724 |
'ajax' => 0,
|
@@ -1726,7 +1888,8 @@ acf_add_local_field_group(array(
|
|
1726 |
),
|
1727 |
'layout' => '',
|
1728 |
'toggle' => 0,
|
1729 |
-
'
|
|
|
1730 |
),
|
1731 |
array(
|
1732 |
'key' => 'field_acfe_form_post_map_post_terms_message',
|
@@ -1752,7 +1915,7 @@ acf_add_local_field_group(array(
|
|
1752 |
),
|
1753 |
array(
|
1754 |
'key' => 'field_acfe_form_post_save_meta',
|
1755 |
-
'label' => 'Save
|
1756 |
'name' => 'acfe_form_post_save_meta',
|
1757 |
'type' => 'checkbox',
|
1758 |
'instructions' => 'Choose which ACF fields should be saved to this post',
|
@@ -1774,6 +1937,10 @@ acf_add_local_field_group(array(
|
|
1774 |
'return_format' => 'value',
|
1775 |
'save_custom' => 0,
|
1776 |
),
|
|
|
|
|
|
|
|
|
1777 |
array(
|
1778 |
'key' => 'acfe_form_post_tab_load',
|
1779 |
'label' => 'Load',
|
@@ -1813,10 +1980,10 @@ acf_add_local_field_group(array(
|
|
1813 |
),
|
1814 |
array(
|
1815 |
'key' => 'field_acfe_form_post_load_source',
|
1816 |
-
'label' => '
|
1817 |
'name' => 'acfe_form_post_load_source',
|
1818 |
'type' => 'select',
|
1819 |
-
'instructions' => '
|
1820 |
'required' => 0,
|
1821 |
'conditional_logic' => array(
|
1822 |
array(
|
@@ -1835,65 +2002,17 @@ acf_add_local_field_group(array(
|
|
1835 |
'acfe_permissions' => '',
|
1836 |
'choices' => array(
|
1837 |
),
|
1838 |
-
'default_value' =>
|
1839 |
-
0 => 'current_post',
|
1840 |
-
),
|
1841 |
'allow_null' => 0,
|
1842 |
'multiple' => 0,
|
1843 |
'ui' => 1,
|
1844 |
-
'ajax' =>
|
1845 |
'return_format' => 'value',
|
1846 |
'placeholder' => '',
|
|
|
|
|
1847 |
),
|
1848 |
-
|
1849 |
-
'key' => 'field_acfe_form_post_load_meta',
|
1850 |
-
'label' => 'Fields Values',
|
1851 |
-
'name' => 'acfe_form_post_load_meta',
|
1852 |
-
'type' => 'checkbox',
|
1853 |
-
'instructions' => 'Choose which ACF fields should have values filled',
|
1854 |
-
'required' => 0,
|
1855 |
-
'conditional_logic' => array(
|
1856 |
-
array(
|
1857 |
-
array(
|
1858 |
-
'field' => 'field_acfe_form_post_load_values',
|
1859 |
-
'operator' => '==',
|
1860 |
-
'value' => '1',
|
1861 |
-
),
|
1862 |
-
),
|
1863 |
-
),
|
1864 |
-
'wrapper' => array(
|
1865 |
-
'width' => '',
|
1866 |
-
'class' => '',
|
1867 |
-
'id' => '',
|
1868 |
-
),
|
1869 |
-
'acfe_permissions' => '',
|
1870 |
-
'choices' => array(
|
1871 |
-
),
|
1872 |
-
'allow_custom' => 0,
|
1873 |
-
'default_value' => array(
|
1874 |
-
),
|
1875 |
-
'layout' => 'vertical',
|
1876 |
-
'toggle' => 1,
|
1877 |
-
'return_format' => 'value',
|
1878 |
-
'save_custom' => 0,
|
1879 |
-
),
|
1880 |
-
array(
|
1881 |
-
'key' => 'acfe_form_post_tab_mapping',
|
1882 |
-
'label' => 'Mapping',
|
1883 |
-
'name' => '',
|
1884 |
-
'type' => 'tab',
|
1885 |
-
'instructions' => '',
|
1886 |
-
'required' => 0,
|
1887 |
-
'conditional_logic' => 0,
|
1888 |
-
'wrapper' => array(
|
1889 |
-
'width' => '',
|
1890 |
-
'class' => '',
|
1891 |
-
'id' => '',
|
1892 |
-
),
|
1893 |
-
'acfe_permissions' => '',
|
1894 |
-
'placement' => 'top',
|
1895 |
-
'endpoint' => 0,
|
1896 |
-
),
|
1897 |
array(
|
1898 |
'key' => 'field_acfe_form_post_map_post_type',
|
1899 |
'label' => 'Post type',
|
@@ -1901,7 +2020,6 @@ acf_add_local_field_group(array(
|
|
1901 |
'type' => 'select',
|
1902 |
'instructions' => '',
|
1903 |
'required' => 0,
|
1904 |
-
'conditional_logic' => 0,
|
1905 |
'wrapper' => array(
|
1906 |
'width' => '',
|
1907 |
'class' => '',
|
@@ -1914,10 +2032,21 @@ acf_add_local_field_group(array(
|
|
1914 |
),
|
1915 |
'allow_null' => 1,
|
1916 |
'multiple' => 0,
|
1917 |
-
'ui' =>
|
1918 |
'return_format' => 'value',
|
1919 |
'placeholder' => 'Default',
|
1920 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1921 |
),
|
1922 |
array(
|
1923 |
'key' => 'field_acfe_form_post_map_post_status',
|
@@ -1926,7 +2055,6 @@ acf_add_local_field_group(array(
|
|
1926 |
'type' => 'select',
|
1927 |
'instructions' => '',
|
1928 |
'required' => 0,
|
1929 |
-
'conditional_logic' => 0,
|
1930 |
'wrapper' => array(
|
1931 |
'width' => '',
|
1932 |
'class' => '',
|
@@ -1939,10 +2067,21 @@ acf_add_local_field_group(array(
|
|
1939 |
),
|
1940 |
'allow_null' => 1,
|
1941 |
'multiple' => 0,
|
1942 |
-
'ui' =>
|
1943 |
'return_format' => 'value',
|
1944 |
'placeholder' => 'Default',
|
1945 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1946 |
),
|
1947 |
array(
|
1948 |
'key' => 'field_acfe_form_post_map_post_title',
|
@@ -1951,7 +2090,6 @@ acf_add_local_field_group(array(
|
|
1951 |
'type' => 'select',
|
1952 |
'instructions' => '',
|
1953 |
'required' => 0,
|
1954 |
-
'conditional_logic' => 0,
|
1955 |
'wrapper' => array(
|
1956 |
'width' => '',
|
1957 |
'class' => '',
|
@@ -1964,10 +2102,21 @@ acf_add_local_field_group(array(
|
|
1964 |
),
|
1965 |
'allow_null' => 1,
|
1966 |
'multiple' => 0,
|
1967 |
-
'ui' =>
|
1968 |
'return_format' => 'value',
|
1969 |
'placeholder' => 'Default',
|
1970 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1971 |
),
|
1972 |
array(
|
1973 |
'key' => 'field_acfe_form_post_map_post_name',
|
@@ -1976,7 +2125,6 @@ acf_add_local_field_group(array(
|
|
1976 |
'type' => 'select',
|
1977 |
'instructions' => '',
|
1978 |
'required' => 0,
|
1979 |
-
'conditional_logic' => 0,
|
1980 |
'wrapper' => array(
|
1981 |
'width' => '',
|
1982 |
'class' => '',
|
@@ -1989,10 +2137,21 @@ acf_add_local_field_group(array(
|
|
1989 |
),
|
1990 |
'allow_null' => 1,
|
1991 |
'multiple' => 0,
|
1992 |
-
'ui' =>
|
1993 |
'return_format' => 'value',
|
1994 |
'placeholder' => 'Default',
|
1995 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1996 |
),
|
1997 |
array(
|
1998 |
'key' => 'field_acfe_form_post_map_post_content',
|
@@ -2001,7 +2160,6 @@ acf_add_local_field_group(array(
|
|
2001 |
'type' => 'select',
|
2002 |
'instructions' => '',
|
2003 |
'required' => 0,
|
2004 |
-
'conditional_logic' => 0,
|
2005 |
'wrapper' => array(
|
2006 |
'width' => '',
|
2007 |
'class' => '',
|
@@ -2014,10 +2172,21 @@ acf_add_local_field_group(array(
|
|
2014 |
),
|
2015 |
'allow_null' => 1,
|
2016 |
'multiple' => 0,
|
2017 |
-
'ui' =>
|
2018 |
'return_format' => 'value',
|
2019 |
'placeholder' => 'Default',
|
2020 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021 |
),
|
2022 |
array(
|
2023 |
'key' => 'field_acfe_form_post_map_post_author',
|
@@ -2026,7 +2195,6 @@ acf_add_local_field_group(array(
|
|
2026 |
'type' => 'select',
|
2027 |
'instructions' => '',
|
2028 |
'required' => 0,
|
2029 |
-
'conditional_logic' => 0,
|
2030 |
'wrapper' => array(
|
2031 |
'width' => '',
|
2032 |
'class' => '',
|
@@ -2039,10 +2207,21 @@ acf_add_local_field_group(array(
|
|
2039 |
),
|
2040 |
'allow_null' => 1,
|
2041 |
'multiple' => 0,
|
2042 |
-
'ui' =>
|
2043 |
'return_format' => 'value',
|
2044 |
'placeholder' => 'Default',
|
2045 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2046 |
),
|
2047 |
array(
|
2048 |
'key' => 'field_acfe_form_post_map_post_parent',
|
@@ -2051,7 +2230,6 @@ acf_add_local_field_group(array(
|
|
2051 |
'type' => 'select',
|
2052 |
'instructions' => '',
|
2053 |
'required' => 0,
|
2054 |
-
'conditional_logic' => 0,
|
2055 |
'wrapper' => array(
|
2056 |
'width' => '',
|
2057 |
'class' => '',
|
@@ -2064,10 +2242,21 @@ acf_add_local_field_group(array(
|
|
2064 |
),
|
2065 |
'allow_null' => 1,
|
2066 |
'multiple' => 0,
|
2067 |
-
'ui' =>
|
2068 |
'return_format' => 'value',
|
2069 |
'placeholder' => 'Default',
|
2070 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2071 |
),
|
2072 |
array(
|
2073 |
'key' => 'field_acfe_form_post_map_post_terms',
|
@@ -2076,7 +2265,6 @@ acf_add_local_field_group(array(
|
|
2076 |
'type' => 'select',
|
2077 |
'instructions' => '',
|
2078 |
'required' => 0,
|
2079 |
-
'conditional_logic' => 0,
|
2080 |
'wrapper' => array(
|
2081 |
'width' => '',
|
2082 |
'class' => '',
|
@@ -2089,22 +2277,69 @@ acf_add_local_field_group(array(
|
|
2089 |
),
|
2090 |
'allow_null' => 1,
|
2091 |
'multiple' => 0,
|
2092 |
-
'ui' =>
|
2093 |
'return_format' => 'value',
|
2094 |
'placeholder' => 'Default',
|
2095 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2096 |
),
|
2097 |
-
|
2098 |
-
'key' => '
|
2099 |
-
'label' => '
|
2100 |
-
'name' => '',
|
2101 |
-
'type' => '
|
2102 |
-
'instructions' => '',
|
2103 |
'required' => 0,
|
2104 |
-
'conditional_logic' =>
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2108 |
'id' => '',
|
2109 |
),
|
2110 |
'acfe_permissions' => '',
|
@@ -2117,7 +2352,7 @@ acf_add_local_field_group(array(
|
|
2117 |
'name' => 'acfe_form_post_advanced_load',
|
2118 |
'type' => 'acfe_dynamic_message',
|
2119 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
2120 |
-
'instructions' => '
|
2121 |
'required' => 0,
|
2122 |
'conditional_logic' => 0,
|
2123 |
'wrapper' => array(
|
@@ -2133,7 +2368,7 @@ acf_add_local_field_group(array(
|
|
2133 |
'name' => 'acfe_form_post_advanced_save_args',
|
2134 |
'type' => 'acfe_dynamic_message',
|
2135 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
2136 |
-
'instructions' => '
|
2137 |
'required' => 0,
|
2138 |
'conditional_logic' => 0,
|
2139 |
'wrapper' => array(
|
@@ -2173,9 +2408,13 @@ acf_add_local_field_group(array(
|
|
2173 |
'label' => 'Term action',
|
2174 |
'display' => 'row',
|
2175 |
'sub_fields' => array(
|
|
|
|
|
|
|
|
|
2176 |
array(
|
2177 |
-
'key' => '
|
2178 |
-
'label' => '
|
2179 |
'name' => '',
|
2180 |
'type' => 'tab',
|
2181 |
'instructions' => '',
|
@@ -2235,14 +2474,13 @@ acf_add_local_field_group(array(
|
|
2235 |
'append' => '',
|
2236 |
'maxlength' => '',
|
2237 |
),
|
2238 |
-
|
2239 |
'key' => 'field_acfe_form_term_custom_query_var',
|
2240 |
'label' => 'Query var',
|
2241 |
'name' => 'acfe_form_custom_query_var',
|
2242 |
'type' => 'true_false',
|
2243 |
'instructions' => 'Automatically create a query var with the data of the term that has been created/updated.<br />Retrieve data using <code>{query_var:my-action:name}</code> <code>{query_var:my-action:permalink}</code> template tags.',
|
2244 |
'required' => 0,
|
2245 |
-
'conditional_logic' => 0,
|
2246 |
'wrapper' => array(
|
2247 |
'width' => '',
|
2248 |
'class' => '',
|
@@ -2254,7 +2492,7 @@ acf_add_local_field_group(array(
|
|
2254 |
'ui' => 1,
|
2255 |
'ui_on_text' => '',
|
2256 |
'ui_off_text' => '',
|
2257 |
-
|
2258 |
array(
|
2259 |
array(
|
2260 |
'field' => 'field_acfe_form_term_custom_alias',
|
@@ -2263,12 +2501,33 @@ acf_add_local_field_group(array(
|
|
2263 |
),
|
2264 |
),
|
2265 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2266 |
array(
|
2267 |
'key' => 'field_acfe_form_term_save_target',
|
2268 |
'label' => 'Target',
|
2269 |
'name' => 'acfe_form_term_save_target',
|
2270 |
'type' => 'select',
|
2271 |
-
'instructions' => '
|
2272 |
'required' => 0,
|
2273 |
'conditional_logic' => array(
|
2274 |
array(
|
@@ -2287,24 +2546,41 @@ acf_add_local_field_group(array(
|
|
2287 |
'acfe_permissions' => '',
|
2288 |
'choices' => array(
|
2289 |
),
|
2290 |
-
'default_value' =>
|
2291 |
-
0 => 'current_term',
|
2292 |
-
),
|
2293 |
'allow_null' => 0,
|
2294 |
'multiple' => 0,
|
2295 |
'ui' => 1,
|
2296 |
-
'ajax' =>
|
2297 |
'return_format' => 'value',
|
2298 |
'placeholder' => '',
|
|
|
|
|
2299 |
),
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2308 |
array(
|
2309 |
array(
|
2310 |
'field' => 'field_acfe_form_term_map_name',
|
@@ -2312,72 +2588,7 @@ acf_add_local_field_group(array(
|
|
2312 |
),
|
2313 |
),
|
2314 |
),
|
2315 |
-
|
2316 |
-
'width' => '',
|
2317 |
-
'class' => '',
|
2318 |
-
'id' => '',
|
2319 |
-
),
|
2320 |
-
'acfe_permissions' => '',
|
2321 |
-
'layout' => 'block',
|
2322 |
-
'acfe_seamless_style' => true,
|
2323 |
-
'acfe_group_modal' => 0,
|
2324 |
-
'sub_fields' => array(
|
2325 |
-
array(
|
2326 |
-
'key' => 'field_acfe_form_term_save_name',
|
2327 |
-
'label' => '',
|
2328 |
-
'name' => 'acfe_form_term_save_name',
|
2329 |
-
'type' => 'select',
|
2330 |
-
'instructions' => '',
|
2331 |
-
'required' => 0,
|
2332 |
-
'conditional_logic' => 0,
|
2333 |
-
'wrapper' => array(
|
2334 |
-
'width' => '',
|
2335 |
-
'class' => '',
|
2336 |
-
'id' => '',
|
2337 |
-
),
|
2338 |
-
'acfe_permissions' => '',
|
2339 |
-
'choices' => array(
|
2340 |
-
'custom' => 'Custom name',
|
2341 |
-
),
|
2342 |
-
'default_value' => array(
|
2343 |
-
),
|
2344 |
-
'allow_null' => 1,
|
2345 |
-
'multiple' => 0,
|
2346 |
-
'ui' => 0,
|
2347 |
-
'return_format' => 'value',
|
2348 |
-
'placeholder' => 'Default',
|
2349 |
-
'ajax' => 0,
|
2350 |
-
),
|
2351 |
-
array(
|
2352 |
-
'key' => 'field_acfe_form_term_save_name_custom',
|
2353 |
-
'label' => '',
|
2354 |
-
'name' => 'acfe_form_term_save_name_custom',
|
2355 |
-
'type' => 'text',
|
2356 |
-
'instructions' => '',
|
2357 |
-
'required' => 1,
|
2358 |
-
'conditional_logic' => array(
|
2359 |
-
array(
|
2360 |
-
array(
|
2361 |
-
'field' => 'field_acfe_form_term_save_name',
|
2362 |
-
'operator' => '==',
|
2363 |
-
'value' => 'custom',
|
2364 |
-
),
|
2365 |
-
),
|
2366 |
-
),
|
2367 |
-
'wrapper' => array(
|
2368 |
-
'width' => '',
|
2369 |
-
'class' => '',
|
2370 |
-
'id' => '',
|
2371 |
-
),
|
2372 |
-
'acfe_permissions' => '',
|
2373 |
-
'default_value' => '',
|
2374 |
-
'placeholder' => 'Available tag: {field:name} *',
|
2375 |
-
'prepend' => '',
|
2376 |
-
'append' => '',
|
2377 |
-
'maxlength' => '',
|
2378 |
-
),
|
2379 |
-
),
|
2380 |
-
),
|
2381 |
array(
|
2382 |
'key' => 'field_acfe_form_term_map_name_message',
|
2383 |
'label' => 'Name',
|
@@ -2400,14 +2611,31 @@ acf_add_local_field_group(array(
|
|
2400 |
),
|
2401 |
'acfe_permissions' => '',
|
2402 |
),
|
2403 |
-
|
2404 |
-
|
2405 |
-
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
|
2410 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2411 |
array(
|
2412 |
array(
|
2413 |
'field' => 'field_acfe_form_term_map_slug',
|
@@ -2415,72 +2643,7 @@ acf_add_local_field_group(array(
|
|
2415 |
),
|
2416 |
),
|
2417 |
),
|
2418 |
-
|
2419 |
-
'width' => '',
|
2420 |
-
'class' => '',
|
2421 |
-
'id' => '',
|
2422 |
-
),
|
2423 |
-
'acfe_permissions' => '',
|
2424 |
-
'layout' => 'block',
|
2425 |
-
'acfe_seamless_style' => true,
|
2426 |
-
'acfe_group_modal' => 0,
|
2427 |
-
'sub_fields' => array(
|
2428 |
-
array(
|
2429 |
-
'key' => 'field_acfe_form_term_save_slug',
|
2430 |
-
'label' => '',
|
2431 |
-
'name' => 'acfe_form_term_save_slug',
|
2432 |
-
'type' => 'select',
|
2433 |
-
'instructions' => '',
|
2434 |
-
'required' => 0,
|
2435 |
-
'conditional_logic' => 0,
|
2436 |
-
'wrapper' => array(
|
2437 |
-
'width' => '',
|
2438 |
-
'class' => '',
|
2439 |
-
'id' => '',
|
2440 |
-
),
|
2441 |
-
'acfe_permissions' => '',
|
2442 |
-
'choices' => array(
|
2443 |
-
'custom' => 'Custom slug',
|
2444 |
-
),
|
2445 |
-
'default_value' => array(
|
2446 |
-
),
|
2447 |
-
'allow_null' => 1,
|
2448 |
-
'multiple' => 0,
|
2449 |
-
'ui' => 0,
|
2450 |
-
'return_format' => 'value',
|
2451 |
-
'placeholder' => 'Default',
|
2452 |
-
'ajax' => 0,
|
2453 |
-
),
|
2454 |
-
array(
|
2455 |
-
'key' => 'field_acfe_form_term_save_slug_custom',
|
2456 |
-
'label' => '',
|
2457 |
-
'name' => 'acfe_form_term_save_slug_custom',
|
2458 |
-
'type' => 'text',
|
2459 |
-
'instructions' => '',
|
2460 |
-
'required' => 1,
|
2461 |
-
'conditional_logic' => array(
|
2462 |
-
array(
|
2463 |
-
array(
|
2464 |
-
'field' => 'field_acfe_form_term_save_slug',
|
2465 |
-
'operator' => '==',
|
2466 |
-
'value' => 'custom',
|
2467 |
-
),
|
2468 |
-
),
|
2469 |
-
),
|
2470 |
-
'wrapper' => array(
|
2471 |
-
'width' => '',
|
2472 |
-
'class' => '',
|
2473 |
-
'id' => '',
|
2474 |
-
),
|
2475 |
-
'acfe_permissions' => '',
|
2476 |
-
'default_value' => '',
|
2477 |
-
'placeholder' => 'Available tag: {field:name} *',
|
2478 |
-
'prepend' => '',
|
2479 |
-
'append' => '',
|
2480 |
-
'maxlength' => '',
|
2481 |
-
),
|
2482 |
-
),
|
2483 |
-
),
|
2484 |
array(
|
2485 |
'key' => 'field_acfe_form_term_map_slug_message',
|
2486 |
'label' => 'Slug',
|
@@ -2531,13 +2694,14 @@ acf_add_local_field_group(array(
|
|
2531 |
'allow_null' => 1,
|
2532 |
'placeholder' => 'Default',
|
2533 |
'multiple' => 0,
|
2534 |
-
'ui' =>
|
2535 |
'choices' => array(
|
2536 |
),
|
2537 |
'ajax' => 0,
|
2538 |
'layout' => '',
|
2539 |
'toggle' => 0,
|
2540 |
-
'
|
|
|
2541 |
),
|
2542 |
array(
|
2543 |
'key' => 'field_acfe_form_term_map_taxonomy_message',
|
@@ -2589,9 +2753,11 @@ acf_add_local_field_group(array(
|
|
2589 |
'allow_null' => 1,
|
2590 |
'multiple' => 0,
|
2591 |
'ui' => 1,
|
2592 |
-
'ajax' =>
|
2593 |
'return_format' => 'value',
|
2594 |
'placeholder' => 'Default',
|
|
|
|
|
2595 |
),
|
2596 |
array(
|
2597 |
'key' => 'field_acfe_form_term_map_parent_message',
|
@@ -2655,16 +2821,18 @@ acf_add_local_field_group(array(
|
|
2655 |
),
|
2656 |
'acfe_permissions' => '',
|
2657 |
'choices' => array(
|
2658 |
-
'custom' => '
|
2659 |
),
|
2660 |
'default_value' => array(
|
2661 |
),
|
2662 |
'allow_null' => 1,
|
2663 |
'multiple' => 0,
|
2664 |
-
'ui' =>
|
2665 |
'return_format' => 'value',
|
2666 |
'placeholder' => 'Default',
|
2667 |
'ajax' => 0,
|
|
|
|
|
2668 |
),
|
2669 |
array(
|
2670 |
'key' => 'field_acfe_form_term_save_description_custom',
|
@@ -2720,7 +2888,7 @@ acf_add_local_field_group(array(
|
|
2720 |
),
|
2721 |
array(
|
2722 |
'key' => 'field_acfe_form_term_save_meta',
|
2723 |
-
'label' => 'Save
|
2724 |
'name' => 'acfe_form_term_save_meta',
|
2725 |
'type' => 'checkbox',
|
2726 |
'instructions' => 'Choose which ACF fields should be saved to this term',
|
@@ -2742,6 +2910,10 @@ acf_add_local_field_group(array(
|
|
2742 |
'return_format' => 'value',
|
2743 |
'save_custom' => 0,
|
2744 |
),
|
|
|
|
|
|
|
|
|
2745 |
array(
|
2746 |
'key' => 'field_acfe_form_term_tab_load',
|
2747 |
'label' => 'Load',
|
@@ -2781,10 +2953,10 @@ acf_add_local_field_group(array(
|
|
2781 |
),
|
2782 |
array(
|
2783 |
'key' => 'field_acfe_form_term_load_source',
|
2784 |
-
'label' => '
|
2785 |
'name' => 'acfe_form_term_load_source',
|
2786 |
'type' => 'select',
|
2787 |
-
'instructions' => '
|
2788 |
'required' => 0,
|
2789 |
'conditional_logic' => array(
|
2790 |
array(
|
@@ -2803,23 +2975,41 @@ acf_add_local_field_group(array(
|
|
2803 |
'acfe_permissions' => '',
|
2804 |
'choices' => array(
|
2805 |
),
|
2806 |
-
'default_value' =>
|
2807 |
-
0 => 'current_term',
|
2808 |
-
),
|
2809 |
'allow_null' => 0,
|
2810 |
'multiple' => 0,
|
2811 |
'ui' => 1,
|
2812 |
-
'ajax' =>
|
2813 |
'return_format' => 'value',
|
2814 |
'placeholder' => '',
|
|
|
|
|
2815 |
),
|
2816 |
array(
|
2817 |
-
'key' => '
|
2818 |
-
'label' => '
|
2819 |
-
'name' => '
|
2820 |
-
'type' => '
|
2821 |
-
'instructions' => '
|
2822 |
'required' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2823 |
'conditional_logic' => array(
|
2824 |
array(
|
2825 |
array(
|
@@ -2829,47 +3019,14 @@ acf_add_local_field_group(array(
|
|
2829 |
),
|
2830 |
),
|
2831 |
),
|
2832 |
-
|
2833 |
-
|
2834 |
-
|
2835 |
-
|
2836 |
-
|
2837 |
-
'
|
2838 |
-
'
|
2839 |
-
|
2840 |
-
'allow_custom' => 0,
|
2841 |
-
'default_value' => array(
|
2842 |
-
),
|
2843 |
-
'layout' => 'vertical',
|
2844 |
-
'toggle' => 1,
|
2845 |
-
'return_format' => 'value',
|
2846 |
-
'save_custom' => 0,
|
2847 |
-
),
|
2848 |
-
array(
|
2849 |
-
'key' => 'field_acfe_form_term_tab_mapping',
|
2850 |
-
'label' => 'Mapping',
|
2851 |
-
'name' => '',
|
2852 |
-
'type' => 'tab',
|
2853 |
-
'instructions' => '',
|
2854 |
-
'required' => 0,
|
2855 |
-
'conditional_logic' => 0,
|
2856 |
-
'wrapper' => array(
|
2857 |
-
'width' => '',
|
2858 |
-
'class' => '',
|
2859 |
-
'id' => '',
|
2860 |
-
),
|
2861 |
-
'acfe_permissions' => '',
|
2862 |
-
'placement' => 'top',
|
2863 |
-
'endpoint' => 0,
|
2864 |
-
),
|
2865 |
-
array(
|
2866 |
-
'key' => 'field_acfe_form_term_map_name',
|
2867 |
-
'label' => 'Name',
|
2868 |
-
'name' => 'acfe_form_term_map_name',
|
2869 |
-
'type' => 'select',
|
2870 |
-
'instructions' => '',
|
2871 |
-
'required' => 0,
|
2872 |
-
'conditional_logic' => 0,
|
2873 |
'wrapper' => array(
|
2874 |
'width' => '',
|
2875 |
'class' => '',
|
@@ -2882,19 +3039,29 @@ acf_add_local_field_group(array(
|
|
2882 |
),
|
2883 |
'allow_null' => 1,
|
2884 |
'multiple' => 0,
|
2885 |
-
'ui' =>
|
2886 |
'return_format' => 'value',
|
2887 |
'placeholder' => 'Default',
|
2888 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2889 |
),
|
2890 |
array(
|
2891 |
-
'key' => '
|
2892 |
-
'label' => '
|
2893 |
-
'name' => '
|
2894 |
'type' => 'select',
|
2895 |
'instructions' => '',
|
2896 |
'required' => 0,
|
2897 |
-
'conditional_logic' => 0,
|
2898 |
'wrapper' => array(
|
2899 |
'width' => '',
|
2900 |
'class' => '',
|
@@ -2907,19 +3074,29 @@ acf_add_local_field_group(array(
|
|
2907 |
),
|
2908 |
'allow_null' => 1,
|
2909 |
'multiple' => 0,
|
2910 |
-
'ui' =>
|
2911 |
'return_format' => 'value',
|
2912 |
'placeholder' => 'Default',
|
2913 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2914 |
),
|
2915 |
array(
|
2916 |
-
'key' => '
|
2917 |
-
'label' => '
|
2918 |
-
'name' => '
|
2919 |
'type' => 'select',
|
2920 |
'instructions' => '',
|
2921 |
'required' => 0,
|
2922 |
-
'conditional_logic' => 0,
|
2923 |
'wrapper' => array(
|
2924 |
'width' => '',
|
2925 |
'class' => '',
|
@@ -2932,19 +3109,29 @@ acf_add_local_field_group(array(
|
|
2932 |
),
|
2933 |
'allow_null' => 1,
|
2934 |
'multiple' => 0,
|
2935 |
-
'ui' =>
|
2936 |
'return_format' => 'value',
|
2937 |
'placeholder' => 'Default',
|
2938 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2939 |
),
|
2940 |
array(
|
2941 |
-
'key' => '
|
2942 |
-
'label' => '
|
2943 |
-
'name' => '
|
2944 |
'type' => 'select',
|
2945 |
'instructions' => '',
|
2946 |
'required' => 0,
|
2947 |
-
'conditional_logic' => 0,
|
2948 |
'wrapper' => array(
|
2949 |
'width' => '',
|
2950 |
'class' => '',
|
@@ -2957,19 +3144,38 @@ acf_add_local_field_group(array(
|
|
2957 |
),
|
2958 |
'allow_null' => 1,
|
2959 |
'multiple' => 0,
|
2960 |
-
'ui' =>
|
2961 |
'return_format' => 'value',
|
2962 |
'placeholder' => 'Default',
|
2963 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2964 |
),
|
2965 |
array(
|
2966 |
-
'key' => '
|
2967 |
-
'label' => '
|
2968 |
-
'name' => '
|
2969 |
-
'type' => '
|
2970 |
-
'instructions' => '',
|
2971 |
'required' => 0,
|
2972 |
-
'conditional_logic' =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2973 |
'wrapper' => array(
|
2974 |
'width' => '',
|
2975 |
'class' => '',
|
@@ -2978,15 +3184,18 @@ acf_add_local_field_group(array(
|
|
2978 |
'acfe_permissions' => '',
|
2979 |
'choices' => array(
|
2980 |
),
|
|
|
2981 |
'default_value' => array(
|
2982 |
),
|
2983 |
-
'
|
2984 |
-
'
|
2985 |
-
'ui' => 0,
|
2986 |
'return_format' => 'value',
|
2987 |
-
'
|
2988 |
-
'ajax' => 0,
|
2989 |
),
|
|
|
|
|
|
|
|
|
2990 |
array(
|
2991 |
'key' => 'field_acfe_form_term_tab_advanced',
|
2992 |
'label' => 'Advanced',
|
@@ -3010,7 +3219,7 @@ acf_add_local_field_group(array(
|
|
3010 |
'name' => 'acfe_form_term_advanced_load',
|
3011 |
'type' => 'acfe_dynamic_message',
|
3012 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
3013 |
-
'instructions' => '
|
3014 |
'required' => 0,
|
3015 |
'conditional_logic' => 0,
|
3016 |
'wrapper' => array(
|
@@ -3026,7 +3235,7 @@ acf_add_local_field_group(array(
|
|
3026 |
'name' => 'acfe_form_term_advanced_save_args',
|
3027 |
'type' => 'acfe_dynamic_message',
|
3028 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
3029 |
-
'instructions' => '
|
3030 |
'required' => 0,
|
3031 |
'conditional_logic' => 0,
|
3032 |
'wrapper' => array(
|
@@ -3066,9 +3275,13 @@ acf_add_local_field_group(array(
|
|
3066 |
'label' => 'User action',
|
3067 |
'display' => 'row',
|
3068 |
'sub_fields' => array(
|
|
|
|
|
|
|
|
|
3069 |
array(
|
3070 |
-
'key' => '
|
3071 |
-
'label' => '
|
3072 |
'name' => '',
|
3073 |
'type' => 'tab',
|
3074 |
'instructions' => '',
|
@@ -3098,8 +3311,9 @@ acf_add_local_field_group(array(
|
|
3098 |
),
|
3099 |
'acfe_permissions' => '',
|
3100 |
'choices' => array(
|
3101 |
-
'insert_user'
|
3102 |
-
'update_user'
|
|
|
3103 |
),
|
3104 |
'allow_null' => 0,
|
3105 |
'other_choice' => 0,
|
@@ -3128,14 +3342,13 @@ acf_add_local_field_group(array(
|
|
3128 |
'append' => '',
|
3129 |
'maxlength' => '',
|
3130 |
),
|
3131 |
-
|
3132 |
'key' => 'field_acfe_form_user_custom_query_var',
|
3133 |
'label' => 'Query var',
|
3134 |
'name' => 'acfe_form_custom_query_var',
|
3135 |
'type' => 'true_false',
|
3136 |
'instructions' => 'Automatically create a query var with the data of the user that has been created/updated.<br />Retrieve data using <code>{query_var:my-action:display_name}</code> template tags.',
|
3137 |
'required' => 0,
|
3138 |
-
'conditional_logic' => 0,
|
3139 |
'wrapper' => array(
|
3140 |
'width' => '',
|
3141 |
'class' => '',
|
@@ -3147,7 +3360,7 @@ acf_add_local_field_group(array(
|
|
3147 |
'ui' => 1,
|
3148 |
'ui_on_text' => '',
|
3149 |
'ui_off_text' => '',
|
3150 |
-
|
3151 |
array(
|
3152 |
array(
|
3153 |
'field' => 'field_acfe_form_user_custom_alias',
|
@@ -3156,22 +3369,42 @@ acf_add_local_field_group(array(
|
|
3156 |
),
|
3157 |
),
|
3158 |
),
|
|
|
|
|
|
|
|
|
3159 |
array(
|
3160 |
-
'key' => '
|
3161 |
-
'label' => '
|
3162 |
-
'name' => '
|
3163 |
-
'type' => '
|
3164 |
-
'instructions' => '
|
3165 |
'required' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3166 |
'conditional_logic' => array(
|
3167 |
array(
|
3168 |
array(
|
3169 |
'field' => 'field_acfe_form_user_action',
|
3170 |
'operator' => '==',
|
3171 |
-
'value' => '
|
3172 |
),
|
3173 |
),
|
3174 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3175 |
'wrapper' => array(
|
3176 |
'width' => '',
|
3177 |
'class' => '',
|
@@ -3179,235 +3412,170 @@ acf_add_local_field_group(array(
|
|
3179 |
),
|
3180 |
'acfe_permissions' => '',
|
3181 |
'choices' => array(
|
3182 |
-
|
3183 |
-
|
3184 |
-
|
3185 |
),
|
3186 |
'allow_null' => 0,
|
3187 |
-
'
|
3188 |
-
'
|
3189 |
-
'
|
3190 |
'return_format' => 'value',
|
3191 |
-
'
|
3192 |
-
),
|
3193 |
-
array(
|
3194 |
-
'key' => 'field_acfe_form_user_save_email_group',
|
3195 |
-
'label' => 'Email',
|
3196 |
-
'name' => 'acfe_form_user_save_email_group',
|
3197 |
-
'type' => 'group',
|
3198 |
-
'instructions' => '',
|
3199 |
-
'required' => 0,
|
3200 |
'conditional_logic' => array(
|
3201 |
array(
|
3202 |
array(
|
3203 |
-
'field' => '
|
3204 |
-
'operator' => '==
|
|
|
3205 |
),
|
3206 |
),
|
3207 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3208 |
'wrapper' => array(
|
3209 |
'width' => '',
|
3210 |
'class' => '',
|
3211 |
'id' => '',
|
3212 |
),
|
3213 |
'acfe_permissions' => '',
|
3214 |
-
'
|
3215 |
-
|
3216 |
-
|
3217 |
-
'
|
3218 |
-
|
3219 |
-
|
3220 |
-
|
3221 |
-
|
3222 |
-
|
3223 |
-
|
3224 |
-
|
3225 |
-
|
3226 |
-
'wrapper' => array(
|
3227 |
-
'width' => '',
|
3228 |
-
'class' => '',
|
3229 |
-
'id' => '',
|
3230 |
-
),
|
3231 |
-
'acfe_permissions' => '',
|
3232 |
-
'choices' => array(
|
3233 |
-
'custom' => 'Custom email',
|
3234 |
-
),
|
3235 |
-
'default_value' => array(
|
3236 |
-
),
|
3237 |
-
'allow_null' => 1,
|
3238 |
-
'multiple' => 0,
|
3239 |
-
'ui' => 0,
|
3240 |
-
'return_format' => 'value',
|
3241 |
-
'placeholder' => 'Default',
|
3242 |
-
'ajax' => 0,
|
3243 |
-
),
|
3244 |
array(
|
3245 |
-
|
3246 |
-
|
3247 |
-
|
3248 |
-
|
3249 |
-
'instructions' => '',
|
3250 |
-
'required' => 1,
|
3251 |
-
'conditional_logic' => array(
|
3252 |
-
array(
|
3253 |
-
array(
|
3254 |
-
'field' => 'field_acfe_form_user_save_email',
|
3255 |
-
'operator' => '==',
|
3256 |
-
'value' => 'custom',
|
3257 |
-
),
|
3258 |
-
),
|
3259 |
-
),
|
3260 |
-
'wrapper' => array(
|
3261 |
-
'width' => '',
|
3262 |
-
'class' => '',
|
3263 |
-
'id' => '',
|
3264 |
),
|
3265 |
-
'acfe_permissions' => '',
|
3266 |
-
'default_value' => '',
|
3267 |
-
'placeholder' => 'Available tag: {field:name} *',
|
3268 |
-
'prepend' => '',
|
3269 |
-
'append' => '',
|
3270 |
-
'maxlength' => '',
|
3271 |
),
|
3272 |
),
|
3273 |
),
|
3274 |
array(
|
3275 |
-
'key' => '
|
3276 |
-
'label' => '
|
3277 |
-
'name' => '
|
3278 |
-
'type' => '
|
3279 |
'instructions' => '',
|
3280 |
'required' => 0,
|
3281 |
-
'conditional_logic' => array(
|
3282 |
-
array(
|
3283 |
-
array(
|
3284 |
-
'field' => 'field_acfe_form_user_map_email',
|
3285 |
-
'operator' => '!=empty',
|
3286 |
-
),
|
3287 |
-
),
|
3288 |
-
),
|
3289 |
'wrapper' => array(
|
3290 |
'width' => '',
|
3291 |
'class' => '',
|
3292 |
'id' => '',
|
3293 |
),
|
3294 |
'acfe_permissions' => '',
|
3295 |
-
|
3296 |
-
|
3297 |
-
|
3298 |
-
'
|
3299 |
-
'
|
3300 |
-
'
|
3301 |
-
'
|
3302 |
-
'
|
3303 |
-
'
|
3304 |
-
|
3305 |
-
|
3306 |
-
|
3307 |
-
|
|
|
|
|
|
|
|
|
3308 |
),
|
3309 |
),
|
3310 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3311 |
'wrapper' => array(
|
3312 |
'width' => '',
|
3313 |
'class' => '',
|
3314 |
'id' => '',
|
3315 |
),
|
3316 |
'acfe_permissions' => '',
|
3317 |
-
'
|
3318 |
-
|
3319 |
-
|
3320 |
-
'
|
3321 |
-
|
3322 |
-
|
3323 |
-
|
3324 |
-
|
3325 |
-
|
3326 |
-
|
3327 |
-
|
3328 |
-
|
3329 |
-
'wrapper' => array(
|
3330 |
-
'width' => '',
|
3331 |
-
'class' => '',
|
3332 |
-
'id' => '',
|
3333 |
-
),
|
3334 |
-
'acfe_permissions' => '',
|
3335 |
-
'choices' => array(
|
3336 |
-
'custom' => 'Custom username',
|
3337 |
-
),
|
3338 |
-
'default_value' => array(
|
3339 |
-
),
|
3340 |
-
'allow_null' => 1,
|
3341 |
-
'multiple' => 0,
|
3342 |
-
'ui' => 0,
|
3343 |
-
'return_format' => 'value',
|
3344 |
-
'placeholder' => 'Default',
|
3345 |
-
'ajax' => 0,
|
3346 |
-
),
|
3347 |
array(
|
3348 |
-
|
3349 |
-
|
3350 |
-
|
3351 |
-
|
3352 |
-
'instructions' => '',
|
3353 |
-
'required' => 1,
|
3354 |
-
'conditional_logic' => array(
|
3355 |
-
array(
|
3356 |
-
array(
|
3357 |
-
'field' => 'field_acfe_form_user_save_username',
|
3358 |
-
'operator' => '==',
|
3359 |
-
'value' => 'custom',
|
3360 |
-
),
|
3361 |
-
),
|
3362 |
-
),
|
3363 |
-
'wrapper' => array(
|
3364 |
-
'width' => '',
|
3365 |
-
'class' => '',
|
3366 |
-
'id' => '',
|
3367 |
),
|
3368 |
-
'acfe_permissions' => '',
|
3369 |
-
'default_value' => '',
|
3370 |
-
'placeholder' => 'Available tag: {field:name} *',
|
3371 |
-
'prepend' => '',
|
3372 |
-
'append' => '',
|
3373 |
-
'maxlength' => '',
|
3374 |
),
|
3375 |
),
|
3376 |
),
|
|
|
|
|
|
|
|
|
3377 |
array(
|
3378 |
-
'key' => '
|
3379 |
-
'label' => '
|
3380 |
-
'name' => '
|
3381 |
-
'type' => '
|
3382 |
'instructions' => '',
|
3383 |
'required' => 0,
|
3384 |
-
'conditional_logic' => array(
|
3385 |
-
array(
|
3386 |
-
array(
|
3387 |
-
'field' => 'field_acfe_form_user_map_username',
|
3388 |
-
'operator' => '!=empty',
|
3389 |
-
),
|
3390 |
-
),
|
3391 |
-
),
|
3392 |
'wrapper' => array(
|
3393 |
'width' => '',
|
3394 |
'class' => '',
|
3395 |
'id' => '',
|
3396 |
),
|
3397 |
'acfe_permissions' => '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3398 |
),
|
3399 |
array(
|
3400 |
-
'key' => '
|
3401 |
-
'label' => '
|
3402 |
-
'name' => '
|
3403 |
-
'type' => '
|
3404 |
'instructions' => '',
|
3405 |
'required' => 0,
|
3406 |
'conditional_logic' => array(
|
3407 |
array(
|
3408 |
array(
|
3409 |
-
'field' => '
|
3410 |
-
'operator' => '==
|
|
|
3411 |
),
|
3412 |
),
|
3413 |
),
|
@@ -3417,80 +3585,74 @@ acf_add_local_field_group(array(
|
|
3417 |
'id' => '',
|
3418 |
),
|
3419 |
'acfe_permissions' => '',
|
3420 |
-
'
|
3421 |
-
|
3422 |
-
'
|
3423 |
-
'
|
3424 |
-
|
3425 |
-
|
3426 |
-
|
3427 |
-
|
3428 |
-
|
3429 |
-
|
3430 |
-
|
3431 |
-
|
3432 |
-
|
3433 |
-
|
3434 |
-
|
3435 |
-
|
3436 |
-
|
3437 |
-
|
3438 |
-
|
3439 |
-
|
3440 |
-
|
3441 |
-
|
3442 |
-
|
3443 |
-
|
3444 |
-
|
3445 |
-
|
3446 |
-
|
3447 |
-
|
3448 |
-
|
3449 |
-
|
3450 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3451 |
array(
|
3452 |
-
|
3453 |
-
|
3454 |
-
|
3455 |
-
'type' => 'text',
|
3456 |
-
'instructions' => '',
|
3457 |
-
'required' => 1,
|
3458 |
-
'conditional_logic' => array(
|
3459 |
-
array(
|
3460 |
-
array(
|
3461 |
-
'field' => 'field_acfe_form_user_save_password',
|
3462 |
-
'operator' => '==',
|
3463 |
-
'value' => 'custom',
|
3464 |
-
),
|
3465 |
-
),
|
3466 |
),
|
3467 |
-
|
3468 |
-
'
|
3469 |
-
'
|
3470 |
-
'
|
3471 |
),
|
3472 |
-
'acfe_permissions' => '',
|
3473 |
-
'default_value' => '',
|
3474 |
-
'placeholder' => 'Available tag: {field:name} *',
|
3475 |
-
'prepend' => '',
|
3476 |
-
'append' => '',
|
3477 |
-
'maxlength' => '',
|
3478 |
),
|
3479 |
),
|
3480 |
-
|
3481 |
array(
|
3482 |
-
'key' => '
|
3483 |
-
'label' => '
|
3484 |
-
'name' => '
|
3485 |
'type' => 'acfe_dynamic_message',
|
3486 |
'instructions' => '',
|
3487 |
'required' => 0,
|
3488 |
'conditional_logic' => array(
|
3489 |
array(
|
3490 |
array(
|
3491 |
-
'field' => '
|
3492 |
'operator' => '!=empty',
|
3493 |
),
|
|
|
|
|
|
|
|
|
|
|
3494 |
),
|
3495 |
),
|
3496 |
'wrapper' => array(
|
@@ -3500,100 +3662,62 @@ acf_add_local_field_group(array(
|
|
3500 |
),
|
3501 |
'acfe_permissions' => '',
|
3502 |
),
|
3503 |
-
|
3504 |
-
|
3505 |
-
|
3506 |
-
|
3507 |
-
|
3508 |
-
|
3509 |
-
|
3510 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3511 |
array(
|
3512 |
array(
|
3513 |
-
'field' => '
|
3514 |
'operator' => '==empty',
|
3515 |
),
|
3516 |
-
|
3517 |
-
|
3518 |
-
|
3519 |
-
|
3520 |
-
'class' => '',
|
3521 |
-
'id' => '',
|
3522 |
-
),
|
3523 |
-
'acfe_permissions' => '',
|
3524 |
-
'layout' => 'block',
|
3525 |
-
'acfe_seamless_style' => true,
|
3526 |
-
'acfe_group_modal' => 0,
|
3527 |
-
'sub_fields' => array(
|
3528 |
-
array(
|
3529 |
-
'key' => 'field_acfe_form_user_save_first_name',
|
3530 |
-
'label' => '',
|
3531 |
-
'name' => 'acfe_form_user_save_first_name',
|
3532 |
-
'type' => 'select',
|
3533 |
-
'instructions' => '',
|
3534 |
-
'required' => 0,
|
3535 |
-
'conditional_logic' => 0,
|
3536 |
-
'wrapper' => array(
|
3537 |
-
'width' => '',
|
3538 |
-
'class' => '',
|
3539 |
-
'id' => '',
|
3540 |
-
),
|
3541 |
-
'acfe_permissions' => '',
|
3542 |
-
'choices' => array(
|
3543 |
-
'custom' => 'Custom first name',
|
3544 |
-
),
|
3545 |
-
'default_value' => array(
|
3546 |
-
),
|
3547 |
-
'allow_null' => 1,
|
3548 |
-
'multiple' => 0,
|
3549 |
-
'ui' => 0,
|
3550 |
-
'return_format' => 'value',
|
3551 |
-
'placeholder' => 'Default',
|
3552 |
-
'ajax' => 0,
|
3553 |
-
),
|
3554 |
-
array(
|
3555 |
-
'key' => 'field_acfe_form_user_save_first_name_custom',
|
3556 |
-
'label' => '',
|
3557 |
-
'name' => 'acfe_form_user_save_first_name_custom',
|
3558 |
-
'type' => 'text',
|
3559 |
-
'instructions' => '',
|
3560 |
-
'required' => 1,
|
3561 |
-
'conditional_logic' => array(
|
3562 |
-
array(
|
3563 |
-
array(
|
3564 |
-
'field' => 'field_acfe_form_user_save_first_name',
|
3565 |
-
'operator' => '==',
|
3566 |
-
'value' => 'custom',
|
3567 |
-
),
|
3568 |
-
),
|
3569 |
-
),
|
3570 |
-
'wrapper' => array(
|
3571 |
-
'width' => '',
|
3572 |
-
'class' => '',
|
3573 |
-
'id' => '',
|
3574 |
),
|
3575 |
-
'acfe_permissions' => '',
|
3576 |
-
'default_value' => '',
|
3577 |
-
'placeholder' => 'Available tag: {field:name} *',
|
3578 |
-
'prepend' => '',
|
3579 |
-
'append' => '',
|
3580 |
-
'maxlength' => '',
|
3581 |
),
|
3582 |
),
|
3583 |
-
|
3584 |
array(
|
3585 |
-
'key' => '
|
3586 |
-
'label' => '
|
3587 |
-
'name' => '
|
3588 |
'type' => 'acfe_dynamic_message',
|
3589 |
'instructions' => '',
|
3590 |
'required' => 0,
|
3591 |
'conditional_logic' => array(
|
3592 |
array(
|
3593 |
array(
|
3594 |
-
'field' => '
|
3595 |
'operator' => '!=empty',
|
3596 |
),
|
|
|
|
|
|
|
|
|
|
|
3597 |
),
|
3598 |
),
|
3599 |
'wrapper' => array(
|
@@ -3603,18 +3727,63 @@ acf_add_local_field_group(array(
|
|
3603 |
),
|
3604 |
'acfe_permissions' => '',
|
3605 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3606 |
array(
|
3607 |
-
'key' => '
|
3608 |
-
'label' => '
|
3609 |
-
'name' => '
|
3610 |
-
'type' => '
|
3611 |
'instructions' => '',
|
3612 |
'required' => 0,
|
3613 |
'conditional_logic' => array(
|
3614 |
array(
|
3615 |
array(
|
3616 |
-
'field' => '
|
3617 |
-
'operator' => '
|
|
|
|
|
|
|
|
|
|
|
3618 |
),
|
3619 |
),
|
3620 |
),
|
@@ -3624,79 +3793,63 @@ acf_add_local_field_group(array(
|
|
3624 |
'id' => '',
|
3625 |
),
|
3626 |
'acfe_permissions' => '',
|
3627 |
-
|
3628 |
-
|
3629 |
-
|
3630 |
-
|
3631 |
-
|
3632 |
-
|
3633 |
-
|
3634 |
-
|
3635 |
-
|
3636 |
-
|
3637 |
-
|
3638 |
-
|
3639 |
-
|
3640 |
-
|
3641 |
-
|
3642 |
-
|
3643 |
-
|
3644 |
-
|
3645 |
-
|
3646 |
-
|
3647 |
-
|
3648 |
-
|
3649 |
-
|
3650 |
-
|
3651 |
-
|
3652 |
-
|
3653 |
-
'return_format' => 'value',
|
3654 |
-
'placeholder' => 'Default',
|
3655 |
-
'ajax' => 0,
|
3656 |
-
),
|
3657 |
array(
|
3658 |
-
|
3659 |
-
|
3660 |
-
|
3661 |
-
'type' => 'text',
|
3662 |
-
'instructions' => '',
|
3663 |
-
'required' => 1,
|
3664 |
-
'conditional_logic' => array(
|
3665 |
-
array(
|
3666 |
-
array(
|
3667 |
-
'field' => 'field_acfe_form_user_save_last_name',
|
3668 |
-
'operator' => '==',
|
3669 |
-
'value' => 'custom',
|
3670 |
-
),
|
3671 |
-
),
|
3672 |
),
|
3673 |
-
|
3674 |
-
'
|
3675 |
-
'
|
3676 |
-
'
|
3677 |
),
|
3678 |
-
'acfe_permissions' => '',
|
3679 |
-
'default_value' => '',
|
3680 |
-
'placeholder' => 'Available tag: {field:name} *',
|
3681 |
-
'prepend' => '',
|
3682 |
-
'append' => '',
|
3683 |
-
'maxlength' => '',
|
3684 |
),
|
3685 |
),
|
3686 |
-
|
3687 |
array(
|
3688 |
-
'key' => '
|
3689 |
-
'label' => '
|
3690 |
-
'name' => '
|
3691 |
'type' => 'acfe_dynamic_message',
|
3692 |
'instructions' => '',
|
3693 |
'required' => 0,
|
3694 |
'conditional_logic' => array(
|
3695 |
array(
|
3696 |
array(
|
3697 |
-
'field' => '
|
3698 |
'operator' => '!=empty',
|
3699 |
),
|
|
|
|
|
|
|
|
|
|
|
3700 |
),
|
3701 |
),
|
3702 |
'wrapper' => array(
|
@@ -3706,18 +3859,60 @@ acf_add_local_field_group(array(
|
|
3706 |
),
|
3707 |
'acfe_permissions' => '',
|
3708 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3709 |
array(
|
3710 |
-
'key' => '
|
3711 |
-
'label' => '
|
3712 |
-
'name' => '
|
3713 |
-
'type' => '
|
3714 |
'instructions' => '',
|
3715 |
'required' => 0,
|
3716 |
'conditional_logic' => array(
|
3717 |
array(
|
3718 |
array(
|
3719 |
-
'field' => '
|
3720 |
-
'operator' => '
|
|
|
|
|
|
|
|
|
|
|
3721 |
),
|
3722 |
),
|
3723 |
),
|
@@ -3727,66 +3922,45 @@ acf_add_local_field_group(array(
|
|
3727 |
'id' => '',
|
3728 |
),
|
3729 |
'acfe_permissions' => '',
|
3730 |
-
|
3731 |
-
|
3732 |
-
|
3733 |
-
|
3734 |
-
|
3735 |
-
|
3736 |
-
|
3737 |
-
|
3738 |
-
|
3739 |
-
|
3740 |
-
|
3741 |
-
|
3742 |
-
|
3743 |
-
|
3744 |
-
|
3745 |
-
|
3746 |
-
|
3747 |
-
|
3748 |
-
|
3749 |
-
|
3750 |
-
|
3751 |
-
|
3752 |
-
|
3753 |
-
|
3754 |
-
|
3755 |
-
|
3756 |
-
'return_format' => 'value',
|
3757 |
-
'placeholder' => 'Default',
|
3758 |
-
'ajax' => 0,
|
3759 |
-
),
|
3760 |
array(
|
3761 |
-
|
3762 |
-
|
3763 |
-
|
3764 |
-
'type' => 'text',
|
3765 |
-
'instructions' => '',
|
3766 |
-
'required' => 1,
|
3767 |
-
'conditional_logic' => array(
|
3768 |
-
array(
|
3769 |
-
array(
|
3770 |
-
'field' => 'field_acfe_form_user_save_nickname',
|
3771 |
-
'operator' => '==',
|
3772 |
-
'value' => 'custom',
|
3773 |
-
),
|
3774 |
-
),
|
3775 |
),
|
3776 |
-
|
3777 |
-
'
|
3778 |
-
'
|
3779 |
-
'
|
3780 |
),
|
3781 |
-
'acfe_permissions' => '',
|
3782 |
-
'default_value' => '',
|
3783 |
-
'placeholder' => 'Available tag: {field:name} *',
|
3784 |
-
'prepend' => '',
|
3785 |
-
'append' => '',
|
3786 |
-
'maxlength' => '',
|
3787 |
),
|
3788 |
),
|
3789 |
-
|
3790 |
array(
|
3791 |
'key' => 'field_acfe_form_user_map_nickname_message',
|
3792 |
'label' => 'Nickname',
|
@@ -3800,6 +3974,11 @@ acf_add_local_field_group(array(
|
|
3800 |
'field' => 'field_acfe_form_user_map_nickname',
|
3801 |
'operator' => '!=empty',
|
3802 |
),
|
|
|
|
|
|
|
|
|
|
|
3803 |
),
|
3804 |
),
|
3805 |
'wrapper' => array(
|
@@ -3809,87 +3988,44 @@ acf_add_local_field_group(array(
|
|
3809 |
),
|
3810 |
'acfe_permissions' => '',
|
3811 |
),
|
3812 |
-
|
3813 |
-
|
3814 |
-
|
3815 |
-
|
3816 |
-
|
3817 |
-
|
3818 |
-
|
3819 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3820 |
array(
|
3821 |
array(
|
3822 |
'field' => 'field_acfe_form_user_map_display_name',
|
3823 |
'operator' => '==empty',
|
3824 |
),
|
3825 |
-
|
3826 |
-
|
3827 |
-
|
3828 |
-
|
3829 |
-
'class' => '',
|
3830 |
-
'id' => '',
|
3831 |
-
),
|
3832 |
-
'acfe_permissions' => '',
|
3833 |
-
'layout' => 'block',
|
3834 |
-
'acfe_seamless_style' => true,
|
3835 |
-
'acfe_group_modal' => 0,
|
3836 |
-
'sub_fields' => array(
|
3837 |
-
array(
|
3838 |
-
'key' => 'field_acfe_form_user_save_display_name',
|
3839 |
-
'label' => '',
|
3840 |
-
'name' => 'acfe_form_user_save_display_name',
|
3841 |
-
'type' => 'select',
|
3842 |
-
'instructions' => '',
|
3843 |
-
'required' => 0,
|
3844 |
-
'conditional_logic' => 0,
|
3845 |
-
'wrapper' => array(
|
3846 |
-
'width' => '',
|
3847 |
-
'class' => '',
|
3848 |
-
'id' => '',
|
3849 |
-
),
|
3850 |
-
'acfe_permissions' => '',
|
3851 |
-
'choices' => array(
|
3852 |
-
'custom' => 'Custom display name',
|
3853 |
-
),
|
3854 |
-
'default_value' => array(
|
3855 |
-
),
|
3856 |
-
'allow_null' => 1,
|
3857 |
-
'multiple' => 0,
|
3858 |
-
'ui' => 0,
|
3859 |
-
'return_format' => 'value',
|
3860 |
-
'placeholder' => 'Default',
|
3861 |
-
'ajax' => 0,
|
3862 |
-
),
|
3863 |
-
array(
|
3864 |
-
'key' => 'field_acfe_form_user_save_display_name_custom',
|
3865 |
-
'label' => '',
|
3866 |
-
'name' => 'acfe_form_user_save_display_name_custom',
|
3867 |
-
'type' => 'text',
|
3868 |
-
'instructions' => '',
|
3869 |
-
'required' => 1,
|
3870 |
-
'conditional_logic' => array(
|
3871 |
-
array(
|
3872 |
-
array(
|
3873 |
-
'field' => 'field_acfe_form_user_save_display_name',
|
3874 |
-
'operator' => '==',
|
3875 |
-
'value' => 'custom',
|
3876 |
-
),
|
3877 |
-
),
|
3878 |
-
),
|
3879 |
-
'wrapper' => array(
|
3880 |
-
'width' => '',
|
3881 |
-
'class' => '',
|
3882 |
-
'id' => '',
|
3883 |
),
|
3884 |
-
'acfe_permissions' => '',
|
3885 |
-
'default_value' => '',
|
3886 |
-
'placeholder' => 'Available tag: {field:name} *',
|
3887 |
-
'prepend' => '',
|
3888 |
-
'append' => '',
|
3889 |
-
'maxlength' => '',
|
3890 |
),
|
3891 |
),
|
3892 |
-
|
3893 |
array(
|
3894 |
'key' => 'field_acfe_form_user_map_display_name_message',
|
3895 |
'label' => 'Display name',
|
@@ -3903,27 +4039,10 @@ acf_add_local_field_group(array(
|
|
3903 |
'field' => 'field_acfe_form_user_map_display_name',
|
3904 |
'operator' => '!=empty',
|
3905 |
),
|
3906 |
-
|
3907 |
-
|
3908 |
-
|
3909 |
-
|
3910 |
-
'class' => '',
|
3911 |
-
'id' => '',
|
3912 |
-
),
|
3913 |
-
'acfe_permissions' => '',
|
3914 |
-
),
|
3915 |
-
array(
|
3916 |
-
'key' => 'field_acfe_form_user_save_website_group',
|
3917 |
-
'label' => 'Website',
|
3918 |
-
'name' => 'acfe_form_user_save_website_group',
|
3919 |
-
'type' => 'group',
|
3920 |
-
'instructions' => '',
|
3921 |
-
'required' => 0,
|
3922 |
-
'conditional_logic' => array(
|
3923 |
-
array(
|
3924 |
-
array(
|
3925 |
-
'field' => 'field_acfe_form_user_map_website',
|
3926 |
-
'operator' => '==empty',
|
3927 |
),
|
3928 |
),
|
3929 |
),
|
@@ -3933,66 +4052,45 @@ acf_add_local_field_group(array(
|
|
3933 |
'id' => '',
|
3934 |
),
|
3935 |
'acfe_permissions' => '',
|
3936 |
-
|
3937 |
-
|
3938 |
-
|
3939 |
-
|
3940 |
-
|
3941 |
-
|
3942 |
-
|
3943 |
-
|
3944 |
-
|
3945 |
-
|
3946 |
-
|
3947 |
-
|
3948 |
-
|
3949 |
-
|
3950 |
-
|
3951 |
-
|
3952 |
-
|
3953 |
-
|
3954 |
-
|
3955 |
-
|
3956 |
-
|
3957 |
-
|
3958 |
-
|
3959 |
-
|
3960 |
-
|
3961 |
-
|
3962 |
-
'return_format' => 'value',
|
3963 |
-
'placeholder' => 'Default',
|
3964 |
-
'ajax' => 0,
|
3965 |
-
),
|
3966 |
array(
|
3967 |
-
|
3968 |
-
|
3969 |
-
|
3970 |
-
'type' => 'text',
|
3971 |
-
'instructions' => '',
|
3972 |
-
'required' => 1,
|
3973 |
-
'conditional_logic' => array(
|
3974 |
-
array(
|
3975 |
-
array(
|
3976 |
-
'field' => 'field_acfe_form_user_save_website',
|
3977 |
-
'operator' => '==',
|
3978 |
-
'value' => 'custom',
|
3979 |
-
),
|
3980 |
-
),
|
3981 |
),
|
3982 |
-
|
3983 |
-
'
|
3984 |
-
'
|
3985 |
-
'
|
3986 |
),
|
3987 |
-
'acfe_permissions' => '',
|
3988 |
-
'default_value' => '',
|
3989 |
-
'placeholder' => 'Available tag: {field:name} *',
|
3990 |
-
'prepend' => '',
|
3991 |
-
'append' => '',
|
3992 |
-
'maxlength' => '',
|
3993 |
),
|
3994 |
),
|
3995 |
-
|
3996 |
array(
|
3997 |
'key' => 'field_acfe_form_user_map_website_message',
|
3998 |
'label' => 'Website',
|
@@ -4006,6 +4104,11 @@ acf_add_local_field_group(array(
|
|
4006 |
'field' => 'field_acfe_form_user_map_website',
|
4007 |
'operator' => '!=empty',
|
4008 |
),
|
|
|
|
|
|
|
|
|
|
|
4009 |
),
|
4010 |
),
|
4011 |
'wrapper' => array(
|
@@ -4028,6 +4131,11 @@ acf_add_local_field_group(array(
|
|
4028 |
'field' => 'field_acfe_form_user_map_description',
|
4029 |
'operator' => '==empty',
|
4030 |
),
|
|
|
|
|
|
|
|
|
|
|
4031 |
),
|
4032 |
),
|
4033 |
'wrapper' => array(
|
@@ -4055,16 +4163,18 @@ acf_add_local_field_group(array(
|
|
4055 |
),
|
4056 |
'acfe_permissions' => '',
|
4057 |
'choices' => array(
|
4058 |
-
'custom' => '
|
4059 |
),
|
4060 |
'default_value' => array(
|
4061 |
),
|
4062 |
'allow_null' => 1,
|
4063 |
'multiple' => 0,
|
4064 |
-
'ui' =>
|
4065 |
'return_format' => 'value',
|
4066 |
'placeholder' => 'Default',
|
4067 |
'ajax' => 0,
|
|
|
|
|
4068 |
),
|
4069 |
array(
|
4070 |
'key' => 'field_acfe_form_user_save_description_custom',
|
@@ -4109,6 +4219,11 @@ acf_add_local_field_group(array(
|
|
4109 |
'field' => 'field_acfe_form_user_map_description',
|
4110 |
'operator' => '!=empty',
|
4111 |
),
|
|
|
|
|
|
|
|
|
|
|
4112 |
),
|
4113 |
),
|
4114 |
'wrapper' => array(
|
@@ -4131,6 +4246,11 @@ acf_add_local_field_group(array(
|
|
4131 |
'field' => 'field_acfe_form_user_map_role',
|
4132 |
'operator' => '==empty',
|
4133 |
),
|
|
|
|
|
|
|
|
|
|
|
4134 |
),
|
4135 |
),
|
4136 |
'wrapper' => array(
|
@@ -4145,13 +4265,14 @@ acf_add_local_field_group(array(
|
|
4145 |
'allow_null' => 1,
|
4146 |
'placeholder' => 'Default',
|
4147 |
'multiple' => 0,
|
4148 |
-
'ui' =>
|
4149 |
'choices' => array(
|
4150 |
),
|
4151 |
'ajax' => 0,
|
4152 |
'layout' => '',
|
4153 |
'toggle' => 0,
|
4154 |
-
'
|
|
|
4155 |
),
|
4156 |
array(
|
4157 |
'key' => 'field_acfe_form_user_map_role_message',
|
@@ -4166,6 +4287,11 @@ acf_add_local_field_group(array(
|
|
4166 |
'field' => 'field_acfe_form_user_map_role',
|
4167 |
'operator' => '!=empty',
|
4168 |
),
|
|
|
|
|
|
|
|
|
|
|
4169 |
),
|
4170 |
),
|
4171 |
'wrapper' => array(
|
@@ -4177,12 +4303,11 @@ acf_add_local_field_group(array(
|
|
4177 |
),
|
4178 |
array(
|
4179 |
'key' => 'field_acfe_form_user_save_meta',
|
4180 |
-
'label' => 'Save
|
4181 |
'name' => 'acfe_form_user_save_meta',
|
4182 |
'type' => 'checkbox',
|
4183 |
'instructions' => 'Choose which ACF fields should be saved to this user',
|
4184 |
'required' => 0,
|
4185 |
-
'conditional_logic' => 0,
|
4186 |
'wrapper' => array(
|
4187 |
'width' => '',
|
4188 |
'class' => '',
|
@@ -4198,7 +4323,20 @@ acf_add_local_field_group(array(
|
|
4198 |
'toggle' => 1,
|
4199 |
'return_format' => 'value',
|
4200 |
'save_custom' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4201 |
),
|
|
|
|
|
|
|
|
|
4202 |
array(
|
4203 |
'key' => 'acfe_form_user_tab_load',
|
4204 |
'label' => 'Load',
|
@@ -4206,7 +4344,6 @@ acf_add_local_field_group(array(
|
|
4206 |
'type' => 'tab',
|
4207 |
'instructions' => '',
|
4208 |
'required' => 0,
|
4209 |
-
'conditional_logic' => 0,
|
4210 |
'wrapper' => array(
|
4211 |
'width' => '',
|
4212 |
'class' => '',
|
@@ -4215,6 +4352,15 @@ acf_add_local_field_group(array(
|
|
4215 |
'acfe_permissions' => '',
|
4216 |
'placement' => 'top',
|
4217 |
'endpoint' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4218 |
),
|
4219 |
array(
|
4220 |
'key' => 'field_acfe_form_user_load_values',
|
@@ -4238,10 +4384,10 @@ acf_add_local_field_group(array(
|
|
4238 |
),
|
4239 |
array(
|
4240 |
'key' => 'field_acfe_form_user_load_source',
|
4241 |
-
'label' => '
|
4242 |
'name' => 'acfe_form_user_load_source',
|
4243 |
'type' => 'select',
|
4244 |
-
'instructions' => '
|
4245 |
'required' => 0,
|
4246 |
'conditional_logic' => array(
|
4247 |
array(
|
@@ -4260,65 +4406,17 @@ acf_add_local_field_group(array(
|
|
4260 |
'acfe_permissions' => '',
|
4261 |
'choices' => array(
|
4262 |
),
|
4263 |
-
'default_value' =>
|
4264 |
-
0 => 'current_user',
|
4265 |
-
),
|
4266 |
'allow_null' => 0,
|
4267 |
'multiple' => 0,
|
4268 |
'ui' => 1,
|
4269 |
-
'ajax' =>
|
4270 |
'return_format' => 'value',
|
4271 |
'placeholder' => '',
|
|
|
|
|
4272 |
),
|
4273 |
-
|
4274 |
-
'key' => 'field_acfe_form_user_load_meta',
|
4275 |
-
'label' => 'Fields Values',
|
4276 |
-
'name' => 'acfe_form_user_load_meta',
|
4277 |
-
'type' => 'checkbox',
|
4278 |
-
'instructions' => 'Choose which ACF fields should have values filled',
|
4279 |
-
'required' => 0,
|
4280 |
-
'conditional_logic' => array(
|
4281 |
-
array(
|
4282 |
-
array(
|
4283 |
-
'field' => 'field_acfe_form_user_load_values',
|
4284 |
-
'operator' => '==',
|
4285 |
-
'value' => '1',
|
4286 |
-
),
|
4287 |
-
),
|
4288 |
-
),
|
4289 |
-
'wrapper' => array(
|
4290 |
-
'width' => '',
|
4291 |
-
'class' => '',
|
4292 |
-
'id' => '',
|
4293 |
-
),
|
4294 |
-
'acfe_permissions' => '',
|
4295 |
-
'choices' => array(
|
4296 |
-
),
|
4297 |
-
'allow_custom' => 0,
|
4298 |
-
'default_value' => array(
|
4299 |
-
),
|
4300 |
-
'layout' => 'vertical',
|
4301 |
-
'toggle' => 1,
|
4302 |
-
'return_format' => 'value',
|
4303 |
-
'save_custom' => 0,
|
4304 |
-
),
|
4305 |
-
array(
|
4306 |
-
'key' => 'acfe_form_user_tab_mapping',
|
4307 |
-
'label' => 'Mapping',
|
4308 |
-
'name' => '',
|
4309 |
-
'type' => 'tab',
|
4310 |
-
'instructions' => '',
|
4311 |
-
'required' => 0,
|
4312 |
-
'conditional_logic' => 0,
|
4313 |
-
'wrapper' => array(
|
4314 |
-
'width' => '',
|
4315 |
-
'class' => '',
|
4316 |
-
'id' => '',
|
4317 |
-
),
|
4318 |
-
'acfe_permissions' => '',
|
4319 |
-
'placement' => 'top',
|
4320 |
-
'endpoint' => 0,
|
4321 |
-
),
|
4322 |
array(
|
4323 |
'key' => 'field_acfe_form_user_map_email',
|
4324 |
'label' => 'Email',
|
@@ -4326,7 +4424,6 @@ acf_add_local_field_group(array(
|
|
4326 |
'type' => 'select',
|
4327 |
'instructions' => '',
|
4328 |
'required' => 0,
|
4329 |
-
'conditional_logic' => 0,
|
4330 |
'wrapper' => array(
|
4331 |
'width' => '',
|
4332 |
'class' => '',
|
@@ -4339,10 +4436,26 @@ acf_add_local_field_group(array(
|
|
4339 |
),
|
4340 |
'allow_null' => 1,
|
4341 |
'multiple' => 0,
|
4342 |
-
'ui' =>
|
4343 |
'return_format' => 'value',
|
4344 |
'placeholder' => 'Default',
|
4345 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4346 |
),
|
4347 |
array(
|
4348 |
'key' => 'field_acfe_form_user_map_username',
|
@@ -4351,7 +4464,6 @@ acf_add_local_field_group(array(
|
|
4351 |
'type' => 'select',
|
4352 |
'instructions' => '',
|
4353 |
'required' => 0,
|
4354 |
-
'conditional_logic' => 0,
|
4355 |
'wrapper' => array(
|
4356 |
'width' => '',
|
4357 |
'class' => '',
|
@@ -4364,10 +4476,26 @@ acf_add_local_field_group(array(
|
|
4364 |
),
|
4365 |
'allow_null' => 1,
|
4366 |
'multiple' => 0,
|
4367 |
-
'ui' =>
|
4368 |
'return_format' => 'value',
|
4369 |
'placeholder' => 'Default',
|
4370 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4371 |
),
|
4372 |
array(
|
4373 |
'key' => 'field_acfe_form_user_map_password',
|
@@ -4376,7 +4504,6 @@ acf_add_local_field_group(array(
|
|
4376 |
'type' => 'select',
|
4377 |
'instructions' => '',
|
4378 |
'required' => 0,
|
4379 |
-
'conditional_logic' => 0,
|
4380 |
'wrapper' => array(
|
4381 |
'width' => '',
|
4382 |
'class' => '',
|
@@ -4389,10 +4516,26 @@ acf_add_local_field_group(array(
|
|
4389 |
),
|
4390 |
'allow_null' => 1,
|
4391 |
'multiple' => 0,
|
4392 |
-
'ui' =>
|
4393 |
'return_format' => 'value',
|
4394 |
'placeholder' => 'Default',
|
4395 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4396 |
),
|
4397 |
array(
|
4398 |
'key' => 'field_acfe_form_user_map_first_name',
|
@@ -4401,7 +4544,6 @@ acf_add_local_field_group(array(
|
|
4401 |
'type' => 'select',
|
4402 |
'instructions' => '',
|
4403 |
'required' => 0,
|
4404 |
-
'conditional_logic' => 0,
|
4405 |
'wrapper' => array(
|
4406 |
'width' => '',
|
4407 |
'class' => '',
|
@@ -4414,10 +4556,26 @@ acf_add_local_field_group(array(
|
|
4414 |
),
|
4415 |
'allow_null' => 1,
|
4416 |
'multiple' => 0,
|
4417 |
-
'ui' =>
|
4418 |
'return_format' => 'value',
|
4419 |
'placeholder' => 'Default',
|
4420 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4421 |
),
|
4422 |
array(
|
4423 |
'key' => 'field_acfe_form_user_map_last_name',
|
@@ -4426,7 +4584,6 @@ acf_add_local_field_group(array(
|
|
4426 |
'type' => 'select',
|
4427 |
'instructions' => '',
|
4428 |
'required' => 0,
|
4429 |
-
'conditional_logic' => 0,
|
4430 |
'wrapper' => array(
|
4431 |
'width' => '',
|
4432 |
'class' => '',
|
@@ -4439,10 +4596,26 @@ acf_add_local_field_group(array(
|
|
4439 |
),
|
4440 |
'allow_null' => 1,
|
4441 |
'multiple' => 0,
|
4442 |
-
'ui' =>
|
4443 |
'return_format' => 'value',
|
4444 |
'placeholder' => 'Default',
|
4445 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4446 |
),
|
4447 |
array(
|
4448 |
'key' => 'field_acfe_form_user_map_nickname',
|
@@ -4451,7 +4624,6 @@ acf_add_local_field_group(array(
|
|
4451 |
'type' => 'select',
|
4452 |
'instructions' => '',
|
4453 |
'required' => 0,
|
4454 |
-
'conditional_logic' => 0,
|
4455 |
'wrapper' => array(
|
4456 |
'width' => '',
|
4457 |
'class' => '',
|
@@ -4464,10 +4636,26 @@ acf_add_local_field_group(array(
|
|
4464 |
),
|
4465 |
'allow_null' => 1,
|
4466 |
'multiple' => 0,
|
4467 |
-
'ui' =>
|
4468 |
'return_format' => 'value',
|
4469 |
'placeholder' => 'Default',
|
4470 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4471 |
),
|
4472 |
array(
|
4473 |
'key' => 'field_acfe_form_user_map_display_name',
|
@@ -4476,7 +4664,6 @@ acf_add_local_field_group(array(
|
|
4476 |
'type' => 'select',
|
4477 |
'instructions' => '',
|
4478 |
'required' => 0,
|
4479 |
-
'conditional_logic' => 0,
|
4480 |
'wrapper' => array(
|
4481 |
'width' => '',
|
4482 |
'class' => '',
|
@@ -4489,10 +4676,26 @@ acf_add_local_field_group(array(
|
|
4489 |
),
|
4490 |
'allow_null' => 1,
|
4491 |
'multiple' => 0,
|
4492 |
-
'ui' =>
|
4493 |
'return_format' => 'value',
|
4494 |
'placeholder' => 'Default',
|
4495 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4496 |
),
|
4497 |
array(
|
4498 |
'key' => 'field_acfe_form_user_map_website',
|
@@ -4501,7 +4704,6 @@ acf_add_local_field_group(array(
|
|
4501 |
'type' => 'select',
|
4502 |
'instructions' => '',
|
4503 |
'required' => 0,
|
4504 |
-
'conditional_logic' => 0,
|
4505 |
'wrapper' => array(
|
4506 |
'width' => '',
|
4507 |
'class' => '',
|
@@ -4514,19 +4716,74 @@ acf_add_local_field_group(array(
|
|
4514 |
),
|
4515 |
'allow_null' => 1,
|
4516 |
'multiple' => 0,
|
4517 |
-
'ui' =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4518 |
'return_format' => 'value',
|
4519 |
'placeholder' => 'Default',
|
4520 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4521 |
),
|
4522 |
array(
|
4523 |
-
'key' => '
|
4524 |
-
'label' => '
|
4525 |
-
'name' => '
|
4526 |
'type' => 'select',
|
4527 |
'instructions' => '',
|
4528 |
'required' => 0,
|
4529 |
-
'conditional_logic' => 0,
|
4530 |
'wrapper' => array(
|
4531 |
'width' => '',
|
4532 |
'class' => '',
|
@@ -4539,19 +4796,43 @@ acf_add_local_field_group(array(
|
|
4539 |
),
|
4540 |
'allow_null' => 1,
|
4541 |
'multiple' => 0,
|
4542 |
-
'ui' =>
|
4543 |
'return_format' => 'value',
|
4544 |
'placeholder' => 'Default',
|
4545 |
'ajax' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4546 |
),
|
4547 |
array(
|
4548 |
-
'key' => '
|
4549 |
-
'label' => '
|
4550 |
-
'name' => '
|
4551 |
-
'type' => '
|
4552 |
-
'instructions' => '',
|
4553 |
'required' => 0,
|
4554 |
-
'conditional_logic' =>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4555 |
'wrapper' => array(
|
4556 |
'width' => '',
|
4557 |
'class' => '',
|
@@ -4560,15 +4841,19 @@ acf_add_local_field_group(array(
|
|
4560 |
'acfe_permissions' => '',
|
4561 |
'choices' => array(
|
4562 |
),
|
|
|
4563 |
'default_value' => array(
|
4564 |
),
|
4565 |
-
'
|
4566 |
-
'
|
4567 |
-
'ui' => 0,
|
4568 |
'return_format' => 'value',
|
4569 |
-
'
|
4570 |
-
'ajax' => 0,
|
4571 |
),
|
|
|
|
|
|
|
|
|
|
|
4572 |
array(
|
4573 |
'key' => 'field_acfe_form_user_tab_advanced',
|
4574 |
'label' => 'Advanced',
|
@@ -4592,7 +4877,7 @@ acf_add_local_field_group(array(
|
|
4592 |
'name' => 'acfe_form_user_advanced_load',
|
4593 |
'type' => 'acfe_dynamic_message',
|
4594 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
4595 |
-
'instructions' => '
|
4596 |
'required' => 0,
|
4597 |
'conditional_logic' => 0,
|
4598 |
'wrapper' => array(
|
@@ -4608,7 +4893,7 @@ acf_add_local_field_group(array(
|
|
4608 |
'name' => 'acfe_form_user_advanced_save_args',
|
4609 |
'type' => 'acfe_dynamic_message',
|
4610 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
4611 |
-
'instructions' => '
|
4612 |
'required' => 0,
|
4613 |
'conditional_logic' => 0,
|
4614 |
'wrapper' => array(
|
@@ -4644,6 +4929,127 @@ acf_add_local_field_group(array(
|
|
4644 |
'min' => '',
|
4645 |
'max' => '',
|
4646 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4647 |
array(
|
4648 |
'key' => 'field_acfe_form_tab_advanced',
|
4649 |
'label' => 'Advanced',
|
@@ -4661,6 +5067,7 @@ acf_add_local_field_group(array(
|
|
4661 |
'placement' => 'top',
|
4662 |
'endpoint' => 0,
|
4663 |
),
|
|
|
4664 |
array(
|
4665 |
'key' => 'field_acfe_form_post_field_groups',
|
4666 |
'label' => 'Post field groups',
|
@@ -4680,6 +5087,7 @@ acf_add_local_field_group(array(
|
|
4680 |
'return_format' => 'value',
|
4681 |
'placeholder' => '',
|
4682 |
),
|
|
|
4683 |
array(
|
4684 |
'key' => 'field_acfe_form_honeypot',
|
4685 |
'label' => 'Honeypot',
|
@@ -4736,12 +5144,13 @@ acf_add_local_field_group(array(
|
|
4736 |
),
|
4737 |
'acfe_permissions' => '',
|
4738 |
'choices' => array(
|
|
|
4739 |
'wp' => 'Media modal',
|
4740 |
'basic' => 'Basic',
|
4741 |
),
|
4742 |
'allow_null' => 0,
|
4743 |
'other_choice' => 0,
|
4744 |
-
'default_value' => '
|
4745 |
'layout' => 'vertical',
|
4746 |
'return_format' => 'value',
|
4747 |
'save_other_choice' => 0,
|
@@ -4827,6 +5236,163 @@ acf_add_local_field_group(array(
|
|
4827 |
'return_format' => 'value',
|
4828 |
'save_other_choice' => 0,
|
4829 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4830 |
),
|
4831 |
'location' => array(
|
4832 |
array(
|
7 |
'key' => 'group_acfe_dynamic_form',
|
8 |
'title' => 'Dynamic Form',
|
9 |
'fields' => array(
|
10 |
+
|
11 |
+
/*
|
12 |
+
* General
|
13 |
+
*/
|
14 |
array(
|
15 |
'key' => 'field_acfe_form_tab_general',
|
16 |
'label' => 'General',
|
73 |
'return_format' => 'value',
|
74 |
'placeholder' => '',
|
75 |
),
|
76 |
+
array(
|
77 |
+
'key' => 'field_acfe_form_field_groups_rules',
|
78 |
+
'label' => 'Field groups locations rules',
|
79 |
+
'name' => 'acfe_form_field_groups_rules',
|
80 |
+
'type' => 'true_false',
|
81 |
+
'instructions' => 'Apply field groups locations rules for front-end display',
|
82 |
+
'required' => 0,
|
83 |
+
'conditional_logic' => 0,
|
84 |
+
'wrapper' => array(
|
85 |
+
'width' => '',
|
86 |
+
'class' => '',
|
87 |
+
'id' => '',
|
88 |
+
),
|
89 |
+
'acfe_permissions' => '',
|
90 |
+
'message' => '',
|
91 |
+
'default_value' => 0,
|
92 |
+
'ui' => 1,
|
93 |
+
'ui_on_text' => '',
|
94 |
+
'ui_off_text' => '',
|
95 |
+
),
|
96 |
array(
|
97 |
'key' => 'field_acfe_form_form_element',
|
98 |
'label' => 'Form element',
|
120 |
'type' => 'group',
|
121 |
'instructions' => 'Form class and id',
|
122 |
'required' => 0,
|
|
|
123 |
'wrapper' => array(
|
124 |
'width' => '',
|
125 |
'class' => '',
|
232 |
'type' => 'group',
|
233 |
'instructions' => 'Add class to all fields',
|
234 |
'required' => 0,
|
|
|
235 |
'wrapper' => array(
|
236 |
'width' => '',
|
237 |
'class' => '',
|
286 |
),
|
287 |
),
|
288 |
array(
|
289 |
+
'key' => 'field_acfe_form_custom_html_enable',
|
290 |
+
'label' => 'Override Form render',
|
291 |
+
'name' => 'acfe_form_custom_html_enable',
|
292 |
+
'type' => 'true_false',
|
293 |
+
'instructions' => 'Override the native field groups HTML render',
|
294 |
'required' => 0,
|
295 |
'conditional_logic' => 0,
|
296 |
'wrapper' => array(
|
299 |
'id' => '',
|
300 |
),
|
301 |
'acfe_permissions' => '',
|
302 |
+
'message' => '',
|
303 |
+
'default_value' => false,
|
304 |
+
'ui' => 1,
|
305 |
+
'ui_on_text' => '',
|
306 |
+
'ui_off_text' => '',
|
307 |
),
|
308 |
array(
|
309 |
'key' => 'field_acfe_form_custom_html',
|
310 |
'label' => 'HTML Form render',
|
311 |
'name' => 'acfe_form_custom_html',
|
312 |
'type' => 'acfe_code_editor',
|
313 |
+
'instructions' => 'Render your own customized HTML.<br /><br />
|
314 |
Field groups may be included using <code>{field_group:group_key}</code><br/><code>{field_group:Group title}</code><br/><br/>
|
315 |
Fields may be included using <code>{field:field_key}</code><br/><code>{field:field_name}</code>',
|
316 |
'required' => 0,
|
|
|
317 |
'wrapper' => array(
|
318 |
'width' => '',
|
319 |
'class' => '',
|
324 |
'placeholder' => '',
|
325 |
'maxlength' => '',
|
326 |
'rows' => 12,
|
327 |
+
'conditional_logic' => array(
|
328 |
+
array(
|
329 |
+
array(
|
330 |
+
'field' => 'field_acfe_form_custom_html_enable',
|
331 |
+
'operator' => '==',
|
332 |
+
'value' => '1',
|
333 |
+
),
|
334 |
+
),
|
335 |
+
),
|
336 |
+
),
|
337 |
+
array(
|
338 |
+
'key' => 'field_acfe_form_html_before_fields',
|
339 |
+
'label' => 'HTML Before render',
|
340 |
+
'name' => 'acfe_form_html_before_fields',
|
341 |
+
'type' => 'acfe_code_editor',
|
342 |
+
'instructions' => 'Extra HTML to add before the fields',
|
343 |
+
'required' => 0,
|
344 |
+
'conditional_logic' => 0,
|
345 |
+
'wrapper' => array(
|
346 |
+
'width' => '',
|
347 |
+
'class' => '',
|
348 |
+
'id' => '',
|
349 |
+
),
|
350 |
+
'acfe_permissions' => '',
|
351 |
+
'default_value' => '',
|
352 |
+
'placeholder' => '',
|
353 |
+
'maxlength' => '',
|
354 |
+
'rows' => 2,
|
355 |
),
|
356 |
array(
|
357 |
'key' => 'field_acfe_form_html_after_fields',
|
474 |
'maxlength' => '',
|
475 |
'rows' => 2,
|
476 |
),
|
477 |
+
|
478 |
+
/*
|
479 |
+
* Validation
|
480 |
+
*/
|
481 |
array(
|
482 |
+
'key' => 'field_acfe_form_tab_validation',
|
483 |
+
'label' => 'Validation',
|
484 |
'name' => '',
|
485 |
'type' => 'tab',
|
486 |
'instructions' => '',
|
515 |
'ui_on_text' => '',
|
516 |
'ui_off_text' => '',
|
517 |
),
|
518 |
+
array(
|
519 |
+
'key' => 'field_acfe_form_hide_revalidation',
|
520 |
+
'label' => 'Hide successful re-validation',
|
521 |
+
'name' => 'acfe_form_hide_revalidation',
|
522 |
+
'type' => 'true_false',
|
523 |
+
'instructions' => 'Hide the successful notice when an error has been thrown',
|
524 |
+
'required' => 0,
|
525 |
+
'conditional_logic' => 0,
|
526 |
+
'wrapper' => array(
|
527 |
+
'width' => '',
|
528 |
+
'class' => '',
|
529 |
+
'id' => '',
|
530 |
+
),
|
531 |
+
'acfe_permissions' => '',
|
532 |
+
'message' => '',
|
533 |
+
'default_value' => 0,
|
534 |
+
'ui' => 1,
|
535 |
+
'ui_on_text' => '',
|
536 |
+
'ui_off_text' => '',
|
537 |
+
),
|
538 |
array(
|
539 |
'key' => 'field_acfe_form_hide_unload',
|
540 |
'label' => 'Hide confirmation on exit',
|
615 |
'append' => '',
|
616 |
'maxlength' => '',
|
617 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
618 |
array(
|
619 |
+
'key' => 'field_acfe_form_validation_advanced_field_validation',
|
620 |
+
'label' => 'PHP Field Validation',
|
621 |
+
'name' => 'acfe_form_validation_advanced_field_validation',
|
622 |
+
'type' => 'acfe_dynamic_message',
|
623 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
624 |
+
'instructions' => 'Native ACF field validation example',
|
625 |
'required' => 0,
|
626 |
'conditional_logic' => 0,
|
627 |
'wrapper' => array(
|
630 |
'id' => '',
|
631 |
),
|
632 |
'acfe_permissions' => '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
633 |
),
|
634 |
array(
|
635 |
+
'key' => 'field_acfe_form_validation_advanced_form_validation',
|
636 |
+
'label' => 'PHP Form Validation',
|
637 |
+
'name' => 'acfe_form_validation_advanced_form_validation',
|
638 |
+
'type' => 'acfe_dynamic_message',
|
639 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
640 |
+
'instructions' => 'Global form validation example',
|
641 |
'required' => 0,
|
642 |
'conditional_logic' => 0,
|
643 |
'wrapper' => array(
|
646 |
'id' => '',
|
647 |
),
|
648 |
'acfe_permissions' => '',
|
|
|
|
|
|
|
|
|
|
|
649 |
),
|
650 |
+
|
651 |
+
/*
|
652 |
+
* Actions
|
653 |
+
*/
|
654 |
array(
|
655 |
'key' => 'field_acfe_form_tab_actions',
|
656 |
'label' => 'Actions',
|
706 |
'label' => 'Custom action',
|
707 |
'display' => 'row',
|
708 |
'sub_fields' => array(
|
709 |
+
|
710 |
+
/*
|
711 |
+
* Layout: Custom Action
|
712 |
+
*/
|
713 |
+
array(
|
714 |
+
'key' => 'field_acfe_form_custom_action_tab_action',
|
715 |
+
'label' => 'Action',
|
716 |
+
'name' => '',
|
717 |
+
'type' => 'tab',
|
718 |
+
'instructions' => '',
|
719 |
+
'required' => 0,
|
720 |
+
'conditional_logic' => 0,
|
721 |
+
'wrapper' => array(
|
722 |
+
'width' => '',
|
723 |
+
'class' => '',
|
724 |
+
'id' => '',
|
725 |
+
),
|
726 |
+
'acfe_permissions' => '',
|
727 |
+
'placement' => 'top',
|
728 |
+
'endpoint' => 0,
|
729 |
+
),
|
730 |
array(
|
731 |
'key' => 'field_acfe_form_custom_action',
|
732 |
'label' => 'Action name',
|
733 |
'name' => 'acfe_form_custom_action',
|
734 |
'type' => 'acfe_slug',
|
735 |
+
'instructions' => 'Set a unique action slug',
|
736 |
'required' => 1,
|
737 |
'conditional_logic' => 0,
|
738 |
'wrapper' => array(
|
747 |
'append' => '',
|
748 |
'maxlength' => '',
|
749 |
),
|
750 |
+
|
751 |
+
/*
|
752 |
+
* Layout: Custom Advanced
|
753 |
+
*/
|
754 |
+
array(
|
755 |
+
'key' => 'field_acfe_form_custom_action_tab_advanced',
|
756 |
+
'label' => 'Advanced',
|
757 |
+
'name' => '',
|
758 |
+
'type' => 'tab',
|
759 |
+
'instructions' => '',
|
760 |
+
'required' => 0,
|
761 |
+
'conditional_logic' => 0,
|
762 |
+
'wrapper' => array(
|
763 |
+
'width' => '',
|
764 |
+
'class' => '',
|
765 |
+
'id' => '',
|
766 |
+
),
|
767 |
+
'acfe_permissions' => '',
|
768 |
+
'placement' => 'top',
|
769 |
+
'endpoint' => 0,
|
770 |
+
),
|
771 |
+
array(
|
772 |
+
'key' => 'field_acfe_form_custom_action_advanced_load',
|
773 |
+
'label' => 'Change form settings before rendering',
|
774 |
+
'name' => 'acfe_form_custom_action_advanced_load',
|
775 |
+
'type' => 'acfe_dynamic_message',
|
776 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
777 |
+
'instructions' => '',
|
778 |
+
'required' => 0,
|
779 |
+
'conditional_logic' => 0,
|
780 |
+
'wrapper' => array(
|
781 |
+
'width' => '',
|
782 |
+
'class' => '',
|
783 |
+
'id' => '',
|
784 |
+
),
|
785 |
+
'acfe_permissions' => '',
|
786 |
+
),
|
787 |
+
array(
|
788 |
+
'key' => 'field_acfe_form_custom_action_advanced_validation',
|
789 |
+
'label' => 'Add custom validation on submission',
|
790 |
+
'name' => 'acfe_form_custom_action_advanced_validation',
|
791 |
+
'type' => 'acfe_dynamic_message',
|
792 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
793 |
+
'instructions' => '',
|
794 |
+
'required' => 0,
|
795 |
+
'conditional_logic' => 0,
|
796 |
+
'wrapper' => array(
|
797 |
+
'width' => '',
|
798 |
+
'class' => '',
|
799 |
+
'id' => '',
|
800 |
+
),
|
801 |
+
'acfe_permissions' => '',
|
802 |
+
),
|
803 |
+
array(
|
804 |
+
'key' => 'field_acfe_form_custom_action_advanced_submit',
|
805 |
+
'label' => 'Add custom action on submission',
|
806 |
+
'name' => 'acfe_form_custom_action_advanced_submit',
|
807 |
+
'type' => 'acfe_dynamic_message',
|
808 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
809 |
+
'instructions' => '',
|
810 |
+
'required' => 0,
|
811 |
+
'conditional_logic' => 0,
|
812 |
+
'wrapper' => array(
|
813 |
+
'width' => '',
|
814 |
+
'class' => '',
|
815 |
+
'id' => '',
|
816 |
+
),
|
817 |
+
'acfe_permissions' => '',
|
818 |
+
),
|
819 |
),
|
820 |
'min' => '',
|
821 |
'max' => '',
|
830 |
'label' => 'Email action',
|
831 |
'display' => 'row',
|
832 |
'sub_fields' => array(
|
833 |
+
|
834 |
+
/*
|
835 |
+
* Layout: Email Action
|
836 |
+
*/
|
837 |
+
array(
|
838 |
+
'key' => 'field_acfe_form_email_tab_action',
|
839 |
+
'label' => 'Action',
|
840 |
+
'name' => '',
|
841 |
+
'type' => 'tab',
|
842 |
+
'instructions' => '',
|
843 |
+
'required' => 0,
|
844 |
+
'conditional_logic' => 0,
|
845 |
+
'wrapper' => array(
|
846 |
+
'width' => '',
|
847 |
+
'class' => '',
|
848 |
+
'id' => '',
|
849 |
+
),
|
850 |
+
'acfe_permissions' => '',
|
851 |
+
'placement' => 'top',
|
852 |
+
'endpoint' => 0,
|
853 |
+
),
|
854 |
array(
|
855 |
'key' => 'field_acfe_form_email_custom_alias',
|
856 |
'label' => 'Action name',
|
871 |
'append' => '',
|
872 |
'maxlength' => '',
|
873 |
),
|
874 |
+
array(
|
875 |
+
'key' => 'field_acfe_form_email_custom_query_var',
|
876 |
+
'label' => 'Query var',
|
877 |
+
'name' => 'acfe_form_custom_query_var',
|
878 |
+
'type' => 'true_false',
|
879 |
+
'instructions' => 'Automatically create a query var with the data of the email that has been sent.<br />Retrieve data using <code>{query_var:my-action:subject}</code> template tags.',
|
880 |
+
'required' => 0,
|
881 |
+
'wrapper' => array(
|
882 |
+
'width' => '',
|
883 |
+
'class' => '',
|
884 |
+
'id' => '',
|
885 |
+
),
|
886 |
+
'acfe_permissions' => '',
|
887 |
+
'message' => '',
|
888 |
+
'default_value' => 0,
|
889 |
+
'ui' => 1,
|
890 |
+
'ui_on_text' => '',
|
891 |
+
'ui_off_text' => '',
|
892 |
+
'conditional_logic' => array(
|
893 |
+
array(
|
894 |
+
array(
|
895 |
+
'field' => 'field_acfe_form_email_custom_alias',
|
896 |
+
'operator' => '!=empty',
|
897 |
+
),
|
898 |
+
),
|
899 |
+
),
|
900 |
+
),
|
901 |
+
|
902 |
+
/*
|
903 |
+
* Layout: Email Send
|
904 |
+
*/
|
905 |
+
array(
|
906 |
+
'key' => 'field_acfe_form_email_tab_email',
|
907 |
+
'label' => 'Email',
|
908 |
+
'name' => '',
|
909 |
+
'type' => 'tab',
|
910 |
+
'instructions' => '',
|
911 |
+
'required' => 0,
|
912 |
+
'conditional_logic' => 0,
|
913 |
+
'wrapper' => array(
|
914 |
+
'width' => '',
|
915 |
+
'class' => '',
|
916 |
+
'id' => '',
|
917 |
+
),
|
918 |
+
'acfe_permissions' => '',
|
919 |
+
'placement' => 'top',
|
920 |
+
'endpoint' => 0,
|
921 |
+
),
|
922 |
array(
|
923 |
'key' => 'field_acfe_form_email_from',
|
924 |
'label' => 'From',
|
939 |
'append' => '',
|
940 |
'maxlength' => '',
|
941 |
),
|
942 |
+
array(
|
943 |
+
'key' => 'field_acfe_form_email_to',
|
944 |
+
'label' => 'To',
|
945 |
+
'name' => 'acfe_form_email_to',
|
946 |
+
'type' => 'text',
|
947 |
+
'instructions' => '',
|
948 |
+
'required' => 1,
|
949 |
+
'conditional_logic' => 0,
|
950 |
+
'wrapper' => array(
|
951 |
+
'width' => '',
|
952 |
+
'class' => '',
|
953 |
+
'id' => '',
|
954 |
+
),
|
955 |
+
'acfe_permissions' => '',
|
956 |
+
'default_value' => '',
|
957 |
+
'placeholder' => 'email@domain.com',
|
958 |
+
'prepend' => '',
|
959 |
+
'append' => '',
|
960 |
+
),
|
961 |
+
array(
|
962 |
+
'key' => 'field_acfe_form_email_reply_to',
|
963 |
+
'label' => 'Reply to',
|
964 |
+
'name' => 'acfe_form_email_reply_to',
|
965 |
+
'type' => 'text',
|
966 |
+
'instructions' => '',
|
967 |
+
'required' => 0,
|
968 |
+
'conditional_logic' => 0,
|
969 |
+
'wrapper' => array(
|
970 |
+
'width' => '',
|
971 |
+
'class' => '',
|
972 |
+
'id' => '',
|
973 |
+
),
|
974 |
+
'acfe_permissions' => '',
|
975 |
+
'default_value' => '',
|
976 |
+
'placeholder' => 'Name <email@domain.com>',
|
977 |
+
'prepend' => '',
|
978 |
+
'append' => '',
|
979 |
+
'maxlength' => '',
|
980 |
+
),
|
981 |
+
array(
|
982 |
+
'key' => 'field_acfe_form_email_cc',
|
983 |
+
'label' => 'Cc',
|
984 |
+
'name' => 'acfe_form_email_cc',
|
985 |
+
'type' => 'text',
|
986 |
+
'instructions' => '',
|
987 |
+
'required' => 0,
|
988 |
+
'conditional_logic' => 0,
|
989 |
+
'wrapper' => array(
|
990 |
+
'width' => '',
|
991 |
+
'class' => '',
|
992 |
+
'id' => '',
|
993 |
+
),
|
994 |
+
'acfe_permissions' => '',
|
995 |
+
'default_value' => '',
|
996 |
+
'placeholder' => 'email@domain.com',
|
997 |
+
'prepend' => '',
|
998 |
+
'append' => '',
|
999 |
+
'maxlength' => '',
|
1000 |
+
),
|
1001 |
+
array(
|
1002 |
+
'key' => 'field_acfe_form_email_bcc',
|
1003 |
+
'label' => 'Bcc',
|
1004 |
+
'name' => 'acfe_form_email_bcc',
|
1005 |
+
'type' => 'text',
|
1006 |
+
'instructions' => '',
|
1007 |
+
'required' => 0,
|
1008 |
+
'conditional_logic' => 0,
|
1009 |
+
'wrapper' => array(
|
1010 |
+
'width' => '',
|
1011 |
+
'class' => '',
|
1012 |
+
'id' => '',
|
1013 |
+
),
|
1014 |
+
'acfe_permissions' => '',
|
1015 |
+
'default_value' => '',
|
1016 |
+
'placeholder' => 'email@domain.com',
|
1017 |
+
'prepend' => '',
|
1018 |
+
'append' => '',
|
1019 |
+
'maxlength' => '',
|
1020 |
+
),
|
1021 |
array(
|
1022 |
+
'key' => 'field_acfe_form_email_subject',
|
1023 |
+
'label' => 'Subject',
|
1024 |
+
'name' => 'acfe_form_email_subject',
|
1025 |
'type' => 'text',
|
1026 |
'instructions' => '',
|
1027 |
'required' => 1,
|
1033 |
),
|
1034 |
'acfe_permissions' => '',
|
1035 |
'default_value' => '',
|
1036 |
+
'placeholder' => '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1037 |
'prepend' => '',
|
1038 |
'append' => '',
|
1039 |
'maxlength' => '',
|
1043 |
'label' => 'Content',
|
1044 |
'name' => 'acfe_form_email_content',
|
1045 |
'type' => 'wysiwyg',
|
1046 |
+
'instructions' => 'Fields values may be included using <code>{field:field_key}</code> <code>{field:title}</code>. All fields may be included using <code>{fields}</code>.<br />See "Cheatsheet" tab for advanced usage.',
|
1047 |
'required' => 1,
|
1048 |
'conditional_logic' => 0,
|
1049 |
'wrapper' => array(
|
1058 |
'media_upload' => 1,
|
1059 |
'delay' => 0,
|
1060 |
),
|
1061 |
+
|
1062 |
+
/*
|
1063 |
+
* Layout: Email Attachments
|
1064 |
+
*/
|
1065 |
+
array(
|
1066 |
+
'key' => 'field_acfe_form_email_tab_attachments',
|
1067 |
+
'label' => 'Attachments',
|
1068 |
+
'name' => '',
|
1069 |
+
'type' => 'tab',
|
1070 |
+
'instructions' => '',
|
1071 |
+
'required' => 0,
|
1072 |
+
'conditional_logic' => 0,
|
1073 |
+
'wrapper' => array(
|
1074 |
+
'width' => '',
|
1075 |
+
'class' => '',
|
1076 |
+
'id' => '',
|
1077 |
+
),
|
1078 |
+
'acfe_permissions' => '',
|
1079 |
+
'placement' => 'top',
|
1080 |
+
'endpoint' => 0,
|
1081 |
+
),
|
1082 |
array(
|
1083 |
'key' => 'field_acfe_form_email_files',
|
1084 |
+
'label' => 'Dynamic files',
|
1085 |
'name' => 'acfe_form_email_files',
|
1086 |
'type' => 'repeater',
|
1087 |
'instructions' => '',
|
1120 |
),
|
1121 |
'allow_null' => 0,
|
1122 |
'multiple' => 0,
|
1123 |
+
'ui' => 1,
|
1124 |
'return_format' => 'value',
|
1125 |
'ajax' => 0,
|
1126 |
'placeholder' => '',
|
1127 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
1128 |
+
'allow_custom' => 1,
|
1129 |
),
|
1130 |
+
array(
|
1131 |
+
'key' => 'field_acfe_form_email_file_delete',
|
1132 |
+
'label' => 'Delete file',
|
1133 |
+
'name' => 'acfe_form_email_file_delete',
|
1134 |
+
'type' => 'true_false',
|
1135 |
+
'instructions' => '',
|
1136 |
+
'required' => 0,
|
1137 |
+
'wrapper' => array(
|
1138 |
+
'width' => '',
|
1139 |
+
'class' => '',
|
1140 |
+
'id' => '',
|
1141 |
+
),
|
1142 |
+
'acfe_permissions' => '',
|
1143 |
+
'message' => 'Delete once submitted',
|
1144 |
+
'default_value' => 0,
|
1145 |
+
'ui' => 1,
|
1146 |
+
'ui_on_text' => '',
|
1147 |
+
'ui_off_text' => '',
|
1148 |
+
),
|
1149 |
),
|
1150 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1151 |
array(
|
1152 |
+
'key' => 'field_acfe_form_email_files_static',
|
1153 |
+
'label' => 'Static files',
|
1154 |
+
'name' => 'acfe_form_email_files_static',
|
1155 |
+
'type' => 'repeater',
|
1156 |
'instructions' => '',
|
1157 |
'required' => 0,
|
1158 |
'conditional_logic' => 0,
|
1162 |
'id' => '',
|
1163 |
),
|
1164 |
'acfe_permissions' => '',
|
1165 |
+
'acfe_repeater_stylised_button' => 0,
|
1166 |
+
'collapsed' => '',
|
1167 |
+
'min' => 0,
|
1168 |
+
'max' => 0,
|
1169 |
+
'layout' => 'table',
|
1170 |
+
'button_label' => 'Add file',
|
1171 |
'sub_fields' => array(
|
1172 |
array(
|
1173 |
+
'key' => 'field_acfe_form_email_file_static',
|
1174 |
+
'label' => 'File',
|
1175 |
+
'name' => 'acfe_form_email_file_static',
|
1176 |
+
'type' => 'file',
|
1177 |
'instructions' => '',
|
1178 |
'required' => 0,
|
1179 |
'conditional_logic' => 0,
|
1183 |
'id' => '',
|
1184 |
),
|
1185 |
'acfe_permissions' => '',
|
1186 |
+
'return_format' => 'id',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1187 |
),
|
1188 |
),
|
1189 |
),
|
1190 |
+
|
1191 |
+
/*
|
1192 |
+
* Layout: Email Advanced
|
1193 |
+
*/
|
1194 |
+
array(
|
1195 |
+
'key' => 'field_acfe_form_email_tab_advanced',
|
1196 |
+
'label' => 'Advanced',
|
1197 |
+
'name' => '',
|
1198 |
+
'type' => 'tab',
|
1199 |
+
'instructions' => '',
|
1200 |
+
'required' => 0,
|
1201 |
+
'conditional_logic' => 0,
|
1202 |
+
'wrapper' => array(
|
1203 |
+
'width' => '',
|
1204 |
+
'class' => '',
|
1205 |
+
'id' => '',
|
1206 |
+
),
|
1207 |
+
'acfe_permissions' => '',
|
1208 |
+
'placement' => 'top',
|
1209 |
+
'endpoint' => 0,
|
1210 |
+
),
|
1211 |
array(
|
1212 |
+
'key' => 'field_acfe_form_email_advanced_args',
|
1213 |
+
'label' => 'Change email arguments',
|
1214 |
+
'name' => 'acfe_form_email_advanced_args',
|
1215 |
+
'type' => 'acfe_dynamic_message',
|
1216 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
1217 |
+
'instructions' => 'Alter the <code>wp_mail()</code> arguments before it is sent',
|
1218 |
'required' => 0,
|
1219 |
'conditional_logic' => 0,
|
1220 |
'wrapper' => array(
|
1223 |
'id' => '',
|
1224 |
),
|
1225 |
'acfe_permissions' => '',
|
1226 |
+
),
|
1227 |
+
array(
|
1228 |
+
'key' => 'field_acfe_form_email_advanced_send',
|
1229 |
+
'label' => 'Add custom action when e-mail is sent',
|
1230 |
+
'name' => 'form_email_advanced_send',
|
1231 |
+
'type' => 'acfe_dynamic_message',
|
1232 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
1233 |
+
'instructions' => 'This action allows you to hook in after the e-mail has been sent',
|
1234 |
+
'required' => 0,
|
1235 |
+
'conditional_logic' => 0,
|
1236 |
+
'wrapper' => array(
|
1237 |
+
'width' => '',
|
1238 |
+
'class' => '',
|
1239 |
+
'id' => '',
|
1240 |
),
|
1241 |
+
'acfe_permissions' => '',
|
|
|
|
|
|
|
1242 |
),
|
1243 |
),
|
1244 |
'min' => '',
|
1245 |
'max' => '',
|
1246 |
),
|
|
|
1247 |
|
1248 |
/*
|
1249 |
* Layout: Post
|
1254 |
'label' => 'Post action',
|
1255 |
'display' => 'row',
|
1256 |
'sub_fields' => array(
|
1257 |
+
|
1258 |
+
/*
|
1259 |
+
* Layout: Post Action
|
1260 |
+
*/
|
1261 |
array(
|
1262 |
+
'key' => 'field_acfe_form_post_tab_action',
|
1263 |
+
'label' => 'Action',
|
1264 |
'name' => '',
|
1265 |
'type' => 'tab',
|
1266 |
'instructions' => '',
|
1320 |
'append' => '',
|
1321 |
'maxlength' => '',
|
1322 |
),
|
1323 |
+
array(
|
1324 |
'key' => 'field_acfe_form_post_custom_query_var',
|
1325 |
'label' => 'Query var',
|
1326 |
'name' => 'acfe_form_custom_query_var',
|
1327 |
'type' => 'true_false',
|
1328 |
'instructions' => 'Automatically create a query var with the data of the post that has been created/updated.<br />Retrieve data using <code>{query_var:my-action:post_title}</code> <code>{query_var:my-action:permalink}</code> template tags.',
|
1329 |
'required' => 0,
|
|
|
1330 |
'wrapper' => array(
|
1331 |
'width' => '',
|
1332 |
'class' => '',
|
1338 |
'ui' => 1,
|
1339 |
'ui_on_text' => '',
|
1340 |
'ui_off_text' => '',
|
1341 |
+
'conditional_logic' => array(
|
1342 |
array(
|
1343 |
array(
|
1344 |
'field' => 'field_acfe_form_post_custom_alias',
|
1347 |
),
|
1348 |
),
|
1349 |
),
|
1350 |
+
|
1351 |
+
/*
|
1352 |
+
* Layout: Post Save
|
1353 |
+
*/
|
1354 |
+
array(
|
1355 |
+
'key' => 'field_acfe_form_post_tab_save',
|
1356 |
+
'label' => 'Save',
|
1357 |
+
'name' => '',
|
1358 |
+
'type' => 'tab',
|
1359 |
+
'instructions' => '',
|
1360 |
+
'required' => 0,
|
1361 |
+
'conditional_logic' => 0,
|
1362 |
+
'wrapper' => array(
|
1363 |
+
'width' => '',
|
1364 |
+
'class' => '',
|
1365 |
+
'id' => '',
|
1366 |
+
),
|
1367 |
+
'acfe_permissions' => '',
|
1368 |
+
'placement' => 'top',
|
1369 |
+
'endpoint' => 0,
|
1370 |
+
),
|
1371 |
array(
|
1372 |
'key' => 'field_acfe_form_post_save_target',
|
1373 |
'label' => 'Target',
|
1374 |
'name' => 'acfe_form_post_save_target',
|
1375 |
'type' => 'select',
|
1376 |
+
'instructions' => '',
|
1377 |
'required' => 0,
|
1378 |
'conditional_logic' => array(
|
1379 |
array(
|
1392 |
'acfe_permissions' => '',
|
1393 |
'choices' => array(
|
1394 |
),
|
1395 |
+
'default_value' => 'current_post',
|
|
|
|
|
1396 |
'allow_null' => 0,
|
1397 |
'multiple' => 0,
|
1398 |
'ui' => 1,
|
1399 |
+
'ajax' => 0,
|
1400 |
'return_format' => 'value',
|
1401 |
'placeholder' => '',
|
1402 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
1403 |
+
'allow_custom' => 1,
|
1404 |
),
|
1405 |
array(
|
1406 |
'key' => 'field_acfe_form_post_save_post_type',
|
1430 |
'allow_null' => 1,
|
1431 |
'placeholder' => 'Default',
|
1432 |
'multiple' => 0,
|
1433 |
+
'ui' => 1,
|
1434 |
'choices' => array(
|
1435 |
),
|
1436 |
'ajax' => 0,
|
1437 |
'layout' => '',
|
1438 |
'toggle' => 0,
|
1439 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
1440 |
+
'allow_custom' => 1,
|
1441 |
),
|
1442 |
array(
|
1443 |
'key' => 'field_acfe_form_post_map_post_type_message',
|
1489 |
'allow_null' => 1,
|
1490 |
'placeholder' => 'Default',
|
1491 |
'multiple' => 0,
|
1492 |
+
'ui' => 1,
|
1493 |
'choices' => array(
|
1494 |
),
|
1495 |
'ajax' => 0,
|
1496 |
'layout' => '',
|
1497 |
'toggle' => 0,
|
1498 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
1499 |
+
'allow_custom' => 1,
|
1500 |
),
|
1501 |
array(
|
1502 |
'key' => 'field_acfe_form_post_map_post_status_message',
|
1520 |
),
|
1521 |
'acfe_permissions' => '',
|
1522 |
),
|
1523 |
+
|
1524 |
+
array(
|
1525 |
+
'key' => 'field_acfe_form_post_save_post_title',
|
1526 |
+
'label' => 'Post title',
|
1527 |
+
'name' => 'acfe_form_post_save_post_title',
|
1528 |
+
'type' => 'select',
|
1529 |
+
'instructions' => '',
|
1530 |
+
'required' => 0,
|
1531 |
+
'wrapper' => array(
|
1532 |
+
'width' => '',
|
1533 |
+
'class' => '',
|
1534 |
+
'id' => '',
|
1535 |
+
),
|
1536 |
+
'acfe_permissions' => '',
|
1537 |
+
'choices' => array(
|
1538 |
+
'generated_id' => 'Generated ID',
|
1539 |
+
),
|
1540 |
+
'default_value' => array(
|
1541 |
+
),
|
1542 |
+
'allow_null' => 1,
|
1543 |
+
'multiple' => 0,
|
1544 |
+
'ui' => 1,
|
1545 |
+
'return_format' => 'value',
|
1546 |
+
'placeholder' => 'Default',
|
1547 |
+
'ajax' => 0,
|
1548 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
1549 |
+
'allow_custom' => 1,
|
1550 |
+
'conditional_logic' => array(
|
1551 |
+
array(
|
1552 |
+
array(
|
1553 |
+
'field' => 'field_acfe_form_post_map_post_title',
|
1554 |
+
'operator' => '==empty',
|
1555 |
+
),
|
1556 |
+
),
|
1557 |
+
),
|
1558 |
+
),
|
1559 |
+
|
1560 |
array(
|
1561 |
+
'key' => 'field_acfe_form_post_map_post_title_message',
|
1562 |
'label' => 'Post title',
|
1563 |
+
'name' => 'acfe_form_post_map_post_title_message',
|
1564 |
+
'type' => 'acfe_dynamic_message',
|
1565 |
'instructions' => '',
|
1566 |
'required' => 0,
|
1567 |
'conditional_logic' => array(
|
1568 |
array(
|
1569 |
array(
|
1570 |
'field' => 'field_acfe_form_post_map_post_title',
|
1571 |
+
'operator' => '!=empty',
|
1572 |
),
|
1573 |
),
|
1574 |
),
|
1578 |
'id' => '',
|
1579 |
),
|
1580 |
'acfe_permissions' => '',
|
1581 |
+
),
|
1582 |
+
array(
|
1583 |
+
'key' => 'field_acfe_form_post_save_post_name',
|
1584 |
+
'label' => 'Post slug',
|
1585 |
+
'name' => 'acfe_form_post_save_post_name',
|
1586 |
+
'type' => 'select',
|
1587 |
+
'instructions' => '',
|
1588 |
+
'required' => 0,
|
1589 |
+
'wrapper' => array(
|
1590 |
+
'width' => '',
|
1591 |
+
'class' => '',
|
1592 |
+
'id' => '',
|
1593 |
+
),
|
1594 |
+
'acfe_permissions' => '',
|
1595 |
+
'choices' => array(
|
1596 |
+
'generated_id' => 'Generated ID',
|
1597 |
+
),
|
1598 |
+
'default_value' => array(
|
1599 |
+
),
|
1600 |
+
'allow_null' => 1,
|
1601 |
+
'multiple' => 0,
|
1602 |
+
'ui' => 1,
|
1603 |
+
'return_format' => 'value',
|
1604 |
+
'placeholder' => 'Default',
|
1605 |
+
'ajax' => 0,
|
1606 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
1607 |
+
'allow_custom' => 1,
|
1608 |
+
'conditional_logic' => array(
|
|
|
|
|
|
|
1609 |
array(
|
1610 |
+
array(
|
1611 |
+
'field' => 'field_acfe_form_post_map_post_name',
|
1612 |
+
'operator' => '==empty',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1613 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
1614 |
),
|
1615 |
),
|
1616 |
+
),
|
1617 |
+
|
1618 |
array(
|
1619 |
+
'key' => 'field_acfe_form_post_map_post_name_message',
|
1620 |
+
'label' => 'Post slug',
|
1621 |
+
'name' => 'acfe_form_post_map_post_name_message',
|
1622 |
'type' => 'acfe_dynamic_message',
|
1623 |
'instructions' => '',
|
1624 |
'required' => 0,
|
1625 |
'conditional_logic' => array(
|
1626 |
array(
|
1627 |
array(
|
1628 |
+
'field' => 'field_acfe_form_post_map_post_name',
|
1629 |
'operator' => '!=empty',
|
1630 |
),
|
1631 |
),
|
1638 |
'acfe_permissions' => '',
|
1639 |
),
|
1640 |
array(
|
1641 |
+
'key' => 'field_acfe_form_post_save_post_content_group',
|
1642 |
+
'label' => 'Post content',
|
1643 |
+
'name' => 'acfe_form_post_save_post_content_group',
|
1644 |
'type' => 'group',
|
1645 |
'instructions' => '',
|
1646 |
'required' => 0,
|
1647 |
'conditional_logic' => array(
|
1648 |
array(
|
1649 |
array(
|
1650 |
+
'field' => 'field_acfe_form_post_map_post_content',
|
1651 |
'operator' => '==empty',
|
1652 |
),
|
1653 |
),
|
1663 |
'acfe_group_modal' => 0,
|
1664 |
'sub_fields' => array(
|
1665 |
array(
|
1666 |
+
'key' => 'field_acfe_form_post_save_post_content',
|
1667 |
'label' => '',
|
1668 |
+
'name' => 'acfe_form_post_save_post_content',
|
1669 |
'type' => 'select',
|
1670 |
'instructions' => '',
|
1671 |
'required' => 0,
|
1677 |
),
|
1678 |
'acfe_permissions' => '',
|
1679 |
'choices' => array(
|
1680 |
+
'custom' => 'WYSIWYG editor',
|
|
|
1681 |
),
|
1682 |
'default_value' => array(
|
1683 |
),
|
1684 |
'allow_null' => 1,
|
1685 |
'multiple' => 0,
|
1686 |
+
'ui' => 1,
|
1687 |
'return_format' => 'value',
|
1688 |
'placeholder' => 'Default',
|
1689 |
'ajax' => 0,
|
1690 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
1691 |
+
'allow_custom' => 1,
|
1692 |
),
|
1693 |
array(
|
1694 |
+
'key' => 'field_acfe_form_post_save_post_content_custom',
|
1695 |
'label' => '',
|
1696 |
+
'name' => 'acfe_form_post_save_post_content_custom',
|
1697 |
+
'type' => 'wysiwyg',
|
1698 |
'instructions' => '',
|
1699 |
+
'required' => 0,
|
1700 |
'conditional_logic' => array(
|
1701 |
array(
|
1702 |
array(
|
1703 |
+
'field' => 'field_acfe_form_post_save_post_content',
|
1704 |
'operator' => '==',
|
1705 |
'value' => 'custom',
|
1706 |
),
|
1713 |
),
|
1714 |
'acfe_permissions' => '',
|
1715 |
'default_value' => '',
|
1716 |
+
'tabs' => 'all',
|
1717 |
+
'toolbar' => 'full',
|
1718 |
+
'media_upload' => 1,
|
1719 |
+
'delay' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1720 |
),
|
1721 |
),
|
1722 |
),
|
1770 |
'allow_null' => 1,
|
1771 |
'multiple' => 0,
|
1772 |
'ui' => 1,
|
1773 |
+
'ajax' => 0,
|
1774 |
'return_format' => 'value',
|
1775 |
'placeholder' => 'Default',
|
1776 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
1777 |
+
'allow_custom' => 1,
|
1778 |
),
|
1779 |
array(
|
1780 |
'key' => 'field_acfe_form_post_map_post_author_message',
|
1826 |
'allow_null' => 1,
|
1827 |
'multiple' => 0,
|
1828 |
'ui' => 1,
|
1829 |
+
'ajax' => 0,
|
1830 |
'return_format' => 'value',
|
1831 |
+
'placeholder' => 'Default',
|
1832 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
1833 |
+
'allow_custom' => 1,
|
1834 |
),
|
1835 |
array(
|
1836 |
'key' => 'field_acfe_form_post_map_post_parent_message',
|
1878 |
'taxonomy' => '',
|
1879 |
'field_type' => 'select',
|
1880 |
'default_value' => '',
|
1881 |
+
'return_format' => 'id',
|
1882 |
'allow_null' => 1,
|
1883 |
+
'placeholder' => 'Default',
|
1884 |
'multiple' => 1,
|
1885 |
'ui' => 1,
|
1886 |
'ajax' => 0,
|
1888 |
),
|
1889 |
'layout' => '',
|
1890 |
'toggle' => 0,
|
1891 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
1892 |
+
'allow_custom' => 1,
|
1893 |
),
|
1894 |
array(
|
1895 |
'key' => 'field_acfe_form_post_map_post_terms_message',
|
1915 |
),
|
1916 |
array(
|
1917 |
'key' => 'field_acfe_form_post_save_meta',
|
1918 |
+
'label' => 'Save ACF fields',
|
1919 |
'name' => 'acfe_form_post_save_meta',
|
1920 |
'type' => 'checkbox',
|
1921 |
'instructions' => 'Choose which ACF fields should be saved to this post',
|
1937 |
'return_format' => 'value',
|
1938 |
'save_custom' => 0,
|
1939 |
),
|
1940 |
+
|
1941 |
+
/*
|
1942 |
+
* Layout: Post Load
|
1943 |
+
*/
|
1944 |
array(
|
1945 |
'key' => 'acfe_form_post_tab_load',
|
1946 |
'label' => 'Load',
|
1980 |
),
|
1981 |
array(
|
1982 |
'key' => 'field_acfe_form_post_load_source',
|
1983 |
+
'label' => 'Source',
|
1984 |
'name' => 'acfe_form_post_load_source',
|
1985 |
'type' => 'select',
|
1986 |
+
'instructions' => '',
|
1987 |
'required' => 0,
|
1988 |
'conditional_logic' => array(
|
1989 |
array(
|
2002 |
'acfe_permissions' => '',
|
2003 |
'choices' => array(
|
2004 |
),
|
2005 |
+
'default_value' => 'current_post',
|
|
|
|
|
2006 |
'allow_null' => 0,
|
2007 |
'multiple' => 0,
|
2008 |
'ui' => 1,
|
2009 |
+
'ajax' => 0,
|
2010 |
'return_format' => 'value',
|
2011 |
'placeholder' => '',
|
2012 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2013 |
+
'allow_custom' => 1,
|
2014 |
),
|
2015 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016 |
array(
|
2017 |
'key' => 'field_acfe_form_post_map_post_type',
|
2018 |
'label' => 'Post type',
|
2020 |
'type' => 'select',
|
2021 |
'instructions' => '',
|
2022 |
'required' => 0,
|
|
|
2023 |
'wrapper' => array(
|
2024 |
'width' => '',
|
2025 |
'class' => '',
|
2032 |
),
|
2033 |
'allow_null' => 1,
|
2034 |
'multiple' => 0,
|
2035 |
+
'ui' => 1,
|
2036 |
'return_format' => 'value',
|
2037 |
'placeholder' => 'Default',
|
2038 |
'ajax' => 0,
|
2039 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2040 |
+
'allow_custom' => 1,
|
2041 |
+
'conditional_logic' => array(
|
2042 |
+
array(
|
2043 |
+
array(
|
2044 |
+
'field' => 'field_acfe_form_post_load_values',
|
2045 |
+
'operator' => '==',
|
2046 |
+
'value' => '1',
|
2047 |
+
),
|
2048 |
+
),
|
2049 |
+
),
|
2050 |
),
|
2051 |
array(
|
2052 |
'key' => 'field_acfe_form_post_map_post_status',
|
2055 |
'type' => 'select',
|
2056 |
'instructions' => '',
|
2057 |
'required' => 0,
|
|
|
2058 |
'wrapper' => array(
|
2059 |
'width' => '',
|
2060 |
'class' => '',
|
2067 |
),
|
2068 |
'allow_null' => 1,
|
2069 |
'multiple' => 0,
|
2070 |
+
'ui' => 1,
|
2071 |
'return_format' => 'value',
|
2072 |
'placeholder' => 'Default',
|
2073 |
'ajax' => 0,
|
2074 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2075 |
+
'allow_custom' => 1,
|
2076 |
+
'conditional_logic' => array(
|
2077 |
+
array(
|
2078 |
+
array(
|
2079 |
+
'field' => 'field_acfe_form_post_load_values',
|
2080 |
+
'operator' => '==',
|
2081 |
+
'value' => '1',
|
2082 |
+
),
|
2083 |
+
),
|
2084 |
+
),
|
2085 |
),
|
2086 |
array(
|
2087 |
'key' => 'field_acfe_form_post_map_post_title',
|
2090 |
'type' => 'select',
|
2091 |
'instructions' => '',
|
2092 |
'required' => 0,
|
|
|
2093 |
'wrapper' => array(
|
2094 |
'width' => '',
|
2095 |
'class' => '',
|
2102 |
),
|
2103 |
'allow_null' => 1,
|
2104 |
'multiple' => 0,
|
2105 |
+
'ui' => 1,
|
2106 |
'return_format' => 'value',
|
2107 |
'placeholder' => 'Default',
|
2108 |
'ajax' => 0,
|
2109 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2110 |
+
'allow_custom' => 1,
|
2111 |
+
'conditional_logic' => array(
|
2112 |
+
array(
|
2113 |
+
array(
|
2114 |
+
'field' => 'field_acfe_form_post_load_values',
|
2115 |
+
'operator' => '==',
|
2116 |
+
'value' => '1',
|
2117 |
+
),
|
2118 |
+
),
|
2119 |
+
),
|
2120 |
),
|
2121 |
array(
|
2122 |
'key' => 'field_acfe_form_post_map_post_name',
|
2125 |
'type' => 'select',
|
2126 |
'instructions' => '',
|
2127 |
'required' => 0,
|
|
|
2128 |
'wrapper' => array(
|
2129 |
'width' => '',
|
2130 |
'class' => '',
|
2137 |
),
|
2138 |
'allow_null' => 1,
|
2139 |
'multiple' => 0,
|
2140 |
+
'ui' => 1,
|
2141 |
'return_format' => 'value',
|
2142 |
'placeholder' => 'Default',
|
2143 |
'ajax' => 0,
|
2144 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2145 |
+
'allow_custom' => 1,
|
2146 |
+
'conditional_logic' => array(
|
2147 |
+
array(
|
2148 |
+
array(
|
2149 |
+
'field' => 'field_acfe_form_post_load_values',
|
2150 |
+
'operator' => '==',
|
2151 |
+
'value' => '1',
|
2152 |
+
),
|
2153 |
+
),
|
2154 |
+
),
|
2155 |
),
|
2156 |
array(
|
2157 |
'key' => 'field_acfe_form_post_map_post_content',
|
2160 |
'type' => 'select',
|
2161 |
'instructions' => '',
|
2162 |
'required' => 0,
|
|
|
2163 |
'wrapper' => array(
|
2164 |
'width' => '',
|
2165 |
'class' => '',
|
2172 |
),
|
2173 |
'allow_null' => 1,
|
2174 |
'multiple' => 0,
|
2175 |
+
'ui' => 1,
|
2176 |
'return_format' => 'value',
|
2177 |
'placeholder' => 'Default',
|
2178 |
'ajax' => 0,
|
2179 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2180 |
+
'allow_custom' => 1,
|
2181 |
+
'conditional_logic' => array(
|
2182 |
+
array(
|
2183 |
+
array(
|
2184 |
+
'field' => 'field_acfe_form_post_load_values',
|
2185 |
+
'operator' => '==',
|
2186 |
+
'value' => '1',
|
2187 |
+
),
|
2188 |
+
),
|
2189 |
+
),
|
2190 |
),
|
2191 |
array(
|
2192 |
'key' => 'field_acfe_form_post_map_post_author',
|
2195 |
'type' => 'select',
|
2196 |
'instructions' => '',
|
2197 |
'required' => 0,
|
|
|
2198 |
'wrapper' => array(
|
2199 |
'width' => '',
|
2200 |
'class' => '',
|
2207 |
),
|
2208 |
'allow_null' => 1,
|
2209 |
'multiple' => 0,
|
2210 |
+
'ui' => 1,
|
2211 |
'return_format' => 'value',
|
2212 |
'placeholder' => 'Default',
|
2213 |
'ajax' => 0,
|
2214 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2215 |
+
'allow_custom' => 1,
|
2216 |
+
'conditional_logic' => array(
|
2217 |
+
array(
|
2218 |
+
array(
|
2219 |
+
'field' => 'field_acfe_form_post_load_values',
|
2220 |
+
'operator' => '==',
|
2221 |
+
'value' => '1',
|
2222 |
+
),
|
2223 |
+
),
|
2224 |
+
),
|
2225 |
),
|
2226 |
array(
|
2227 |
'key' => 'field_acfe_form_post_map_post_parent',
|
2230 |
'type' => 'select',
|
2231 |
'instructions' => '',
|
2232 |
'required' => 0,
|
|
|
2233 |
'wrapper' => array(
|
2234 |
'width' => '',
|
2235 |
'class' => '',
|
2242 |
),
|
2243 |
'allow_null' => 1,
|
2244 |
'multiple' => 0,
|
2245 |
+
'ui' => 1,
|
2246 |
'return_format' => 'value',
|
2247 |
'placeholder' => 'Default',
|
2248 |
'ajax' => 0,
|
2249 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2250 |
+
'allow_custom' => 1,
|
2251 |
+
'conditional_logic' => array(
|
2252 |
+
array(
|
2253 |
+
array(
|
2254 |
+
'field' => 'field_acfe_form_post_load_values',
|
2255 |
+
'operator' => '==',
|
2256 |
+
'value' => '1',
|
2257 |
+
),
|
2258 |
+
),
|
2259 |
+
),
|
2260 |
),
|
2261 |
array(
|
2262 |
'key' => 'field_acfe_form_post_map_post_terms',
|
2265 |
'type' => 'select',
|
2266 |
'instructions' => '',
|
2267 |
'required' => 0,
|
|
|
2268 |
'wrapper' => array(
|
2269 |
'width' => '',
|
2270 |
'class' => '',
|
2277 |
),
|
2278 |
'allow_null' => 1,
|
2279 |
'multiple' => 0,
|
2280 |
+
'ui' => 1,
|
2281 |
'return_format' => 'value',
|
2282 |
'placeholder' => 'Default',
|
2283 |
'ajax' => 0,
|
2284 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2285 |
+
'allow_custom' => 1,
|
2286 |
+
'conditional_logic' => array(
|
2287 |
+
array(
|
2288 |
+
array(
|
2289 |
+
'field' => 'field_acfe_form_post_load_values',
|
2290 |
+
'operator' => '==',
|
2291 |
+
'value' => '1',
|
2292 |
+
),
|
2293 |
+
),
|
2294 |
+
),
|
2295 |
),
|
2296 |
+
array(
|
2297 |
+
'key' => 'field_acfe_form_post_load_meta',
|
2298 |
+
'label' => 'Load ACF fields',
|
2299 |
+
'name' => 'acfe_form_post_load_meta',
|
2300 |
+
'type' => 'checkbox',
|
2301 |
+
'instructions' => 'Choose which ACF fields should have their values loaded',
|
2302 |
'required' => 0,
|
2303 |
+
'conditional_logic' => array(
|
2304 |
+
array(
|
2305 |
+
array(
|
2306 |
+
'field' => 'field_acfe_form_post_load_values',
|
2307 |
+
'operator' => '==',
|
2308 |
+
'value' => '1',
|
2309 |
+
),
|
2310 |
+
),
|
2311 |
+
),
|
2312 |
+
'wrapper' => array(
|
2313 |
+
'width' => '',
|
2314 |
+
'class' => '',
|
2315 |
+
'id' => '',
|
2316 |
+
),
|
2317 |
+
'acfe_permissions' => '',
|
2318 |
+
'choices' => array(
|
2319 |
+
),
|
2320 |
+
'allow_custom' => 0,
|
2321 |
+
'default_value' => array(
|
2322 |
+
),
|
2323 |
+
'layout' => 'vertical',
|
2324 |
+
'toggle' => 1,
|
2325 |
+
'return_format' => 'value',
|
2326 |
+
'save_custom' => 0,
|
2327 |
+
),
|
2328 |
+
|
2329 |
+
/*
|
2330 |
+
* Layout: Post Advanced
|
2331 |
+
*/
|
2332 |
+
array(
|
2333 |
+
'key' => 'field_acfe_form_post_tab_advanced',
|
2334 |
+
'label' => 'Advanced',
|
2335 |
+
'name' => '',
|
2336 |
+
'type' => 'tab',
|
2337 |
+
'instructions' => '',
|
2338 |
+
'required' => 0,
|
2339 |
+
'conditional_logic' => 0,
|
2340 |
+
'wrapper' => array(
|
2341 |
+
'width' => '',
|
2342 |
+
'class' => '',
|
2343 |
'id' => '',
|
2344 |
),
|
2345 |
'acfe_permissions' => '',
|
2352 |
'name' => 'acfe_form_post_advanced_load',
|
2353 |
'type' => 'acfe_dynamic_message',
|
2354 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
2355 |
+
'instructions' => 'Alter the post ID where meta values are loaded from',
|
2356 |
'required' => 0,
|
2357 |
'conditional_logic' => 0,
|
2358 |
'wrapper' => array(
|
2368 |
'name' => 'acfe_form_post_advanced_save_args',
|
2369 |
'type' => 'acfe_dynamic_message',
|
2370 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
2371 |
+
'instructions' => 'Alter the post arguments before database insert/update',
|
2372 |
'required' => 0,
|
2373 |
'conditional_logic' => 0,
|
2374 |
'wrapper' => array(
|
2408 |
'label' => 'Term action',
|
2409 |
'display' => 'row',
|
2410 |
'sub_fields' => array(
|
2411 |
+
|
2412 |
+
/*
|
2413 |
+
* Layout: Term Action
|
2414 |
+
*/
|
2415 |
array(
|
2416 |
+
'key' => 'field_acfe_form_term_tab_action',
|
2417 |
+
'label' => 'Action',
|
2418 |
'name' => '',
|
2419 |
'type' => 'tab',
|
2420 |
'instructions' => '',
|
2474 |
'append' => '',
|
2475 |
'maxlength' => '',
|
2476 |
),
|
2477 |
+
array(
|
2478 |
'key' => 'field_acfe_form_term_custom_query_var',
|
2479 |
'label' => 'Query var',
|
2480 |
'name' => 'acfe_form_custom_query_var',
|
2481 |
'type' => 'true_false',
|
2482 |
'instructions' => 'Automatically create a query var with the data of the term that has been created/updated.<br />Retrieve data using <code>{query_var:my-action:name}</code> <code>{query_var:my-action:permalink}</code> template tags.',
|
2483 |
'required' => 0,
|
|
|
2484 |
'wrapper' => array(
|
2485 |
'width' => '',
|
2486 |
'class' => '',
|
2492 |
'ui' => 1,
|
2493 |
'ui_on_text' => '',
|
2494 |
'ui_off_text' => '',
|
2495 |
+
'conditional_logic' => array(
|
2496 |
array(
|
2497 |
array(
|
2498 |
'field' => 'field_acfe_form_term_custom_alias',
|
2501 |
),
|
2502 |
),
|
2503 |
),
|
2504 |
+
|
2505 |
+
/*
|
2506 |
+
* Layout: Term Save
|
2507 |
+
*/
|
2508 |
+
array(
|
2509 |
+
'key' => 'field_acfe_form_term_tab_save',
|
2510 |
+
'label' => 'Save',
|
2511 |
+
'name' => '',
|
2512 |
+
'type' => 'tab',
|
2513 |
+
'instructions' => '',
|
2514 |
+
'required' => 0,
|
2515 |
+
'conditional_logic' => 0,
|
2516 |
+
'wrapper' => array(
|
2517 |
+
'width' => '',
|
2518 |
+
'class' => '',
|
2519 |
+
'id' => '',
|
2520 |
+
),
|
2521 |
+
'acfe_permissions' => '',
|
2522 |
+
'placement' => 'top',
|
2523 |
+
'endpoint' => 0,
|
2524 |
+
),
|
2525 |
array(
|
2526 |
'key' => 'field_acfe_form_term_save_target',
|
2527 |
'label' => 'Target',
|
2528 |
'name' => 'acfe_form_term_save_target',
|
2529 |
'type' => 'select',
|
2530 |
+
'instructions' => '',
|
2531 |
'required' => 0,
|
2532 |
'conditional_logic' => array(
|
2533 |
array(
|
2546 |
'acfe_permissions' => '',
|
2547 |
'choices' => array(
|
2548 |
),
|
2549 |
+
'default_value' => 'current_term',
|
|
|
|
|
2550 |
'allow_null' => 0,
|
2551 |
'multiple' => 0,
|
2552 |
'ui' => 1,
|
2553 |
+
'ajax' => 0,
|
2554 |
'return_format' => 'value',
|
2555 |
'placeholder' => '',
|
2556 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2557 |
+
'allow_custom' => 1,
|
2558 |
),
|
2559 |
+
array(
|
2560 |
+
'key' => 'field_acfe_form_term_save_name',
|
2561 |
+
'label' => 'Name',
|
2562 |
+
'name' => 'acfe_form_term_save_name',
|
2563 |
+
'type' => 'select',
|
2564 |
+
'instructions' => '',
|
2565 |
+
'required' => 0,
|
2566 |
+
'wrapper' => array(
|
2567 |
+
'width' => '',
|
2568 |
+
'class' => '',
|
2569 |
+
'id' => '',
|
2570 |
+
),
|
2571 |
+
'acfe_permissions' => '',
|
2572 |
+
'choices' => array(),
|
2573 |
+
'default_value' => array(
|
2574 |
+
),
|
2575 |
+
'allow_null' => 1,
|
2576 |
+
'multiple' => 0,
|
2577 |
+
'ui' => 1,
|
2578 |
+
'return_format' => 'value',
|
2579 |
+
'placeholder' => 'Default',
|
2580 |
+
'ajax' => 0,
|
2581 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2582 |
+
'allow_custom' => 1,
|
2583 |
+
'conditional_logic' => array(
|
2584 |
array(
|
2585 |
array(
|
2586 |
'field' => 'field_acfe_form_term_map_name',
|
2588 |
),
|
2589 |
),
|
2590 |
),
|
2591 |
+
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2592 |
array(
|
2593 |
'key' => 'field_acfe_form_term_map_name_message',
|
2594 |
'label' => 'Name',
|
2611 |
),
|
2612 |
'acfe_permissions' => '',
|
2613 |
),
|
2614 |
+
array(
|
2615 |
+
'key' => 'field_acfe_form_term_save_slug',
|
2616 |
+
'label' => 'Slug',
|
2617 |
+
'name' => 'acfe_form_term_save_slug',
|
2618 |
+
'type' => 'select',
|
2619 |
+
'instructions' => '',
|
2620 |
+
'required' => 0,
|
2621 |
+
'wrapper' => array(
|
2622 |
+
'width' => '',
|
2623 |
+
'class' => '',
|
2624 |
+
'id' => '',
|
2625 |
+
),
|
2626 |
+
'acfe_permissions' => '',
|
2627 |
+
'choices' => array(),
|
2628 |
+
'default_value' => array(
|
2629 |
+
),
|
2630 |
+
'allow_null' => 1,
|
2631 |
+
'multiple' => 0,
|
2632 |
+
'ui' => 1,
|
2633 |
+
'return_format' => 'value',
|
2634 |
+
'placeholder' => 'Default',
|
2635 |
+
'ajax' => 0,
|
2636 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2637 |
+
'allow_custom' => 1,
|
2638 |
+
'conditional_logic' => array(
|
2639 |
array(
|
2640 |
array(
|
2641 |
'field' => 'field_acfe_form_term_map_slug',
|
2643 |
),
|
2644 |
),
|
2645 |
),
|
2646 |
+
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2647 |
array(
|
2648 |
'key' => 'field_acfe_form_term_map_slug_message',
|
2649 |
'label' => 'Slug',
|
2694 |
'allow_null' => 1,
|
2695 |
'placeholder' => 'Default',
|
2696 |
'multiple' => 0,
|
2697 |
+
'ui' => 1,
|
2698 |
'choices' => array(
|
2699 |
),
|
2700 |
'ajax' => 0,
|
2701 |
'layout' => '',
|
2702 |
'toggle' => 0,
|
2703 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2704 |
+
'allow_custom' => 1,
|
2705 |
),
|
2706 |
array(
|
2707 |
'key' => 'field_acfe_form_term_map_taxonomy_message',
|
2753 |
'allow_null' => 1,
|
2754 |
'multiple' => 0,
|
2755 |
'ui' => 1,
|
2756 |
+
'ajax' => 0,
|
2757 |
'return_format' => 'value',
|
2758 |
'placeholder' => 'Default',
|
2759 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2760 |
+
'allow_custom' => 1,
|
2761 |
),
|
2762 |
array(
|
2763 |
'key' => 'field_acfe_form_term_map_parent_message',
|
2821 |
),
|
2822 |
'acfe_permissions' => '',
|
2823 |
'choices' => array(
|
2824 |
+
'custom' => 'WYSIWYG Editor',
|
2825 |
),
|
2826 |
'default_value' => array(
|
2827 |
),
|
2828 |
'allow_null' => 1,
|
2829 |
'multiple' => 0,
|
2830 |
+
'ui' => 1,
|
2831 |
'return_format' => 'value',
|
2832 |
'placeholder' => 'Default',
|
2833 |
'ajax' => 0,
|
2834 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2835 |
+
'allow_custom' => 1,
|
2836 |
),
|
2837 |
array(
|
2838 |
'key' => 'field_acfe_form_term_save_description_custom',
|
2888 |
),
|
2889 |
array(
|
2890 |
'key' => 'field_acfe_form_term_save_meta',
|
2891 |
+
'label' => 'Save ACF fields',
|
2892 |
'name' => 'acfe_form_term_save_meta',
|
2893 |
'type' => 'checkbox',
|
2894 |
'instructions' => 'Choose which ACF fields should be saved to this term',
|
2910 |
'return_format' => 'value',
|
2911 |
'save_custom' => 0,
|
2912 |
),
|
2913 |
+
|
2914 |
+
/*
|
2915 |
+
* Layout: Term Load
|
2916 |
+
*/
|
2917 |
array(
|
2918 |
'key' => 'field_acfe_form_term_tab_load',
|
2919 |
'label' => 'Load',
|
2953 |
),
|
2954 |
array(
|
2955 |
'key' => 'field_acfe_form_term_load_source',
|
2956 |
+
'label' => 'Source',
|
2957 |
'name' => 'acfe_form_term_load_source',
|
2958 |
'type' => 'select',
|
2959 |
+
'instructions' => '',
|
2960 |
'required' => 0,
|
2961 |
'conditional_logic' => array(
|
2962 |
array(
|
2975 |
'acfe_permissions' => '',
|
2976 |
'choices' => array(
|
2977 |
),
|
2978 |
+
'default_value' => 'current_term',
|
|
|
|
|
2979 |
'allow_null' => 0,
|
2980 |
'multiple' => 0,
|
2981 |
'ui' => 1,
|
2982 |
+
'ajax' => 0,
|
2983 |
'return_format' => 'value',
|
2984 |
'placeholder' => '',
|
2985 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
2986 |
+
'allow_custom' => 1,
|
2987 |
),
|
2988 |
array(
|
2989 |
+
'key' => 'field_acfe_form_term_map_name',
|
2990 |
+
'label' => 'Name',
|
2991 |
+
'name' => 'acfe_form_term_map_name',
|
2992 |
+
'type' => 'select',
|
2993 |
+
'instructions' => '',
|
2994 |
'required' => 0,
|
2995 |
+
'wrapper' => array(
|
2996 |
+
'width' => '',
|
2997 |
+
'class' => '',
|
2998 |
+
'id' => '',
|
2999 |
+
),
|
3000 |
+
'acfe_permissions' => '',
|
3001 |
+
'choices' => array(
|
3002 |
+
),
|
3003 |
+
'default_value' => array(
|
3004 |
+
),
|
3005 |
+
'allow_null' => 1,
|
3006 |
+
'multiple' => 0,
|
3007 |
+
'ui' => 1,
|
3008 |
+
'return_format' => 'value',
|
3009 |
+
'placeholder' => 'Default',
|
3010 |
+
'ajax' => 0,
|
3011 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3012 |
+
'allow_custom' => 1,
|
3013 |
'conditional_logic' => array(
|
3014 |
array(
|
3015 |
array(
|
3019 |
),
|
3020 |
),
|
3021 |
),
|
3022 |
+
),
|
3023 |
+
array(
|
3024 |
+
'key' => 'field_acfe_form_term_map_slug',
|
3025 |
+
'label' => 'Slug',
|
3026 |
+
'name' => 'acfe_form_term_map_slug',
|
3027 |
+
'type' => 'select',
|
3028 |
+
'instructions' => '',
|
3029 |
+
'required' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3030 |
'wrapper' => array(
|
3031 |
'width' => '',
|
3032 |
'class' => '',
|
3039 |
),
|
3040 |
'allow_null' => 1,
|
3041 |
'multiple' => 0,
|
3042 |
+
'ui' => 1,
|
3043 |
'return_format' => 'value',
|
3044 |
'placeholder' => 'Default',
|
3045 |
'ajax' => 0,
|
3046 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3047 |
+
'allow_custom' => 1,
|
3048 |
+
'conditional_logic' => array(
|
3049 |
+
array(
|
3050 |
+
array(
|
3051 |
+
'field' => 'field_acfe_form_term_load_values',
|
3052 |
+
'operator' => '==',
|
3053 |
+
'value' => '1',
|
3054 |
+
),
|
3055 |
+
),
|
3056 |
+
),
|
3057 |
),
|
3058 |
array(
|
3059 |
+
'key' => 'field_acfe_form_term_map_taxonomy',
|
3060 |
+
'label' => 'Taxonomy',
|
3061 |
+
'name' => 'acfe_form_term_map_taxonomy',
|
3062 |
'type' => 'select',
|
3063 |
'instructions' => '',
|
3064 |
'required' => 0,
|
|
|
3065 |
'wrapper' => array(
|
3066 |
'width' => '',
|
3067 |
'class' => '',
|
3074 |
),
|
3075 |
'allow_null' => 1,
|
3076 |
'multiple' => 0,
|
3077 |
+
'ui' => 1,
|
3078 |
'return_format' => 'value',
|
3079 |
'placeholder' => 'Default',
|
3080 |
'ajax' => 0,
|
3081 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3082 |
+
'allow_custom' => 1,
|
3083 |
+
'conditional_logic' => array(
|
3084 |
+
array(
|
3085 |
+
array(
|
3086 |
+
'field' => 'field_acfe_form_term_load_values',
|
3087 |
+
'operator' => '==',
|
3088 |
+
'value' => '1',
|
3089 |
+
),
|
3090 |
+
),
|
3091 |
+
),
|
3092 |
),
|
3093 |
array(
|
3094 |
+
'key' => 'field_acfe_form_term_map_parent',
|
3095 |
+
'label' => 'Parent',
|
3096 |
+
'name' => 'acfe_form_term_map_parent',
|
3097 |
'type' => 'select',
|
3098 |
'instructions' => '',
|
3099 |
'required' => 0,
|
|
|
3100 |
'wrapper' => array(
|
3101 |
'width' => '',
|
3102 |
'class' => '',
|
3109 |
),
|
3110 |
'allow_null' => 1,
|
3111 |
'multiple' => 0,
|
3112 |
+
'ui' => 1,
|
3113 |
'return_format' => 'value',
|
3114 |
'placeholder' => 'Default',
|
3115 |
'ajax' => 0,
|
3116 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3117 |
+
'allow_custom' => 1,
|
3118 |
+
'conditional_logic' => array(
|
3119 |
+
array(
|
3120 |
+
array(
|
3121 |
+
'field' => 'field_acfe_form_term_load_values',
|
3122 |
+
'operator' => '==',
|
3123 |
+
'value' => '1',
|
3124 |
+
),
|
3125 |
+
),
|
3126 |
+
),
|
3127 |
),
|
3128 |
array(
|
3129 |
+
'key' => 'field_acfe_form_term_map_description',
|
3130 |
+
'label' => 'Description',
|
3131 |
+
'name' => 'acfe_form_term_map_description',
|
3132 |
'type' => 'select',
|
3133 |
'instructions' => '',
|
3134 |
'required' => 0,
|
|
|
3135 |
'wrapper' => array(
|
3136 |
'width' => '',
|
3137 |
'class' => '',
|
3144 |
),
|
3145 |
'allow_null' => 1,
|
3146 |
'multiple' => 0,
|
3147 |
+
'ui' => 1,
|
3148 |
'return_format' => 'value',
|
3149 |
'placeholder' => 'Default',
|
3150 |
'ajax' => 0,
|
3151 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3152 |
+
'allow_custom' => 1,
|
3153 |
+
'conditional_logic' => array(
|
3154 |
+
array(
|
3155 |
+
array(
|
3156 |
+
'field' => 'field_acfe_form_term_load_values',
|
3157 |
+
'operator' => '==',
|
3158 |
+
'value' => '1',
|
3159 |
+
),
|
3160 |
+
),
|
3161 |
+
),
|
3162 |
),
|
3163 |
array(
|
3164 |
+
'key' => 'field_acfe_form_term_load_meta',
|
3165 |
+
'label' => 'Load ACF fields',
|
3166 |
+
'name' => 'acfe_form_term_load_meta',
|
3167 |
+
'type' => 'checkbox',
|
3168 |
+
'instructions' => 'Choose which ACF fields should have their values loaded',
|
3169 |
'required' => 0,
|
3170 |
+
'conditional_logic' => array(
|
3171 |
+
array(
|
3172 |
+
array(
|
3173 |
+
'field' => 'field_acfe_form_term_load_values',
|
3174 |
+
'operator' => '==',
|
3175 |
+
'value' => '1',
|
3176 |
+
),
|
3177 |
+
),
|
3178 |
+
),
|
3179 |
'wrapper' => array(
|
3180 |
'width' => '',
|
3181 |
'class' => '',
|
3184 |
'acfe_permissions' => '',
|
3185 |
'choices' => array(
|
3186 |
),
|
3187 |
+
'allow_custom' => 0,
|
3188 |
'default_value' => array(
|
3189 |
),
|
3190 |
+
'layout' => 'vertical',
|
3191 |
+
'toggle' => 1,
|
|
|
3192 |
'return_format' => 'value',
|
3193 |
+
'save_custom' => 0,
|
|
|
3194 |
),
|
3195 |
+
|
3196 |
+
/*
|
3197 |
+
* Layout: Term Advanced
|
3198 |
+
*/
|
3199 |
array(
|
3200 |
'key' => 'field_acfe_form_term_tab_advanced',
|
3201 |
'label' => 'Advanced',
|
3219 |
'name' => 'acfe_form_term_advanced_load',
|
3220 |
'type' => 'acfe_dynamic_message',
|
3221 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
3222 |
+
'instructions' => 'Alter the term ID where meta values are loaded from',
|
3223 |
'required' => 0,
|
3224 |
'conditional_logic' => 0,
|
3225 |
'wrapper' => array(
|
3235 |
'name' => 'acfe_form_term_advanced_save_args',
|
3236 |
'type' => 'acfe_dynamic_message',
|
3237 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
3238 |
+
'instructions' => 'Alter the term arguments before database insert/update',
|
3239 |
'required' => 0,
|
3240 |
'conditional_logic' => 0,
|
3241 |
'wrapper' => array(
|
3275 |
'label' => 'User action',
|
3276 |
'display' => 'row',
|
3277 |
'sub_fields' => array(
|
3278 |
+
|
3279 |
+
/*
|
3280 |
+
* Layout: User Action
|
3281 |
+
*/
|
3282 |
array(
|
3283 |
+
'key' => 'field_acfe_form_user_tab_action',
|
3284 |
+
'label' => 'Action',
|
3285 |
'name' => '',
|
3286 |
'type' => 'tab',
|
3287 |
'instructions' => '',
|
3311 |
),
|
3312 |
'acfe_permissions' => '',
|
3313 |
'choices' => array(
|
3314 |
+
'insert_user' => 'Create user',
|
3315 |
+
'update_user' => 'Update user',
|
3316 |
+
'log_user' => 'Log user',
|
3317 |
),
|
3318 |
'allow_null' => 0,
|
3319 |
'other_choice' => 0,
|
3342 |
'append' => '',
|
3343 |
'maxlength' => '',
|
3344 |
),
|
3345 |
+
array(
|
3346 |
'key' => 'field_acfe_form_user_custom_query_var',
|
3347 |
'label' => 'Query var',
|
3348 |
'name' => 'acfe_form_custom_query_var',
|
3349 |
'type' => 'true_false',
|
3350 |
'instructions' => 'Automatically create a query var with the data of the user that has been created/updated.<br />Retrieve data using <code>{query_var:my-action:display_name}</code> template tags.',
|
3351 |
'required' => 0,
|
|
|
3352 |
'wrapper' => array(
|
3353 |
'width' => '',
|
3354 |
'class' => '',
|
3360 |
'ui' => 1,
|
3361 |
'ui_on_text' => '',
|
3362 |
'ui_off_text' => '',
|
3363 |
+
'conditional_logic' => array(
|
3364 |
array(
|
3365 |
array(
|
3366 |
'field' => 'field_acfe_form_user_custom_alias',
|
3369 |
),
|
3370 |
),
|
3371 |
),
|
3372 |
+
|
3373 |
+
/*
|
3374 |
+
* Layout: User Login
|
3375 |
+
*/
|
3376 |
array(
|
3377 |
+
'key' => 'field_acfe_form_user_tab_login',
|
3378 |
+
'label' => 'Login',
|
3379 |
+
'name' => '',
|
3380 |
+
'type' => 'tab',
|
3381 |
+
'instructions' => '',
|
3382 |
'required' => 0,
|
3383 |
+
'wrapper' => array(
|
3384 |
+
'width' => '',
|
3385 |
+
'class' => '',
|
3386 |
+
'id' => '',
|
3387 |
+
),
|
3388 |
+
'acfe_permissions' => '',
|
3389 |
+
'placement' => 'top',
|
3390 |
+
'endpoint' => 0,
|
3391 |
'conditional_logic' => array(
|
3392 |
array(
|
3393 |
array(
|
3394 |
'field' => 'field_acfe_form_user_action',
|
3395 |
'operator' => '==',
|
3396 |
+
'value' => 'log_user',
|
3397 |
),
|
3398 |
),
|
3399 |
),
|
3400 |
+
),
|
3401 |
+
array(
|
3402 |
+
'key' => 'field_acfe_form_user_log_type',
|
3403 |
+
'label' => 'Login type',
|
3404 |
+
'name' => 'acfe_form_user_log_type',
|
3405 |
+
'type' => 'radio',
|
3406 |
+
'instructions' => '',
|
3407 |
+
'required' => 0,
|
3408 |
'wrapper' => array(
|
3409 |
'width' => '',
|
3410 |
'class' => '',
|
3412 |
),
|
3413 |
'acfe_permissions' => '',
|
3414 |
'choices' => array(
|
3415 |
+
'email' => 'E-mail',
|
3416 |
+
'username' => 'Username',
|
3417 |
+
'email_username' => 'E-mail or username',
|
3418 |
),
|
3419 |
'allow_null' => 0,
|
3420 |
+
'other_choice' => 0,
|
3421 |
+
'default_value' => 'email',
|
3422 |
+
'layout' => 'vertical',
|
3423 |
'return_format' => 'value',
|
3424 |
+
'save_other_choice' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3425 |
'conditional_logic' => array(
|
3426 |
array(
|
3427 |
array(
|
3428 |
+
'field' => 'field_acfe_form_user_action',
|
3429 |
+
'operator' => '==',
|
3430 |
+
'value' => 'log_user',
|
3431 |
),
|
3432 |
),
|
3433 |
),
|
3434 |
+
),
|
3435 |
+
array(
|
3436 |
+
'key' => 'field_acfe_form_user_save_login_user',
|
3437 |
+
'label' => 'Login',
|
3438 |
+
'name' => 'acfe_form_user_save_login_user',
|
3439 |
+
'type' => 'select',
|
3440 |
+
'instructions' => '',
|
3441 |
+
'required' => 0,
|
3442 |
'wrapper' => array(
|
3443 |
'width' => '',
|
3444 |
'class' => '',
|
3445 |
'id' => '',
|
3446 |
),
|
3447 |
'acfe_permissions' => '',
|
3448 |
+
'choices' => array(),
|
3449 |
+
'default_value' => array(
|
3450 |
+
),
|
3451 |
+
'allow_null' => 1,
|
3452 |
+
'multiple' => 0,
|
3453 |
+
'ui' => 1,
|
3454 |
+
'return_format' => 'value',
|
3455 |
+
'placeholder' => 'Default',
|
3456 |
+
'ajax' => 0,
|
3457 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3458 |
+
'allow_custom' => 1,
|
3459 |
+
'conditional_logic' => array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3460 |
array(
|
3461 |
+
array(
|
3462 |
+
'field' => 'field_acfe_form_user_action',
|
3463 |
+
'operator' => '==',
|
3464 |
+
'value' => 'log_user',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3465 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
3466 |
),
|
3467 |
),
|
3468 |
),
|
3469 |
array(
|
3470 |
+
'key' => 'field_acfe_form_user_save_login_pass',
|
3471 |
+
'label' => 'Password',
|
3472 |
+
'name' => 'acfe_form_user_save_login_pass',
|
3473 |
+
'type' => 'select',
|
3474 |
'instructions' => '',
|
3475 |
'required' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3476 |
'wrapper' => array(
|
3477 |
'width' => '',
|
3478 |
'class' => '',
|
3479 |
'id' => '',
|
3480 |
),
|
3481 |
'acfe_permissions' => '',
|
3482 |
+
'choices' => array(),
|
3483 |
+
'default_value' => array(
|
3484 |
+
),
|
3485 |
+
'allow_null' => 1,
|
3486 |
+
'multiple' => 0,
|
3487 |
+
'ui' => 1,
|
3488 |
+
'return_format' => 'value',
|
3489 |
+
'placeholder' => 'Default',
|
3490 |
+
'ajax' => 0,
|
3491 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3492 |
+
'allow_custom' => 1,
|
3493 |
+
'conditional_logic' => array(
|
3494 |
+
array(
|
3495 |
+
array(
|
3496 |
+
'field' => 'field_acfe_form_user_action',
|
3497 |
+
'operator' => '==',
|
3498 |
+
'value' => 'log_user',
|
3499 |
),
|
3500 |
),
|
3501 |
),
|
3502 |
+
),
|
3503 |
+
array(
|
3504 |
+
'key' => 'field_acfe_form_user_save_login_remember',
|
3505 |
+
'label' => 'Remember me',
|
3506 |
+
'name' => 'acfe_form_user_save_login_remember',
|
3507 |
+
'type' => 'select',
|
3508 |
+
'instructions' => '',
|
3509 |
+
'required' => 0,
|
3510 |
'wrapper' => array(
|
3511 |
'width' => '',
|
3512 |
'class' => '',
|
3513 |
'id' => '',
|
3514 |
),
|
3515 |
'acfe_permissions' => '',
|
3516 |
+
'choices' => array(),
|
3517 |
+
'default_value' => array(
|
3518 |
+
),
|
3519 |
+
'allow_null' => 1,
|
3520 |
+
'multiple' => 0,
|
3521 |
+
'ui' => 1,
|
3522 |
+
'return_format' => 'value',
|
3523 |
+
'placeholder' => 'Default',
|
3524 |
+
'ajax' => 0,
|
3525 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3526 |
+
'allow_custom' => 1,
|
3527 |
+
'conditional_logic' => array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3528 |
array(
|
3529 |
+
array(
|
3530 |
+
'field' => 'field_acfe_form_user_action',
|
3531 |
+
'operator' => '==',
|
3532 |
+
'value' => 'log_user',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3533 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
3534 |
),
|
3535 |
),
|
3536 |
),
|
3537 |
+
|
3538 |
+
/*
|
3539 |
+
* Layout: User Save
|
3540 |
+
*/
|
3541 |
array(
|
3542 |
+
'key' => 'field_acfe_form_user_tab_save',
|
3543 |
+
'label' => 'Save',
|
3544 |
+
'name' => '',
|
3545 |
+
'type' => 'tab',
|
3546 |
'instructions' => '',
|
3547 |
'required' => 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3548 |
'wrapper' => array(
|
3549 |
'width' => '',
|
3550 |
'class' => '',
|
3551 |
'id' => '',
|
3552 |
),
|
3553 |
'acfe_permissions' => '',
|
3554 |
+
'placement' => 'top',
|
3555 |
+
'endpoint' => 0,
|
3556 |
+
'conditional_logic' => array(
|
3557 |
+
array(
|
3558 |
+
array(
|
3559 |
+
'field' => 'field_acfe_form_user_action',
|
3560 |
+
'operator' => '!=',
|
3561 |
+
'value' => 'log_user',
|
3562 |
+
),
|
3563 |
+
),
|
3564 |
+
),
|
3565 |
),
|
3566 |
array(
|
3567 |
+
'key' => 'field_acfe_form_user_save_target',
|
3568 |
+
'label' => 'Target',
|
3569 |
+
'name' => 'acfe_form_user_save_target',
|
3570 |
+
'type' => 'select',
|
3571 |
'instructions' => '',
|
3572 |
'required' => 0,
|
3573 |
'conditional_logic' => array(
|
3574 |
array(
|
3575 |
array(
|
3576 |
+
'field' => 'field_acfe_form_user_action',
|
3577 |
+
'operator' => '==',
|
3578 |
+
'value' => 'update_user',
|
3579 |
),
|
3580 |
),
|
3581 |
),
|
3585 |
'id' => '',
|
3586 |
),
|
3587 |
'acfe_permissions' => '',
|
3588 |
+
'choices' => array(
|
3589 |
+
),
|
3590 |
+
'default_value' => 'current_user',
|
3591 |
+
'allow_null' => 0,
|
3592 |
+
'multiple' => 0,
|
3593 |
+
'ui' => 1,
|
3594 |
+
'ajax' => 0,
|
3595 |
+
'return_format' => 'value',
|
3596 |
+
'placeholder' => '',
|
3597 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3598 |
+
'allow_custom' => 1,
|
3599 |
+
),
|
3600 |
+
array(
|
3601 |
+
'key' => 'field_acfe_form_user_save_email',
|
3602 |
+
'label' => 'Email',
|
3603 |
+
'name' => 'acfe_form_user_save_email',
|
3604 |
+
'type' => 'select',
|
3605 |
+
'instructions' => '',
|
3606 |
+
'required' => 0,
|
3607 |
+
'wrapper' => array(
|
3608 |
+
'width' => '',
|
3609 |
+
'class' => '',
|
3610 |
+
'id' => '',
|
3611 |
+
),
|
3612 |
+
'acfe_permissions' => '',
|
3613 |
+
'choices' => array(),
|
3614 |
+
'default_value' => array(
|
3615 |
+
),
|
3616 |
+
'allow_null' => 1,
|
3617 |
+
'multiple' => 0,
|
3618 |
+
'ui' => 1,
|
3619 |
+
'return_format' => 'value',
|
3620 |
+
'placeholder' => 'Default',
|
3621 |
+
'ajax' => 0,
|
3622 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3623 |
+
'allow_custom' => 1,
|
3624 |
+
'conditional_logic' => array(
|
3625 |
array(
|
3626 |
+
array(
|
3627 |
+
'field' => 'field_acfe_form_user_map_email',
|
3628 |
+
'operator' => '==empty',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3629 |
),
|
3630 |
+
array(
|
3631 |
+
'field' => 'field_acfe_form_user_action',
|
3632 |
+
'operator' => '!=',
|
3633 |
+
'value' => 'log_user',
|
3634 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
3635 |
),
|
3636 |
),
|
3637 |
+
),
|
3638 |
array(
|
3639 |
+
'key' => 'field_acfe_form_user_map_email_message',
|
3640 |
+
'label' => 'Email',
|
3641 |
+
'name' => 'acfe_form_user_map_email_message',
|
3642 |
'type' => 'acfe_dynamic_message',
|
3643 |
'instructions' => '',
|
3644 |
'required' => 0,
|
3645 |
'conditional_logic' => array(
|
3646 |
array(
|
3647 |
array(
|
3648 |
+
'field' => 'field_acfe_form_user_map_email',
|
3649 |
'operator' => '!=empty',
|
3650 |
),
|
3651 |
+
array(
|
3652 |
+
'field' => 'field_acfe_form_user_action',
|
3653 |
+
'operator' => '!=',
|
3654 |
+
'value' => 'log_user',
|
3655 |
+
),
|
3656 |
),
|
3657 |
),
|
3658 |
'wrapper' => array(
|
3662 |
),
|
3663 |
'acfe_permissions' => '',
|
3664 |
),
|
3665 |
+
array(
|
3666 |
+
'key' => 'field_acfe_form_user_save_username',
|
3667 |
+
'label' => 'Username',
|
3668 |
+
'name' => 'acfe_form_user_save_username',
|
3669 |
+
'type' => 'select',
|
3670 |
+
'instructions' => '',
|
3671 |
+
'required' => 0,
|
3672 |
+
'wrapper' => array(
|
3673 |
+
'width' => '',
|
3674 |
+
'class' => '',
|
3675 |
+
'id' => '',
|
3676 |
+
),
|
3677 |
+
'acfe_permissions' => '',
|
3678 |
+
'choices' => array(),
|
3679 |
+
'default_value' => array(
|
3680 |
+
),
|
3681 |
+
'allow_null' => 1,
|
3682 |
+
'multiple' => 0,
|
3683 |
+
'ui' => 1,
|
3684 |
+
'return_format' => 'value',
|
3685 |
+
'placeholder' => 'Default',
|
3686 |
+
'ajax' => 0,
|
3687 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3688 |
+
'allow_custom' => 1,
|
3689 |
+
'conditional_logic' => array(
|
3690 |
array(
|
3691 |
array(
|
3692 |
+
'field' => 'field_acfe_form_user_map_username',
|
3693 |
'operator' => '==empty',
|
3694 |
),
|
3695 |
+
array(
|
3696 |
+
'field' => 'field_acfe_form_user_action',
|
3697 |
+
'operator' => '!=',
|
3698 |
+
'value' => 'log_user',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3699 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
3700 |
),
|
3701 |
),
|
3702 |
+
),
|
3703 |
array(
|
3704 |
+
'key' => 'field_acfe_form_user_map_username_message',
|
3705 |
+
'label' => 'Username',
|
3706 |
+
'name' => 'acfe_form_user_map_username_message',
|
3707 |
'type' => 'acfe_dynamic_message',
|
3708 |
'instructions' => '',
|
3709 |
'required' => 0,
|
3710 |
'conditional_logic' => array(
|
3711 |
array(
|
3712 |
array(
|
3713 |
+
'field' => 'field_acfe_form_user_map_username',
|
3714 |
'operator' => '!=empty',
|
3715 |
),
|
3716 |
+
array(
|
3717 |
+
'field' => 'field_acfe_form_user_action',
|
3718 |
+
'operator' => '!=',
|
3719 |
+
'value' => 'log_user',
|
3720 |
+
),
|
3721 |
),
|
3722 |
),
|
3723 |
'wrapper' => array(
|
3727 |
),
|
3728 |
'acfe_permissions' => '',
|
3729 |
),
|
3730 |
+
array(
|
3731 |
+
'key' => 'field_acfe_form_user_save_password',
|
3732 |
+
'label' => 'Password',
|
3733 |
+
'name' => 'acfe_form_user_save_password',
|
3734 |
+
'type' => 'select',
|
3735 |
+
'instructions' => '',
|
3736 |
+
'required' => 0,
|
3737 |
+
'wrapper' => array(
|
3738 |
+
'width' => '',
|
3739 |
+
'class' => '',
|
3740 |
+
'id' => '',
|
3741 |
+
),
|
3742 |
+
'acfe_permissions' => '',
|
3743 |
+
'choices' => array(
|
3744 |
+
'generate_password' => 'Generate password',
|
3745 |
+
),
|
3746 |
+
'default_value' => array(
|
3747 |
+
),
|
3748 |
+
'allow_null' => 1,
|
3749 |
+
'multiple' => 0,
|
3750 |
+
'ui' => 1,
|
3751 |
+
'return_format' => 'value',
|
3752 |
+
'placeholder' => 'Default',
|
3753 |
+
'ajax' => 0,
|
3754 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3755 |
+
'allow_custom' => 1,
|
3756 |
+
'conditional_logic' => array(
|
3757 |
+
array(
|
3758 |
+
array(
|
3759 |
+
'field' => 'field_acfe_form_user_map_password',
|
3760 |
+
'operator' => '==empty',
|
3761 |
+
),
|
3762 |
+
array(
|
3763 |
+
'field' => 'field_acfe_form_user_action',
|
3764 |
+
'operator' => '!=',
|
3765 |
+
'value' => 'log_user',
|
3766 |
+
),
|
3767 |
+
),
|
3768 |
+
),
|
3769 |
+
),
|
3770 |
array(
|
3771 |
+
'key' => 'field_acfe_form_user_map_password_message',
|
3772 |
+
'label' => 'Password',
|
3773 |
+
'name' => 'acfe_form_user_map_password_message',
|
3774 |
+
'type' => 'acfe_dynamic_message',
|
3775 |
'instructions' => '',
|
3776 |
'required' => 0,
|
3777 |
'conditional_logic' => array(
|
3778 |
array(
|
3779 |
array(
|
3780 |
+
'field' => 'field_acfe_form_user_map_password',
|
3781 |
+
'operator' => '!=empty',
|
3782 |
+
),
|
3783 |
+
array(
|
3784 |
+
'field' => 'field_acfe_form_user_action',
|
3785 |
+
'operator' => '!=',
|
3786 |
+
'value' => 'log_user',
|
3787 |
),
|
3788 |
),
|
3789 |
),
|
3793 |
'id' => '',
|
3794 |
),
|
3795 |
'acfe_permissions' => '',
|
3796 |
+
),
|
3797 |
+
array(
|
3798 |
+
'key' => 'field_acfe_form_user_save_first_name',
|
3799 |
+
'label' => 'First name',
|
3800 |
+
'name' => 'acfe_form_user_save_first_name',
|
3801 |
+
'type' => 'select',
|
3802 |
+
'instructions' => '',
|
3803 |
+
'required' => 0,
|
3804 |
+
'wrapper' => array(
|
3805 |
+
'width' => '',
|
3806 |
+
'class' => '',
|
3807 |
+
'id' => '',
|
3808 |
+
),
|
3809 |
+
'acfe_permissions' => '',
|
3810 |
+
'choices' => array(),
|
3811 |
+
'default_value' => array(
|
3812 |
+
),
|
3813 |
+
'allow_null' => 1,
|
3814 |
+
'multiple' => 0,
|
3815 |
+
'ui' => 1,
|
3816 |
+
'return_format' => 'value',
|
3817 |
+
'placeholder' => 'Default',
|
3818 |
+
'ajax' => 0,
|
3819 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3820 |
+
'allow_custom' => 1,
|
3821 |
+
'conditional_logic' => array(
|
|
|
|
|
|
|
|
|
3822 |
array(
|
3823 |
+
array(
|
3824 |
+
'field' => 'field_acfe_form_user_map_first_name',
|
3825 |
+
'operator' => '==empty',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3826 |
),
|
3827 |
+
array(
|
3828 |
+
'field' => 'field_acfe_form_user_action',
|
3829 |
+
'operator' => '!=',
|
3830 |
+
'value' => 'log_user',
|
3831 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
3832 |
),
|
3833 |
),
|
3834 |
+
),
|
3835 |
array(
|
3836 |
+
'key' => 'field_acfe_form_user_map_first_name_message',
|
3837 |
+
'label' => 'First name',
|
3838 |
+
'name' => 'acfe_form_user_map_first_name_message',
|
3839 |
'type' => 'acfe_dynamic_message',
|
3840 |
'instructions' => '',
|
3841 |
'required' => 0,
|
3842 |
'conditional_logic' => array(
|
3843 |
array(
|
3844 |
array(
|
3845 |
+
'field' => 'field_acfe_form_user_map_first_name',
|
3846 |
'operator' => '!=empty',
|
3847 |
),
|
3848 |
+
array(
|
3849 |
+
'field' => 'field_acfe_form_user_action',
|
3850 |
+
'operator' => '!=',
|
3851 |
+
'value' => 'log_user',
|
3852 |
+
),
|
3853 |
),
|
3854 |
),
|
3855 |
'wrapper' => array(
|
3859 |
),
|
3860 |
'acfe_permissions' => '',
|
3861 |
),
|
3862 |
+
array(
|
3863 |
+
'key' => 'field_acfe_form_user_save_last_name',
|
3864 |
+
'label' => 'Last name',
|
3865 |
+
'name' => 'acfe_form_user_save_last_name',
|
3866 |
+
'type' => 'select',
|
3867 |
+
'instructions' => '',
|
3868 |
+
'required' => 0,
|
3869 |
+
'wrapper' => array(
|
3870 |
+
'width' => '',
|
3871 |
+
'class' => '',
|
3872 |
+
'id' => '',
|
3873 |
+
),
|
3874 |
+
'acfe_permissions' => '',
|
3875 |
+
'choices' => array(),
|
3876 |
+
'default_value' => array(),
|
3877 |
+
'allow_null' => 1,
|
3878 |
+
'multiple' => 0,
|
3879 |
+
'ui' => 1,
|
3880 |
+
'return_format' => 'value',
|
3881 |
+
'placeholder' => 'Default',
|
3882 |
+
'ajax' => 0,
|
3883 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3884 |
+
'allow_custom' => 1,
|
3885 |
+
'conditional_logic' => array(
|
3886 |
+
array(
|
3887 |
+
array(
|
3888 |
+
'field' => 'field_acfe_form_user_map_last_name',
|
3889 |
+
'operator' => '==empty',
|
3890 |
+
),
|
3891 |
+
array(
|
3892 |
+
'field' => 'field_acfe_form_user_action',
|
3893 |
+
'operator' => '!=',
|
3894 |
+
'value' => 'log_user',
|
3895 |
+
),
|
3896 |
+
),
|
3897 |
+
),
|
3898 |
+
),
|
3899 |
array(
|
3900 |
+
'key' => 'field_acfe_form_user_map_last_name_message',
|
3901 |
+
'label' => 'Last name',
|
3902 |
+
'name' => 'acfe_form_user_map_last_name_message',
|
3903 |
+
'type' => 'acfe_dynamic_message',
|
3904 |
'instructions' => '',
|
3905 |
'required' => 0,
|
3906 |
'conditional_logic' => array(
|
3907 |
array(
|
3908 |
array(
|
3909 |
+
'field' => 'field_acfe_form_user_map_last_name',
|
3910 |
+
'operator' => '!=empty',
|
3911 |
+
),
|
3912 |
+
array(
|
3913 |
+
'field' => 'field_acfe_form_user_action',
|
3914 |
+
'operator' => '!=',
|
3915 |
+
'value' => 'log_user',
|
3916 |
),
|
3917 |
),
|
3918 |
),
|
3922 |
'id' => '',
|
3923 |
),
|
3924 |
'acfe_permissions' => '',
|
3925 |
+
),
|
3926 |
+
array(
|
3927 |
+
'key' => 'field_acfe_form_user_save_nickname',
|
3928 |
+
'label' => 'Nickname',
|
3929 |
+
'name' => 'acfe_form_user_save_nickname',
|
3930 |
+
'type' => 'select',
|
3931 |
+
'instructions' => '',
|
3932 |
+
'required' => 0,
|
3933 |
+
'wrapper' => array(
|
3934 |
+
'width' => '',
|
3935 |
+
'class' => '',
|
3936 |
+
'id' => '',
|
3937 |
+
),
|
3938 |
+
'acfe_permissions' => '',
|
3939 |
+
'choices' => array(),
|
3940 |
+
'default_value' => array(
|
3941 |
+
),
|
3942 |
+
'allow_null' => 1,
|
3943 |
+
'multiple' => 0,
|
3944 |
+
'ui' => 1,
|
3945 |
+
'return_format' => 'value',
|
3946 |
+
'placeholder' => 'Default',
|
3947 |
+
'ajax' => 0,
|
3948 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
3949 |
+
'allow_custom' => 1,
|
3950 |
+
'conditional_logic' => array(
|
|
|
|
|
|
|
|
|
3951 |
array(
|
3952 |
+
array(
|
3953 |
+
'field' => 'field_acfe_form_user_map_nickname',
|
3954 |
+
'operator' => '==empty',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3955 |
),
|
3956 |
+
array(
|
3957 |
+
'field' => 'field_acfe_form_user_action',
|
3958 |
+
'operator' => '!=',
|
3959 |
+
'value' => 'log_user',
|
3960 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
3961 |
),
|
3962 |
),
|
3963 |
+
),
|
3964 |
array(
|
3965 |
'key' => 'field_acfe_form_user_map_nickname_message',
|
3966 |
'label' => 'Nickname',
|
3974 |
'field' => 'field_acfe_form_user_map_nickname',
|
3975 |
'operator' => '!=empty',
|
3976 |
),
|
3977 |
+
array(
|
3978 |
+
'field' => 'field_acfe_form_user_action',
|
3979 |
+
'operator' => '!=',
|
3980 |
+
'value' => 'log_user',
|
3981 |
+
),
|
3982 |
),
|
3983 |
),
|
3984 |
'wrapper' => array(
|
3988 |
),
|
3989 |
'acfe_permissions' => '',
|
3990 |
),
|
3991 |
+
array(
|
3992 |
+
'key' => 'field_acfe_form_user_save_display_name',
|
3993 |
+
'label' => 'Display name',
|
3994 |
+
'name' => 'acfe_form_user_save_display_name',
|
3995 |
+
'type' => 'select',
|
3996 |
+
'instructions' => '',
|
3997 |
+
'required' => 0,
|
3998 |
+
'wrapper' => array(
|
3999 |
+
'width' => '',
|
4000 |
+
'class' => '',
|
4001 |
+
'id' => '',
|
4002 |
+
),
|
4003 |
+
'acfe_permissions' => '',
|
4004 |
+
'choices' => array(),
|
4005 |
+
'default_value' => array(
|
4006 |
+
),
|
4007 |
+
'allow_null' => 1,
|
4008 |
+
'multiple' => 0,
|
4009 |
+
'ui' => 1,
|
4010 |
+
'return_format' => 'value',
|
4011 |
+
'placeholder' => 'Default',
|
4012 |
+
'ajax' => 0,
|
4013 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4014 |
+
'allow_custom' => 1,
|
4015 |
+
'conditional_logic' => array(
|
4016 |
array(
|
4017 |
array(
|
4018 |
'field' => 'field_acfe_form_user_map_display_name',
|
4019 |
'operator' => '==empty',
|
4020 |
),
|
4021 |
+
array(
|
4022 |
+
'field' => 'field_acfe_form_user_action',
|
4023 |
+
'operator' => '!=',
|
4024 |
+
'value' => 'log_user',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4025 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
4026 |
),
|
4027 |
),
|
4028 |
+
),
|
4029 |
array(
|
4030 |
'key' => 'field_acfe_form_user_map_display_name_message',
|
4031 |
'label' => 'Display name',
|
4039 |
'field' => 'field_acfe_form_user_map_display_name',
|
4040 |
'operator' => '!=empty',
|
4041 |
),
|
4042 |
+
array(
|
4043 |
+
'field' => 'field_acfe_form_user_action',
|
4044 |
+
'operator' => '!=',
|
4045 |
+
'value' => 'log_user',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4046 |
),
|
4047 |
),
|
4048 |
),
|
4052 |
'id' => '',
|
4053 |
),
|
4054 |
'acfe_permissions' => '',
|
4055 |
+
),
|
4056 |
+
array(
|
4057 |
+
'key' => 'field_acfe_form_user_save_website',
|
4058 |
+
'label' => 'Website',
|
4059 |
+
'name' => 'acfe_form_user_save_website',
|
4060 |
+
'type' => 'select',
|
4061 |
+
'instructions' => '',
|
4062 |
+
'required' => 0,
|
4063 |
+
'wrapper' => array(
|
4064 |
+
'width' => '',
|
4065 |
+
'class' => '',
|
4066 |
+
'id' => '',
|
4067 |
+
),
|
4068 |
+
'acfe_permissions' => '',
|
4069 |
+
'choices' => array(),
|
4070 |
+
'default_value' => array(
|
4071 |
+
),
|
4072 |
+
'allow_null' => 1,
|
4073 |
+
'multiple' => 0,
|
4074 |
+
'ui' => 1,
|
4075 |
+
'return_format' => 'value',
|
4076 |
+
'placeholder' => 'Default',
|
4077 |
+
'ajax' => 0,
|
4078 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4079 |
+
'allow_custom' => 1,
|
4080 |
+
'conditional_logic' => array(
|
|
|
|
|
|
|
|
|
4081 |
array(
|
4082 |
+
array(
|
4083 |
+
'field' => 'field_acfe_form_user_map_website',
|
4084 |
+
'operator' => '==empty',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4085 |
),
|
4086 |
+
array(
|
4087 |
+
'field' => 'field_acfe_form_user_action',
|
4088 |
+
'operator' => '!=',
|
4089 |
+
'value' => 'log_user',
|
4090 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
4091 |
),
|
4092 |
),
|
4093 |
+
),
|
4094 |
array(
|
4095 |
'key' => 'field_acfe_form_user_map_website_message',
|
4096 |
'label' => 'Website',
|
4104 |
'field' => 'field_acfe_form_user_map_website',
|
4105 |
'operator' => '!=empty',
|
4106 |
),
|
4107 |
+
array(
|
4108 |
+
'field' => 'field_acfe_form_user_action',
|
4109 |
+
'operator' => '!=',
|
4110 |
+
'value' => 'log_user',
|
4111 |
+
),
|
4112 |
),
|
4113 |
),
|
4114 |
'wrapper' => array(
|
4131 |
'field' => 'field_acfe_form_user_map_description',
|
4132 |
'operator' => '==empty',
|
4133 |
),
|
4134 |
+
array(
|
4135 |
+
'field' => 'field_acfe_form_user_action',
|
4136 |
+
'operator' => '!=',
|
4137 |
+
'value' => 'log_user',
|
4138 |
+
),
|
4139 |
),
|
4140 |
),
|
4141 |
'wrapper' => array(
|
4163 |
),
|
4164 |
'acfe_permissions' => '',
|
4165 |
'choices' => array(
|
4166 |
+
'custom' => 'WYSIWYG Editor',
|
4167 |
),
|
4168 |
'default_value' => array(
|
4169 |
),
|
4170 |
'allow_null' => 1,
|
4171 |
'multiple' => 0,
|
4172 |
+
'ui' => 1,
|
4173 |
'return_format' => 'value',
|
4174 |
'placeholder' => 'Default',
|
4175 |
'ajax' => 0,
|
4176 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4177 |
+
'allow_custom' => 1,
|
4178 |
),
|
4179 |
array(
|
4180 |
'key' => 'field_acfe_form_user_save_description_custom',
|
4219 |
'field' => 'field_acfe_form_user_map_description',
|
4220 |
'operator' => '!=empty',
|
4221 |
),
|
4222 |
+
array(
|
4223 |
+
'field' => 'field_acfe_form_user_action',
|
4224 |
+
'operator' => '!=',
|
4225 |
+
'value' => 'log_user',
|
4226 |
+
),
|
4227 |
),
|
4228 |
),
|
4229 |
'wrapper' => array(
|
4246 |
'field' => 'field_acfe_form_user_map_role',
|
4247 |
'operator' => '==empty',
|
4248 |
),
|
4249 |
+
array(
|
4250 |
+
'field' => 'field_acfe_form_user_action',
|
4251 |
+
'operator' => '!=',
|
4252 |
+
'value' => 'log_user',
|
4253 |
+
),
|
4254 |
),
|
4255 |
),
|
4256 |
'wrapper' => array(
|
4265 |
'allow_null' => 1,
|
4266 |
'placeholder' => 'Default',
|
4267 |
'multiple' => 0,
|
4268 |
+
'ui' => 1,
|
4269 |
'choices' => array(
|
4270 |
),
|
4271 |
'ajax' => 0,
|
4272 |
'layout' => '',
|
4273 |
'toggle' => 0,
|
4274 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4275 |
+
'allow_custom' => 1,
|
4276 |
),
|
4277 |
array(
|
4278 |
'key' => 'field_acfe_form_user_map_role_message',
|
4287 |
'field' => 'field_acfe_form_user_map_role',
|
4288 |
'operator' => '!=empty',
|
4289 |
),
|
4290 |
+
array(
|
4291 |
+
'field' => 'field_acfe_form_user_action',
|
4292 |
+
'operator' => '!=',
|
4293 |
+
'value' => 'log_user',
|
4294 |
+
),
|
4295 |
),
|
4296 |
),
|
4297 |
'wrapper' => array(
|
4303 |
),
|
4304 |
array(
|
4305 |
'key' => 'field_acfe_form_user_save_meta',
|
4306 |
+
'label' => 'Save ACF fields',
|
4307 |
'name' => 'acfe_form_user_save_meta',
|
4308 |
'type' => 'checkbox',
|
4309 |
'instructions' => 'Choose which ACF fields should be saved to this user',
|
4310 |
'required' => 0,
|
|
|
4311 |
'wrapper' => array(
|
4312 |
'width' => '',
|
4313 |
'class' => '',
|
4323 |
'toggle' => 1,
|
4324 |
'return_format' => 'value',
|
4325 |
'save_custom' => 0,
|
4326 |
+
'conditional_logic' => array(
|
4327 |
+
array(
|
4328 |
+
array(
|
4329 |
+
'field' => 'field_acfe_form_user_action',
|
4330 |
+
'operator' => '!=',
|
4331 |
+
'value' => 'log_user',
|
4332 |
+
),
|
4333 |
+
),
|
4334 |
+
),
|
4335 |
),
|
4336 |
+
|
4337 |
+
/*
|
4338 |
+
* Layout: User Load
|
4339 |
+
*/
|
4340 |
array(
|
4341 |
'key' => 'acfe_form_user_tab_load',
|
4342 |
'label' => 'Load',
|
4344 |
'type' => 'tab',
|
4345 |
'instructions' => '',
|
4346 |
'required' => 0,
|
|
|
4347 |
'wrapper' => array(
|
4348 |
'width' => '',
|
4349 |
'class' => '',
|
4352 |
'acfe_permissions' => '',
|
4353 |
'placement' => 'top',
|
4354 |
'endpoint' => 0,
|
4355 |
+
'conditional_logic' => array(
|
4356 |
+
array(
|
4357 |
+
array(
|
4358 |
+
'field' => 'field_acfe_form_user_action',
|
4359 |
+
'operator' => '!=',
|
4360 |
+
'value' => 'log_user',
|
4361 |
+
),
|
4362 |
+
),
|
4363 |
+
),
|
4364 |
),
|
4365 |
array(
|
4366 |
'key' => 'field_acfe_form_user_load_values',
|
4384 |
),
|
4385 |
array(
|
4386 |
'key' => 'field_acfe_form_user_load_source',
|
4387 |
+
'label' => 'Source',
|
4388 |
'name' => 'acfe_form_user_load_source',
|
4389 |
'type' => 'select',
|
4390 |
+
'instructions' => '',
|
4391 |
'required' => 0,
|
4392 |
'conditional_logic' => array(
|
4393 |
array(
|
4406 |
'acfe_permissions' => '',
|
4407 |
'choices' => array(
|
4408 |
),
|
4409 |
+
'default_value' => 'current_user',
|
|
|
|
|
4410 |
'allow_null' => 0,
|
4411 |
'multiple' => 0,
|
4412 |
'ui' => 1,
|
4413 |
+
'ajax' => 0,
|
4414 |
'return_format' => 'value',
|
4415 |
'placeholder' => '',
|
4416 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4417 |
+
'allow_custom' => 1,
|
4418 |
),
|
4419 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4420 |
array(
|
4421 |
'key' => 'field_acfe_form_user_map_email',
|
4422 |
'label' => 'Email',
|
4424 |
'type' => 'select',
|
4425 |
'instructions' => '',
|
4426 |
'required' => 0,
|
|
|
4427 |
'wrapper' => array(
|
4428 |
'width' => '',
|
4429 |
'class' => '',
|
4436 |
),
|
4437 |
'allow_null' => 1,
|
4438 |
'multiple' => 0,
|
4439 |
+
'ui' => 1,
|
4440 |
'return_format' => 'value',
|
4441 |
'placeholder' => 'Default',
|
4442 |
'ajax' => 0,
|
4443 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4444 |
+
'allow_custom' => 1,
|
4445 |
+
'conditional_logic' => array(
|
4446 |
+
array(
|
4447 |
+
array(
|
4448 |
+
'field' => 'field_acfe_form_user_load_values',
|
4449 |
+
'operator' => '==',
|
4450 |
+
'value' => '1',
|
4451 |
+
),
|
4452 |
+
array(
|
4453 |
+
'field' => 'field_acfe_form_user_action',
|
4454 |
+
'operator' => '!=',
|
4455 |
+
'value' => 'log_user',
|
4456 |
+
),
|
4457 |
+
),
|
4458 |
+
),
|
4459 |
),
|
4460 |
array(
|
4461 |
'key' => 'field_acfe_form_user_map_username',
|
4464 |
'type' => 'select',
|
4465 |
'instructions' => '',
|
4466 |
'required' => 0,
|
|
|
4467 |
'wrapper' => array(
|
4468 |
'width' => '',
|
4469 |
'class' => '',
|
4476 |
),
|
4477 |
'allow_null' => 1,
|
4478 |
'multiple' => 0,
|
4479 |
+
'ui' => 1,
|
4480 |
'return_format' => 'value',
|
4481 |
'placeholder' => 'Default',
|
4482 |
'ajax' => 0,
|
4483 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4484 |
+
'allow_custom' => 1,
|
4485 |
+
'conditional_logic' => array(
|
4486 |
+
array(
|
4487 |
+
array(
|
4488 |
+
'field' => 'field_acfe_form_user_load_values',
|
4489 |
+
'operator' => '==',
|
4490 |
+
'value' => '1',
|
4491 |
+
),
|
4492 |
+
array(
|
4493 |
+
'field' => 'field_acfe_form_user_action',
|
4494 |
+
'operator' => '!=',
|
4495 |
+
'value' => 'log_user',
|
4496 |
+
),
|
4497 |
+
),
|
4498 |
+
),
|
4499 |
),
|
4500 |
array(
|
4501 |
'key' => 'field_acfe_form_user_map_password',
|
4504 |
'type' => 'select',
|
4505 |
'instructions' => '',
|
4506 |
'required' => 0,
|
|
|
4507 |
'wrapper' => array(
|
4508 |
'width' => '',
|
4509 |
'class' => '',
|
4516 |
),
|
4517 |
'allow_null' => 1,
|
4518 |
'multiple' => 0,
|
4519 |
+
'ui' => 1,
|
4520 |
'return_format' => 'value',
|
4521 |
'placeholder' => 'Default',
|
4522 |
'ajax' => 0,
|
4523 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4524 |
+
'allow_custom' => 1,
|
4525 |
+
'conditional_logic' => array(
|
4526 |
+
array(
|
4527 |
+
array(
|
4528 |
+
'field' => 'field_acfe_form_user_load_values',
|
4529 |
+
'operator' => '==',
|
4530 |
+
'value' => '1',
|
4531 |
+
),
|
4532 |
+
array(
|
4533 |
+
'field' => 'field_acfe_form_user_action',
|
4534 |
+
'operator' => '!=',
|
4535 |
+
'value' => 'log_user',
|
4536 |
+
),
|
4537 |
+
),
|
4538 |
+
),
|
4539 |
),
|
4540 |
array(
|
4541 |
'key' => 'field_acfe_form_user_map_first_name',
|
4544 |
'type' => 'select',
|
4545 |
'instructions' => '',
|
4546 |
'required' => 0,
|
|
|
4547 |
'wrapper' => array(
|
4548 |
'width' => '',
|
4549 |
'class' => '',
|
4556 |
),
|
4557 |
'allow_null' => 1,
|
4558 |
'multiple' => 0,
|
4559 |
+
'ui' => 1,
|
4560 |
'return_format' => 'value',
|
4561 |
'placeholder' => 'Default',
|
4562 |
'ajax' => 0,
|
4563 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4564 |
+
'allow_custom' => 1,
|
4565 |
+
'conditional_logic' => array(
|
4566 |
+
array(
|
4567 |
+
array(
|
4568 |
+
'field' => 'field_acfe_form_user_load_values',
|
4569 |
+
'operator' => '==',
|
4570 |
+
'value' => '1',
|
4571 |
+
),
|
4572 |
+
array(
|
4573 |
+
'field' => 'field_acfe_form_user_action',
|
4574 |
+
'operator' => '!=',
|
4575 |
+
'value' => 'log_user',
|
4576 |
+
),
|
4577 |
+
),
|
4578 |
+
),
|
4579 |
),
|
4580 |
array(
|
4581 |
'key' => 'field_acfe_form_user_map_last_name',
|
4584 |
'type' => 'select',
|
4585 |
'instructions' => '',
|
4586 |
'required' => 0,
|
|
|
4587 |
'wrapper' => array(
|
4588 |
'width' => '',
|
4589 |
'class' => '',
|
4596 |
),
|
4597 |
'allow_null' => 1,
|
4598 |
'multiple' => 0,
|
4599 |
+
'ui' => 1,
|
4600 |
'return_format' => 'value',
|
4601 |
'placeholder' => 'Default',
|
4602 |
'ajax' => 0,
|
4603 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4604 |
+
'allow_custom' => 1,
|
4605 |
+
'conditional_logic' => array(
|
4606 |
+
array(
|
4607 |
+
array(
|
4608 |
+
'field' => 'field_acfe_form_user_load_values',
|
4609 |
+
'operator' => '==',
|
4610 |
+
'value' => '1',
|
4611 |
+
),
|
4612 |
+
array(
|
4613 |
+
'field' => 'field_acfe_form_user_action',
|
4614 |
+
'operator' => '!=',
|
4615 |
+
'value' => 'log_user',
|
4616 |
+
),
|
4617 |
+
),
|
4618 |
+
),
|
4619 |
),
|
4620 |
array(
|
4621 |
'key' => 'field_acfe_form_user_map_nickname',
|
4624 |
'type' => 'select',
|
4625 |
'instructions' => '',
|
4626 |
'required' => 0,
|
|
|
4627 |
'wrapper' => array(
|
4628 |
'width' => '',
|
4629 |
'class' => '',
|
4636 |
),
|
4637 |
'allow_null' => 1,
|
4638 |
'multiple' => 0,
|
4639 |
+
'ui' => 1,
|
4640 |
'return_format' => 'value',
|
4641 |
'placeholder' => 'Default',
|
4642 |
'ajax' => 0,
|
4643 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4644 |
+
'allow_custom' => 1,
|
4645 |
+
'conditional_logic' => array(
|
4646 |
+
array(
|
4647 |
+
array(
|
4648 |
+
'field' => 'field_acfe_form_user_load_values',
|
4649 |
+
'operator' => '==',
|
4650 |
+
'value' => '1',
|
4651 |
+
),
|
4652 |
+
array(
|
4653 |
+
'field' => 'field_acfe_form_user_action',
|
4654 |
+
'operator' => '!=',
|
4655 |
+
'value' => 'log_user',
|
4656 |
+
),
|
4657 |
+
),
|
4658 |
+
),
|
4659 |
),
|
4660 |
array(
|
4661 |
'key' => 'field_acfe_form_user_map_display_name',
|
4664 |
'type' => 'select',
|
4665 |
'instructions' => '',
|
4666 |
'required' => 0,
|
|
|
4667 |
'wrapper' => array(
|
4668 |
'width' => '',
|
4669 |
'class' => '',
|
4676 |
),
|
4677 |
'allow_null' => 1,
|
4678 |
'multiple' => 0,
|
4679 |
+
'ui' => 1,
|
4680 |
'return_format' => 'value',
|
4681 |
'placeholder' => 'Default',
|
4682 |
'ajax' => 0,
|
4683 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4684 |
+
'allow_custom' => 1,
|
4685 |
+
'conditional_logic' => array(
|
4686 |
+
array(
|
4687 |
+
array(
|
4688 |
+
'field' => 'field_acfe_form_user_load_values',
|
4689 |
+
'operator' => '==',
|
4690 |
+
'value' => '1',
|
4691 |
+
),
|
4692 |
+
array(
|
4693 |
+
'field' => 'field_acfe_form_user_action',
|
4694 |
+
'operator' => '!=',
|
4695 |
+
'value' => 'log_user',
|
4696 |
+
),
|
4697 |
+
),
|
4698 |
+
),
|
4699 |
),
|
4700 |
array(
|
4701 |
'key' => 'field_acfe_form_user_map_website',
|
4704 |
'type' => 'select',
|
4705 |
'instructions' => '',
|
4706 |
'required' => 0,
|
|
|
4707 |
'wrapper' => array(
|
4708 |
'width' => '',
|
4709 |
'class' => '',
|
4716 |
),
|
4717 |
'allow_null' => 1,
|
4718 |
'multiple' => 0,
|
4719 |
+
'ui' => 1,
|
4720 |
+
'return_format' => 'value',
|
4721 |
+
'placeholder' => 'Default',
|
4722 |
+
'ajax' => 0,
|
4723 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4724 |
+
'allow_custom' => 1,
|
4725 |
+
'conditional_logic' => array(
|
4726 |
+
array(
|
4727 |
+
array(
|
4728 |
+
'field' => 'field_acfe_form_user_load_values',
|
4729 |
+
'operator' => '==',
|
4730 |
+
'value' => '1',
|
4731 |
+
),
|
4732 |
+
array(
|
4733 |
+
'field' => 'field_acfe_form_user_action',
|
4734 |
+
'operator' => '!=',
|
4735 |
+
'value' => 'log_user',
|
4736 |
+
),
|
4737 |
+
),
|
4738 |
+
),
|
4739 |
+
),
|
4740 |
+
array(
|
4741 |
+
'key' => 'field_acfe_form_user_map_description',
|
4742 |
+
'label' => 'Description',
|
4743 |
+
'name' => 'acfe_form_user_map_description',
|
4744 |
+
'type' => 'select',
|
4745 |
+
'instructions' => '',
|
4746 |
+
'required' => 0,
|
4747 |
+
'wrapper' => array(
|
4748 |
+
'width' => '',
|
4749 |
+
'class' => '',
|
4750 |
+
'id' => '',
|
4751 |
+
),
|
4752 |
+
'acfe_permissions' => '',
|
4753 |
+
'choices' => array(
|
4754 |
+
),
|
4755 |
+
'default_value' => array(
|
4756 |
+
),
|
4757 |
+
'allow_null' => 1,
|
4758 |
+
'multiple' => 0,
|
4759 |
+
'ui' => 1,
|
4760 |
'return_format' => 'value',
|
4761 |
'placeholder' => 'Default',
|
4762 |
'ajax' => 0,
|
4763 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4764 |
+
'allow_custom' => 1,
|
4765 |
+
'conditional_logic' => array(
|
4766 |
+
array(
|
4767 |
+
array(
|
4768 |
+
'field' => 'field_acfe_form_user_load_values',
|
4769 |
+
'operator' => '==',
|
4770 |
+
'value' => '1',
|
4771 |
+
),
|
4772 |
+
array(
|
4773 |
+
'field' => 'field_acfe_form_user_action',
|
4774 |
+
'operator' => '!=',
|
4775 |
+
'value' => 'log_user',
|
4776 |
+
),
|
4777 |
+
),
|
4778 |
+
),
|
4779 |
),
|
4780 |
array(
|
4781 |
+
'key' => 'field_acfe_form_user_map_role',
|
4782 |
+
'label' => 'Role',
|
4783 |
+
'name' => 'acfe_form_user_map_role',
|
4784 |
'type' => 'select',
|
4785 |
'instructions' => '',
|
4786 |
'required' => 0,
|
|
|
4787 |
'wrapper' => array(
|
4788 |
'width' => '',
|
4789 |
'class' => '',
|
4796 |
),
|
4797 |
'allow_null' => 1,
|
4798 |
'multiple' => 0,
|
4799 |
+
'ui' => 1,
|
4800 |
'return_format' => 'value',
|
4801 |
'placeholder' => 'Default',
|
4802 |
'ajax' => 0,
|
4803 |
+
'search_placeholder' => 'Enter a custom value or template tag. (See "Cheatsheet" tab)',
|
4804 |
+
'allow_custom' => 1,
|
4805 |
+
'conditional_logic' => array(
|
4806 |
+
array(
|
4807 |
+
array(
|
4808 |
+
'field' => 'field_acfe_form_user_load_values',
|
4809 |
+
'operator' => '==',
|
4810 |
+
'value' => '1',
|
4811 |
+
),
|
4812 |
+
array(
|
4813 |
+
'field' => 'field_acfe_form_user_action',
|
4814 |
+
'operator' => '!=',
|
4815 |
+
'value' => 'log_user',
|
4816 |
+
),
|
4817 |
+
),
|
4818 |
+
),
|
4819 |
),
|
4820 |
array(
|
4821 |
+
'key' => 'field_acfe_form_user_load_meta',
|
4822 |
+
'label' => 'Load ACF fields',
|
4823 |
+
'name' => 'acfe_form_user_load_meta',
|
4824 |
+
'type' => 'checkbox',
|
4825 |
+
'instructions' => 'Choose which ACF fields should have their values loaded',
|
4826 |
'required' => 0,
|
4827 |
+
'conditional_logic' => array(
|
4828 |
+
array(
|
4829 |
+
array(
|
4830 |
+
'field' => 'field_acfe_form_user_load_values',
|
4831 |
+
'operator' => '==',
|
4832 |
+
'value' => '1',
|
4833 |
+
),
|
4834 |
+
),
|
4835 |
+
),
|
4836 |
'wrapper' => array(
|
4837 |
'width' => '',
|
4838 |
'class' => '',
|
4841 |
'acfe_permissions' => '',
|
4842 |
'choices' => array(
|
4843 |
),
|
4844 |
+
'allow_custom' => 0,
|
4845 |
'default_value' => array(
|
4846 |
),
|
4847 |
+
'layout' => 'vertical',
|
4848 |
+
'toggle' => 1,
|
|
|
4849 |
'return_format' => 'value',
|
4850 |
+
'save_custom' => 0,
|
|
|
4851 |
),
|
4852 |
+
|
4853 |
+
|
4854 |
+
/*
|
4855 |
+
* Layout: User Advanced
|
4856 |
+
*/
|
4857 |
array(
|
4858 |
'key' => 'field_acfe_form_user_tab_advanced',
|
4859 |
'label' => 'Advanced',
|
4877 |
'name' => 'acfe_form_user_advanced_load',
|
4878 |
'type' => 'acfe_dynamic_message',
|
4879 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
4880 |
+
'instructions' => 'Alter the user ID where meta values are loaded from',
|
4881 |
'required' => 0,
|
4882 |
'conditional_logic' => 0,
|
4883 |
'wrapper' => array(
|
4893 |
'name' => 'acfe_form_user_advanced_save_args',
|
4894 |
'type' => 'acfe_dynamic_message',
|
4895 |
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
4896 |
+
'instructions' => 'Alter the user arguments before database insert/update',
|
4897 |
'required' => 0,
|
4898 |
'conditional_logic' => 0,
|
4899 |
'wrapper' => array(
|
4929 |
'min' => '',
|
4930 |
'max' => '',
|
4931 |
),
|
4932 |
+
|
4933 |
+
/*
|
4934 |
+
* Submission
|
4935 |
+
*/
|
4936 |
+
array(
|
4937 |
+
'key' => 'field_acfe_form_tab_submission',
|
4938 |
+
'label' => 'Submission',
|
4939 |
+
'name' => '',
|
4940 |
+
'type' => 'tab',
|
4941 |
+
'instructions' => '',
|
4942 |
+
'required' => 0,
|
4943 |
+
'conditional_logic' => 0,
|
4944 |
+
'wrapper' => array(
|
4945 |
+
'width' => '',
|
4946 |
+
'class' => '',
|
4947 |
+
'id' => '',
|
4948 |
+
),
|
4949 |
+
'acfe_permissions' => '',
|
4950 |
+
'placement' => 'top',
|
4951 |
+
'endpoint' => 0,
|
4952 |
+
),
|
4953 |
+
array(
|
4954 |
+
'key' => 'field_acfe_form_updated_hide_form',
|
4955 |
+
'label' => 'Hide form',
|
4956 |
+
'name' => 'acfe_form_updated_hide_form',
|
4957 |
+
'type' => 'true_false',
|
4958 |
+
'instructions' => 'Hide form on successful submission',
|
4959 |
+
'required' => 0,
|
4960 |
+
'conditional_logic' => array(),
|
4961 |
+
'wrapper' => array(
|
4962 |
+
'width' => '',
|
4963 |
+
'class' => '',
|
4964 |
+
'id' => '',
|
4965 |
+
),
|
4966 |
+
'acfe_permissions' => '',
|
4967 |
+
'message' => '',
|
4968 |
+
'default_value' => 0,
|
4969 |
+
'ui' => 1,
|
4970 |
+
'ui_on_text' => '',
|
4971 |
+
'ui_off_text' => '',
|
4972 |
+
),
|
4973 |
+
array(
|
4974 |
+
'key' => 'field_acfe_form_return',
|
4975 |
+
'label' => 'Redirection',
|
4976 |
+
'name' => 'acfe_form_return',
|
4977 |
+
'type' => 'text',
|
4978 |
+
'instructions' => 'The URL to be redirected to after the form is submit. Defaults to the current URL.<br /><br />You may use <code>{field:field_name}</code> <code>{field:field_key}</code> <code>{query_var:name}</code> <code>{query_var:name:key}</code>.',
|
4979 |
+
'required' => 0,
|
4980 |
+
'conditional_logic' => 0,
|
4981 |
+
'wrapper' => array(
|
4982 |
+
'width' => '',
|
4983 |
+
'class' => '',
|
4984 |
+
'id' => '',
|
4985 |
+
),
|
4986 |
+
'acfe_permissions' => '',
|
4987 |
+
'default_value' => '',
|
4988 |
+
'placeholder' => '',
|
4989 |
+
'prepend' => '',
|
4990 |
+
'append' => '',
|
4991 |
+
'maxlength' => '',
|
4992 |
+
),
|
4993 |
+
array(
|
4994 |
+
'key' => 'field_acfe_form_updated_message',
|
4995 |
+
'label' => 'Success message',
|
4996 |
+
'name' => 'acfe_form_updated_message',
|
4997 |
+
'type' => 'wysiwyg',
|
4998 |
+
'instructions' => 'A message displayed above the form after being redirected. Can also be empty for no message.<br /><br />You may use <code>{field:field_name}</code> <code>{field:field_key}</code> <code>{query_var:name}</code> <code>{query_var:name:key}</code>.',
|
4999 |
+
'required' => 0,
|
5000 |
+
'conditional_logic' => 0,
|
5001 |
+
'wrapper' => array(
|
5002 |
+
'width' => '',
|
5003 |
+
'class' => '',
|
5004 |
+
'id' => '',
|
5005 |
+
),
|
5006 |
+
'acfe_permissions' => '',
|
5007 |
+
'default_value' => __('Post updated', 'acf'),
|
5008 |
+
'tabs' => 'all',
|
5009 |
+
'toolbar' => 'full',
|
5010 |
+
'media_upload' => 1,
|
5011 |
+
'delay' => 0,
|
5012 |
+
),
|
5013 |
+
array(
|
5014 |
+
'key' => 'field_acfe_form_html_updated_message',
|
5015 |
+
'label' => 'Success wrapper HTML',
|
5016 |
+
'name' => 'acfe_form_html_updated_message',
|
5017 |
+
'type' => 'acfe_code_editor',
|
5018 |
+
'instructions' => 'HTML used to render the updated message.<br /><br />
|
5019 |
+
If used, you have to include the following code <code>%s</code> to print the actual \'Success message\' above.',
|
5020 |
+
'required' => 0,
|
5021 |
+
'conditional_logic' => 0,
|
5022 |
+
'wrapper' => array(
|
5023 |
+
'width' => '',
|
5024 |
+
'class' => '',
|
5025 |
+
'id' => '',
|
5026 |
+
),
|
5027 |
+
'acfe_permissions' => '',
|
5028 |
+
'default_value' => '<div id="message" class="updated">%s</div>',
|
5029 |
+
'placeholder' => '',
|
5030 |
+
'maxlength' => '',
|
5031 |
+
'rows' => 2,
|
5032 |
+
),
|
5033 |
+
array(
|
5034 |
+
'key' => 'field_acfe_form_submission_advanced_submission',
|
5035 |
+
'label' => 'PHP Form Submit: Custom Action',
|
5036 |
+
'name' => 'acfe_form_submission_advanced_submission',
|
5037 |
+
'type' => 'acfe_dynamic_message',
|
5038 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
5039 |
+
'instructions' => 'Trigger a custom action on form submission',
|
5040 |
+
'required' => 0,
|
5041 |
+
'conditional_logic' => 0,
|
5042 |
+
'wrapper' => array(
|
5043 |
+
'width' => '',
|
5044 |
+
'class' => '',
|
5045 |
+
'id' => '',
|
5046 |
+
),
|
5047 |
+
'acfe_permissions' => '',
|
5048 |
+
),
|
5049 |
+
|
5050 |
+
/*
|
5051 |
+
* Advanced
|
5052 |
+
*/
|
5053 |
array(
|
5054 |
'key' => 'field_acfe_form_tab_advanced',
|
5055 |
'label' => 'Advanced',
|
5067 |
'placement' => 'top',
|
5068 |
'endpoint' => 0,
|
5069 |
),
|
5070 |
+
/*
|
5071 |
array(
|
5072 |
'key' => 'field_acfe_form_post_field_groups',
|
5073 |
'label' => 'Post field groups',
|
5087 |
'return_format' => 'value',
|
5088 |
'placeholder' => '',
|
5089 |
),
|
5090 |
+
*/
|
5091 |
array(
|
5092 |
'key' => 'field_acfe_form_honeypot',
|
5093 |
'label' => 'Honeypot',
|
5144 |
),
|
5145 |
'acfe_permissions' => '',
|
5146 |
'choices' => array(
|
5147 |
+
'default' => 'Default (Field based)',
|
5148 |
'wp' => 'Media modal',
|
5149 |
'basic' => 'Basic',
|
5150 |
),
|
5151 |
'allow_null' => 0,
|
5152 |
'other_choice' => 0,
|
5153 |
+
'default_value' => 'default',
|
5154 |
'layout' => 'vertical',
|
5155 |
'return_format' => 'value',
|
5156 |
'save_other_choice' => 0,
|
5236 |
'return_format' => 'value',
|
5237 |
'save_other_choice' => 0,
|
5238 |
),
|
5239 |
+
|
5240 |
+
/*
|
5241 |
+
* Cheatsheet
|
5242 |
+
*/
|
5243 |
+
array(
|
5244 |
+
'key' => 'field_acfe_form_tab_cheatsheet',
|
5245 |
+
'label' => 'Cheatsheet',
|
5246 |
+
'name' => '',
|
5247 |
+
'type' => 'tab',
|
5248 |
+
'instructions' => '',
|
5249 |
+
'required' => 0,
|
5250 |
+
'conditional_logic' => 0,
|
5251 |
+
'wrapper' => array(
|
5252 |
+
'width' => '',
|
5253 |
+
'class' => '',
|
5254 |
+
'id' => '',
|
5255 |
+
),
|
5256 |
+
'acfe_permissions' => '',
|
5257 |
+
'placement' => 'top',
|
5258 |
+
'endpoint' => 0,
|
5259 |
+
),
|
5260 |
+
|
5261 |
+
array(
|
5262 |
+
'key' => 'field_acfe_form_cheatsheet_field',
|
5263 |
+
'label' => 'Field',
|
5264 |
+
'name' => 'acfe_form_cheatsheet_field',
|
5265 |
+
'type' => 'acfe_dynamic_message',
|
5266 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
5267 |
+
'instructions' => 'Retrieve user input from the current form',
|
5268 |
+
'required' => 0,
|
5269 |
+
'conditional_logic' => 0,
|
5270 |
+
'wrapper' => array(
|
5271 |
+
'width' => '',
|
5272 |
+
'class' => '',
|
5273 |
+
'id' => '',
|
5274 |
+
),
|
5275 |
+
),
|
5276 |
+
array(
|
5277 |
+
'key' => 'field_acfe_form_cheatsheet_fields',
|
5278 |
+
'label' => 'Fields',
|
5279 |
+
'name' => 'acfe_form_cheatsheet_fields',
|
5280 |
+
'type' => 'acfe_dynamic_message',
|
5281 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
5282 |
+
'instructions' => 'Retrieve all user inputs from the current form',
|
5283 |
+
'required' => 0,
|
5284 |
+
'conditional_logic' => 0,
|
5285 |
+
'wrapper' => array(
|
5286 |
+
'width' => '',
|
5287 |
+
'class' => '',
|
5288 |
+
'id' => '',
|
5289 |
+
),
|
5290 |
+
),
|
5291 |
+
array(
|
5292 |
+
'key' => 'field_acfe_form_cheatsheet_get_field',
|
5293 |
+
'label' => 'Get Field',
|
5294 |
+
'name' => 'acfe_form_cheatsheet_get_field',
|
5295 |
+
'type' => 'acfe_dynamic_message',
|
5296 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
5297 |
+
'instructions' => 'Retrieve ACF field value from database',
|
5298 |
+
'required' => 0,
|
5299 |
+
'conditional_logic' => 0,
|
5300 |
+
'wrapper' => array(
|
5301 |
+
'width' => '',
|
5302 |
+
'class' => '',
|
5303 |
+
'id' => '',
|
5304 |
+
),
|
5305 |
+
),
|
5306 |
+
array(
|
5307 |
+
'key' => 'field_acfe_form_cheatsheet_query_var',
|
5308 |
+
'label' => 'Query Var',
|
5309 |
+
'name' => 'acfe_form_cheatsheet_query_var',
|
5310 |
+
'type' => 'acfe_dynamic_message',
|
5311 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
5312 |
+
'instructions' => 'Retrieve query var values. Can be used to get data from previous action',
|
5313 |
+
'required' => 0,
|
5314 |
+
'conditional_logic' => 0,
|
5315 |
+
'wrapper' => array(
|
5316 |
+
'width' => '',
|
5317 |
+
'class' => '',
|
5318 |
+
'id' => '',
|
5319 |
+
),
|
5320 |
+
),
|
5321 |
+
array(
|
5322 |
+
'key' => 'field_acfe_form_cheatsheet_current_post',
|
5323 |
+
'label' => 'Current Post',
|
5324 |
+
'name' => 'acfe_form_cheatsheet_current_post',
|
5325 |
+
'type' => 'acfe_dynamic_message',
|
5326 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
5327 |
+
'instructions' => 'Retrieve current post data (where the form is being printed)',
|
5328 |
+
'required' => 0,
|
5329 |
+
'conditional_logic' => 0,
|
5330 |
+
'wrapper' => array(
|
5331 |
+
'width' => '',
|
5332 |
+
'class' => '',
|
5333 |
+
'id' => '',
|
5334 |
+
),
|
5335 |
+
),
|
5336 |
+
array(
|
5337 |
+
'key' => 'field_acfe_form_cheatsheet_current_term',
|
5338 |
+
'label' => 'Current Term',
|
5339 |
+
'name' => 'acfe_form_cheatsheet_current_term',
|
5340 |
+
'type' => 'acfe_dynamic_message',
|
5341 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
5342 |
+
'instructions' => 'Retrieve current term data (where the form is being printed)',
|
5343 |
+
'required' => 0,
|
5344 |
+
'conditional_logic' => 0,
|
5345 |
+
'wrapper' => array(
|
5346 |
+
'width' => '',
|
5347 |
+
'class' => '',
|
5348 |
+
'id' => '',
|
5349 |
+
),
|
5350 |
+
),
|
5351 |
+
array(
|
5352 |
+
'key' => 'field_acfe_form_cheatsheet_current_user',
|
5353 |
+
'label' => 'Current User',
|
5354 |
+
'name' => 'acfe_form_cheatsheet_current_user',
|
5355 |
+
'type' => 'acfe_dynamic_message',
|
5356 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
5357 |
+
'instructions' => 'Retrieve currently logged user data',
|
5358 |
+
'required' => 0,
|
5359 |
+
'conditional_logic' => 0,
|
5360 |
+
'wrapper' => array(
|
5361 |
+
'width' => '',
|
5362 |
+
'class' => '',
|
5363 |
+
'id' => '',
|
5364 |
+
),
|
5365 |
+
),
|
5366 |
+
array(
|
5367 |
+
'key' => 'field_acfe_form_cheatsheet_current_author',
|
5368 |
+
'label' => 'Current Author',
|
5369 |
+
'name' => 'acfe_form_cheatsheet_current_author',
|
5370 |
+
'type' => 'acfe_dynamic_message',
|
5371 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
5372 |
+
'instructions' => 'Retrieve current post author data (where the form is being printed)',
|
5373 |
+
'required' => 0,
|
5374 |
+
'conditional_logic' => 0,
|
5375 |
+
'wrapper' => array(
|
5376 |
+
'width' => '',
|
5377 |
+
'class' => '',
|
5378 |
+
'id' => '',
|
5379 |
+
),
|
5380 |
+
),
|
5381 |
+
array(
|
5382 |
+
'key' => 'field_acfe_form_cheatsheet_current_form',
|
5383 |
+
'label' => 'Current Form',
|
5384 |
+
'name' => 'acfe_form_cheatsheet_current_form',
|
5385 |
+
'type' => 'acfe_dynamic_message',
|
5386 |
+
'value' => isset($_REQUEST['post']) ? $_REQUEST['post'] : '',
|
5387 |
+
'instructions' => 'Retrieve current Dynamic Form data',
|
5388 |
+
'required' => 0,
|
5389 |
+
'conditional_logic' => 0,
|
5390 |
+
'wrapper' => array(
|
5391 |
+
'width' => '',
|
5392 |
+
'class' => '',
|
5393 |
+
'id' => '',
|
5394 |
+
),
|
5395 |
+
),
|
5396 |
),
|
5397 |
'location' => array(
|
5398 |
array(
|
includes/modules/form/form-front.php
CHANGED
@@ -9,6 +9,21 @@ class acfe_form_front{
|
|
9 |
|
10 |
function __construct(){
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
// Validation
|
13 |
add_action('acf/validate_save_post', array($this, 'validate_save_post'), 1);
|
14 |
|
@@ -36,6 +51,17 @@ class acfe_form_front{
|
|
36 |
if(!$form_name || !$form_id)
|
37 |
return;
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
// Honeypot
|
40 |
if(!empty($acf['_validate_email'])){
|
41 |
|
@@ -46,6 +72,34 @@ class acfe_form_front{
|
|
46 |
// Validation
|
47 |
acf_setup_meta($_POST['acf'], 'acfe_form_validation', true);
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
do_action('acfe/form/validation', $form, $post_id);
|
50 |
do_action('acfe/form/validation/form=' . $form_name, $form, $post_id);
|
51 |
|
@@ -136,7 +190,7 @@ class acfe_form_front{
|
|
136 |
// redirect
|
137 |
if($return){
|
138 |
|
139 |
-
$return = acfe_form_map_field_value($return, $
|
140 |
|
141 |
// redirect
|
142 |
wp_redirect($return);
|
@@ -187,11 +241,13 @@ class acfe_form_front{
|
|
187 |
'form_id' => $form_id,
|
188 |
'post_id' => acf_get_valid_post_id(),
|
189 |
'field_groups' => false,
|
|
|
190 |
'post_field_groups' => false,
|
191 |
'form' => true,
|
192 |
'form_attributes' => array(),
|
193 |
'fields_attributes' => array(),
|
194 |
'html_before_fields' => '',
|
|
|
195 |
'custom_html' => '',
|
196 |
'html_after_fields' => '',
|
197 |
'form_submit' => true,
|
@@ -202,6 +258,7 @@ class acfe_form_front{
|
|
202 |
// Submission
|
203 |
'hide_error' => '',
|
204 |
'hide_unload' => '',
|
|
|
205 |
'errors_position' => 'above',
|
206 |
'errors_class' => '',
|
207 |
'updated_message' => __('Post updated', 'acf'),
|
@@ -228,7 +285,9 @@ class acfe_form_front{
|
|
228 |
'action' => '',
|
229 |
'method' => 'post',
|
230 |
'data-fields-class' => '',
|
|
|
231 |
'data-hide-error' => '',
|
|
|
232 |
'data-errors-position' => '',
|
233 |
'data-errors-class' => '',
|
234 |
));
|
@@ -240,6 +299,7 @@ class acfe_form_front{
|
|
240 |
|
241 |
// Field Groups
|
242 |
$defaults['field_groups'] = get_field('acfe_form_field_groups', $form_id);
|
|
|
243 |
$defaults['post_field_groups'] = get_field('acfe_form_post_field_groups', $form_id);
|
244 |
|
245 |
// General
|
@@ -262,6 +322,7 @@ class acfe_form_front{
|
|
262 |
$defaults['fields_attributes']['class'] = $acfe_form_fields_attributes['acfe_form_fields_class'];
|
263 |
|
264 |
$defaults['html_before_fields'] = get_field('acfe_form_html_before_fields', $form_id);
|
|
|
265 |
$defaults['custom_html'] = get_field('acfe_form_custom_html', $form_id);
|
266 |
$defaults['html_after_fields'] = get_field('acfe_form_html_after_fields', $form_id);
|
267 |
$defaults['form_submit'] = get_field('acfe_form_form_submit', $form_id);
|
@@ -274,6 +335,7 @@ class acfe_form_front{
|
|
274 |
$defaults['errors_class'] = get_field('acfe_form_errors_class', $form_id);
|
275 |
$defaults['hide_error'] = get_field('acfe_form_hide_error', $form_id);
|
276 |
$defaults['hide_unload'] = get_field('acfe_form_hide_unload', $form_id);
|
|
|
277 |
|
278 |
// Submission
|
279 |
$defaults['updated_message'] = get_field('acfe_form_updated_message', $form_id);
|
@@ -303,6 +365,9 @@ class acfe_form_front{
|
|
303 |
if(!empty($args['hide_unload']))
|
304 |
$args['form_attributes']['data-hide-unload'] = $args['hide_unload'];
|
305 |
|
|
|
|
|
|
|
306 |
if(!empty($args['errors_position']))
|
307 |
$args['form_attributes']['data-errors-position'] = $args['errors_position'];
|
308 |
|
@@ -316,23 +381,27 @@ class acfe_form_front{
|
|
316 |
// Load
|
317 |
if(have_rows('acfe_form_actions', $form_id)):
|
318 |
while(have_rows('acfe_form_actions', $form_id)): the_row();
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
|
|
|
|
|
|
|
|
336 |
|
337 |
endwhile;
|
338 |
endif;
|
@@ -356,60 +425,12 @@ class acfe_form_front{
|
|
356 |
// load acf scripts
|
357 |
acf_enqueue_scripts();
|
358 |
|
359 |
-
//
|
360 |
-
|
361 |
-
$fields = array();
|
362 |
-
|
363 |
-
// Post Field groups
|
364 |
-
if($args['post_field_groups']){
|
365 |
|
366 |
-
|
367 |
-
$post_field_groups = acf_get_field_groups(array(
|
368 |
-
'post_id' => $args['post_field_groups']
|
369 |
-
));
|
370 |
-
|
371 |
-
$args['field_groups'] = wp_list_pluck($post_field_groups, 'key');
|
372 |
|
373 |
-
|
374 |
-
|
375 |
-
// Field groups
|
376 |
-
if($args['field_groups']){
|
377 |
-
|
378 |
-
foreach($args['field_groups'] as $selector){
|
379 |
-
|
380 |
-
// Bypass Author Module
|
381 |
-
if($selector === 'group_acfe_author')
|
382 |
-
continue;
|
383 |
-
|
384 |
-
$field_groups[] = acf_get_field_group($selector);
|
385 |
-
|
386 |
-
}
|
387 |
-
|
388 |
-
}
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
//load fields based on field groups
|
394 |
-
if(!empty($field_groups)){
|
395 |
-
|
396 |
-
foreach($field_groups as $field_group){
|
397 |
-
|
398 |
-
$field_group_fields = acf_get_fields($field_group);
|
399 |
-
|
400 |
-
if(!empty($field_group_fields)){
|
401 |
-
|
402 |
-
foreach(array_keys($field_group_fields) as $i){
|
403 |
-
|
404 |
-
$fields[] = acf_extract_var($field_group_fields, $i);
|
405 |
-
|
406 |
-
}
|
407 |
-
|
408 |
-
}
|
409 |
-
|
410 |
-
}
|
411 |
-
|
412 |
-
}
|
413 |
|
414 |
// honeypot
|
415 |
if($args['honeypot']){
|
@@ -449,7 +470,7 @@ class acfe_form_front{
|
|
449 |
|
450 |
if(acf_maybe_get_POST('acf')){
|
451 |
|
452 |
-
$message = acfe_form_map_field_value($args['updated_message'], $
|
453 |
|
454 |
}
|
455 |
|
@@ -523,7 +544,15 @@ class acfe_form_front{
|
|
523 |
}
|
524 |
|
525 |
// uploader (always set incase of multiple forms on the page)
|
526 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
|
528 |
// display form
|
529 |
if($args['form']): ?>
|
@@ -548,14 +577,103 @@ class acfe_form_front{
|
|
548 |
echo $args['html_before_fields'];
|
549 |
|
550 |
// Custom HTML
|
551 |
-
if(!empty($args['custom_html'])){
|
552 |
|
553 |
-
echo acfe_form_render_fields($args['custom_html'],
|
554 |
|
555 |
}
|
556 |
|
557 |
// Normal Render
|
558 |
else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
|
560 |
acf_render_fields($fields, false, $args['field_el'], $args['instruction_placement']);
|
561 |
|
@@ -598,6 +716,9 @@ class acfe_form_front{
|
|
598 |
'id' => false
|
599 |
), $atts, 'acfe_form');
|
600 |
|
|
|
|
|
|
|
601 |
if(!empty($atts['name'])){
|
602 |
|
603 |
ob_start();
|
9 |
|
10 |
function __construct(){
|
11 |
|
12 |
+
// vars
|
13 |
+
$this->fields = array(
|
14 |
+
|
15 |
+
'_validate_email' => array(
|
16 |
+
'prefix' => 'acf',
|
17 |
+
'name' => '_validate_email',
|
18 |
+
'key' => '_validate_email',
|
19 |
+
'label' => __('Validate Email', 'acf'),
|
20 |
+
'type' => 'text',
|
21 |
+
'value' => '',
|
22 |
+
'wrapper' => array('style' => 'display:none !important;')
|
23 |
+
)
|
24 |
+
|
25 |
+
);
|
26 |
+
|
27 |
// Validation
|
28 |
add_action('acf/validate_save_post', array($this, 'validate_save_post'), 1);
|
29 |
|
51 |
if(!$form_name || !$form_id)
|
52 |
return;
|
53 |
|
54 |
+
foreach($this->fields as $k => $field){
|
55 |
+
|
56 |
+
// bail early if no in $_POST
|
57 |
+
if(!isset($_POST['acf'][ $k ]))
|
58 |
+
continue;
|
59 |
+
|
60 |
+
// register
|
61 |
+
acf_add_local_field($field);
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
// Honeypot
|
66 |
if(!empty($acf['_validate_email'])){
|
67 |
|
72 |
// Validation
|
73 |
acf_setup_meta($_POST['acf'], 'acfe_form_validation', true);
|
74 |
|
75 |
+
// Actions
|
76 |
+
if(have_rows('acfe_form_actions', $form_id)):
|
77 |
+
|
78 |
+
while(have_rows('acfe_form_actions', $form_id)): the_row();
|
79 |
+
|
80 |
+
$action = get_row_layout();
|
81 |
+
$alias = get_sub_field('acfe_form_custom_alias');
|
82 |
+
|
83 |
+
// Custom Action
|
84 |
+
if($action === 'custom'){
|
85 |
+
|
86 |
+
$action = get_sub_field('acfe_form_custom_action');
|
87 |
+
$alias = '';
|
88 |
+
|
89 |
+
}
|
90 |
+
|
91 |
+
do_action('acfe/form/validation/' . $action, $form, $post_id, $alias);
|
92 |
+
do_action('acfe/form/validation/' . $action . '/form=' . $form_name, $form, $post_id, $alias);
|
93 |
+
|
94 |
+
if(!empty($alias)){
|
95 |
+
|
96 |
+
do_action('acfe/form/validation/' . $action . '/action=' . $alias, $form, $post_id, $alias);
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
+
endwhile;
|
101 |
+
endif;
|
102 |
+
|
103 |
do_action('acfe/form/validation', $form, $post_id);
|
104 |
do_action('acfe/form/validation/form=' . $form_name, $form, $post_id);
|
105 |
|
190 |
// redirect
|
191 |
if($return){
|
192 |
|
193 |
+
$return = acfe_form_map_field_value($return, $post_id, $form);
|
194 |
|
195 |
// redirect
|
196 |
wp_redirect($return);
|
241 |
'form_id' => $form_id,
|
242 |
'post_id' => acf_get_valid_post_id(),
|
243 |
'field_groups' => false,
|
244 |
+
'field_groups_rules' => false,
|
245 |
'post_field_groups' => false,
|
246 |
'form' => true,
|
247 |
'form_attributes' => array(),
|
248 |
'fields_attributes' => array(),
|
249 |
'html_before_fields' => '',
|
250 |
+
'custom_html_enabled' => '',
|
251 |
'custom_html' => '',
|
252 |
'html_after_fields' => '',
|
253 |
'form_submit' => true,
|
258 |
// Submission
|
259 |
'hide_error' => '',
|
260 |
'hide_unload' => '',
|
261 |
+
'hide_revalidation' => '',
|
262 |
'errors_position' => 'above',
|
263 |
'errors_class' => '',
|
264 |
'updated_message' => __('Post updated', 'acf'),
|
285 |
'action' => '',
|
286 |
'method' => 'post',
|
287 |
'data-fields-class' => '',
|
288 |
+
'data-hide-unload' => '',
|
289 |
'data-hide-error' => '',
|
290 |
+
'data-hide-revalidation'=> '',
|
291 |
'data-errors-position' => '',
|
292 |
'data-errors-class' => '',
|
293 |
));
|
299 |
|
300 |
// Field Groups
|
301 |
$defaults['field_groups'] = get_field('acfe_form_field_groups', $form_id);
|
302 |
+
$defaults['field_groups_rules'] = get_field('acfe_form_field_groups_rules', $form_id);
|
303 |
$defaults['post_field_groups'] = get_field('acfe_form_post_field_groups', $form_id);
|
304 |
|
305 |
// General
|
322 |
$defaults['fields_attributes']['class'] = $acfe_form_fields_attributes['acfe_form_fields_class'];
|
323 |
|
324 |
$defaults['html_before_fields'] = get_field('acfe_form_html_before_fields', $form_id);
|
325 |
+
$defaults['custom_html_enabled'] = get_field('acfe_form_custom_html_enable', $form_id);
|
326 |
$defaults['custom_html'] = get_field('acfe_form_custom_html', $form_id);
|
327 |
$defaults['html_after_fields'] = get_field('acfe_form_html_after_fields', $form_id);
|
328 |
$defaults['form_submit'] = get_field('acfe_form_form_submit', $form_id);
|
335 |
$defaults['errors_class'] = get_field('acfe_form_errors_class', $form_id);
|
336 |
$defaults['hide_error'] = get_field('acfe_form_hide_error', $form_id);
|
337 |
$defaults['hide_unload'] = get_field('acfe_form_hide_unload', $form_id);
|
338 |
+
$defaults['hide_revalidation'] = get_field('acfe_form_hide_revalidation', $form_id);
|
339 |
|
340 |
// Submission
|
341 |
$defaults['updated_message'] = get_field('acfe_form_updated_message', $form_id);
|
365 |
if(!empty($args['hide_unload']))
|
366 |
$args['form_attributes']['data-hide-unload'] = $args['hide_unload'];
|
367 |
|
368 |
+
if(!empty($args['hide_revalidation']))
|
369 |
+
$args['form_attributes']['data-hide-revalidation'] = $args['hide_revalidation'];
|
370 |
+
|
371 |
if(!empty($args['errors_position']))
|
372 |
$args['form_attributes']['data-errors-position'] = $args['errors_position'];
|
373 |
|
381 |
// Load
|
382 |
if(have_rows('acfe_form_actions', $form_id)):
|
383 |
while(have_rows('acfe_form_actions', $form_id)): the_row();
|
384 |
+
|
385 |
+
$action = get_row_layout();
|
386 |
+
|
387 |
+
$alias = get_sub_field('acfe_form_custom_alias');
|
388 |
+
|
389 |
+
// Custom Action
|
390 |
+
if($action === 'custom'){
|
391 |
+
|
392 |
+
$action = get_sub_field('acfe_form_custom_action');
|
393 |
+
$alias = '';
|
394 |
+
|
395 |
+
}
|
396 |
+
|
397 |
+
$args = apply_filters('acfe/form/load/' . $action, $args, $args['post_id'], $alias);
|
398 |
+
$args = apply_filters('acfe/form/load/' . $action . '/form=' . $form_name, $args, $args['post_id'], $alias);
|
399 |
+
|
400 |
+
if(!empty($alias)){
|
401 |
+
|
402 |
+
$args = apply_filters('acfe/form/load/action=' . $alias, $args, $args['post_id']);
|
403 |
+
|
404 |
+
}
|
405 |
|
406 |
endwhile;
|
407 |
endif;
|
425 |
// load acf scripts
|
426 |
acf_enqueue_scripts();
|
427 |
|
428 |
+
// Register local fields.
|
429 |
+
foreach($this->fields as $k => $field){
|
|
|
|
|
|
|
|
|
430 |
|
431 |
+
acf_add_local_field($field);
|
|
|
|
|
|
|
|
|
|
|
432 |
|
433 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
434 |
|
435 |
// honeypot
|
436 |
if($args['honeypot']){
|
470 |
|
471 |
if(acf_maybe_get_POST('acf')){
|
472 |
|
473 |
+
$message = acfe_form_map_field_value($args['updated_message'], $args['post_id'], $args);
|
474 |
|
475 |
}
|
476 |
|
544 |
}
|
545 |
|
546 |
// uploader (always set incase of multiple forms on the page)
|
547 |
+
acf_disable_filter('acfe/form/uploader');
|
548 |
+
|
549 |
+
if($args['uploader'] !== 'default'){
|
550 |
+
|
551 |
+
acf_enable_filter('acfe/form/uploader');
|
552 |
+
|
553 |
+
acf_update_setting('uploader', $args['uploader']);
|
554 |
+
|
555 |
+
}
|
556 |
|
557 |
// display form
|
558 |
if($args['form']): ?>
|
577 |
echo $args['html_before_fields'];
|
578 |
|
579 |
// Custom HTML
|
580 |
+
if(!empty($args['custom_html_enabled']) && !empty($args['custom_html'])){
|
581 |
|
582 |
+
echo acfe_form_render_fields($args['custom_html'], $args['post_id'], $args);
|
583 |
|
584 |
}
|
585 |
|
586 |
// Normal Render
|
587 |
else{
|
588 |
+
|
589 |
+
// vars
|
590 |
+
$field_groups = array();
|
591 |
+
$fields = array();
|
592 |
+
|
593 |
+
// Post Field groups (Deprecated)
|
594 |
+
if($args['post_field_groups']){
|
595 |
+
|
596 |
+
// Override Field Groups
|
597 |
+
$post_field_groups = acf_get_field_groups(array(
|
598 |
+
'post_id' => $args['post_field_groups']
|
599 |
+
));
|
600 |
+
|
601 |
+
$args['field_groups'] = wp_list_pluck($post_field_groups, 'key');
|
602 |
+
|
603 |
+
}
|
604 |
+
|
605 |
+
// Field groups
|
606 |
+
if($args['field_groups']){
|
607 |
+
|
608 |
+
foreach($args['field_groups'] as $selector){
|
609 |
+
|
610 |
+
// Bypass Author Module
|
611 |
+
if($selector === 'group_acfe_author')
|
612 |
+
continue;
|
613 |
+
|
614 |
+
$field_groups[] = acf_get_field_group($selector);
|
615 |
+
|
616 |
+
}
|
617 |
+
|
618 |
+
}
|
619 |
+
|
620 |
+
// Apply Field Groups Rules
|
621 |
+
if($args['field_groups_rules']){
|
622 |
+
|
623 |
+
if(!empty($field_groups)){
|
624 |
+
|
625 |
+
$post_id = get_the_ID();
|
626 |
+
|
627 |
+
$filter = array(
|
628 |
+
'post_id' => $post_id,
|
629 |
+
'post_type' => get_post_type($post_id),
|
630 |
+
);
|
631 |
+
|
632 |
+
$filtered = array();
|
633 |
+
|
634 |
+
foreach($field_groups as $field_group){
|
635 |
+
|
636 |
+
// Deleted field group
|
637 |
+
if(!isset($field_group['location']))
|
638 |
+
continue;
|
639 |
+
|
640 |
+
// Force active
|
641 |
+
$field_group['active'] = true;
|
642 |
+
|
643 |
+
if(acf_get_field_group_visibility($field_group, $filter)){
|
644 |
+
|
645 |
+
$filtered[] = $field_group;
|
646 |
+
|
647 |
+
}
|
648 |
+
|
649 |
+
}
|
650 |
+
|
651 |
+
$field_groups = $filtered;
|
652 |
+
|
653 |
+
}
|
654 |
+
|
655 |
+
}
|
656 |
+
|
657 |
+
//load fields based on field groups
|
658 |
+
if(!empty($field_groups)){
|
659 |
+
|
660 |
+
foreach($field_groups as $field_group){
|
661 |
+
|
662 |
+
$field_group_fields = acf_get_fields($field_group);
|
663 |
+
|
664 |
+
if(!empty($field_group_fields)){
|
665 |
+
|
666 |
+
foreach(array_keys($field_group_fields) as $i){
|
667 |
+
|
668 |
+
$fields[] = acf_extract_var($field_group_fields, $i);
|
669 |
+
|
670 |
+
}
|
671 |
+
|
672 |
+
}
|
673 |
+
|
674 |
+
}
|
675 |
+
|
676 |
+
}
|
677 |
|
678 |
acf_render_fields($fields, false, $args['field_el'], $args['instruction_placement']);
|
679 |
|
716 |
'id' => false
|
717 |
), $atts, 'acfe_form');
|
718 |
|
719 |
+
if(is_admin())
|
720 |
+
return;
|
721 |
+
|
722 |
if(!empty($atts['name'])){
|
723 |
|
724 |
ob_start();
|
init.php
CHANGED
@@ -1,75 +1,85 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if(!defined('ABSPATH'))
|
4 |
-
exit;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* ACFE: Include
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
}
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
<?php
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* ACFE: Include
|
8 |
+
*
|
9 |
+
* @param string $filename
|
10 |
+
*/
|
11 |
+
function acfe_include($filename = ''){
|
12 |
+
|
13 |
+
$file_path = ACFE_PATH . ltrim($filename, '/');
|
14 |
+
|
15 |
+
if(file_exists($file_path)){
|
16 |
+
|
17 |
+
include_once($file_path);
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* ACFE: Get URL
|
25 |
+
*
|
26 |
+
* @param string $filename
|
27 |
+
*
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
function acfe_get_url($filename = ''){
|
31 |
+
|
32 |
+
if(!defined('ACFE_URL')){
|
33 |
+
|
34 |
+
define('ACFE_URL', acf_get_setting('acfe/url'));
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
return ACFE_URL . ltrim($filename, '/');
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* ACFE: ACF Pro Check
|
43 |
+
*
|
44 |
+
* @param $plugin_file
|
45 |
+
* @param $plugin_data
|
46 |
+
* @param $status
|
47 |
+
*/
|
48 |
+
add_action('after_plugin_row_' . ACFE_BASENAME, 'acfe_plugin_row', 5, 3);
|
49 |
+
function acfe_plugin_row($plugin_file, $plugin_data, $status){
|
50 |
+
|
51 |
+
if(acfe()->has_acf())
|
52 |
+
return;
|
53 |
+
|
54 |
+
?>
|
55 |
+
|
56 |
+
<style>
|
57 |
+
.plugins tr[data-plugin='<?php echo ACFE_BASENAME; ?>'] th,
|
58 |
+
.plugins tr[data-plugin='<?php echo ACFE_BASENAME; ?>'] td{
|
59 |
+
box-shadow:none;
|
60 |
+
}
|
61 |
+
|
62 |
+
<?php if(isset($plugin_data['update']) && !empty($plugin_data['update'])){ ?>
|
63 |
+
|
64 |
+
.plugins tr.acfe-plugin-tr td{
|
65 |
+
box-shadow:none !important;
|
66 |
+
}
|
67 |
+
|
68 |
+
.plugins tr.acfe-plugin-tr .update-message{
|
69 |
+
margin-bottom:0;
|
70 |
+
}
|
71 |
+
|
72 |
+
<?php } ?>
|
73 |
+
</style>
|
74 |
+
|
75 |
+
<tr class="plugin-update-tr active acfe-plugin-tr">
|
76 |
+
<td colspan="3" class="plugin-update colspanchange">
|
77 |
+
<div class="update-message notice inline notice-error notice-alt">
|
78 |
+
<p><?php _e('ACF Extended requires Advanced Custom Fields PRO (minimum: 5.7.10).', 'acfe'); ?></p>
|
79 |
+
</div>
|
80 |
+
</td>
|
81 |
+
</tr>
|
82 |
+
|
83 |
+
<?php
|
84 |
+
|
85 |
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: acf, custom fields, meta, admin, fields, form, repeater, content
|
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 0.8.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -121,7 +121,7 @@ Display field group on the post type archive (option page). The post type argume
|
|
121 |
Display and filter field groups categories
|
122 |
|
123 |
* **Column: Locations**
|
124 |
-
Quick view of field groups locations
|
125 |
|
126 |
* **Column: Load**
|
127 |
Quick view of field groups data load source (DB, PHP or Json)
|
@@ -135,10 +135,10 @@ One-click export for each field groups
|
|
135 |
* **Row action: Field group key**
|
136 |
Quick view of field groups keys
|
137 |
|
138 |
-
= ACF: Field Groups -
|
139 |
|
140 |
-
* **
|
141 |
-
Display local field groups
|
142 |
|
143 |
* **Export**
|
144 |
Export local field groups into PHP or Json
|
@@ -160,7 +160,7 @@ A more sophisticated field settings based on specified location (administration/
|
|
160 |
A more sophisticated validation conditions (AND/OR) with custom error messages based on specified location (administration/front-end). The field group "Advanced settings" must be turned ON.
|
161 |
|
162 |
* **Permissions**
|
163 |
-
Add permission layer to fields. Choose which roles can view & edit fields in the post edition screen. (can be
|
164 |
|
165 |
* **Save as Meta**
|
166 |
Exclude the field from the "Single Meta Save" compression feature. The global ACF setting "Single Meta Save" must be turned ON.
|
@@ -173,6 +173,9 @@ Display raw field data in a modal to check your configuration & settings
|
|
173 |
* **Field Clone: Edit in modal**
|
174 |
Allow users to edit clone fields in a modal. Choose the edit button text, display close button and the modal size
|
175 |
|
|
|
|
|
|
|
176 |
* **Field File: Uploader type**
|
177 |
Choose the uploader type: Basic or native WP uploader
|
178 |
|
@@ -198,7 +201,10 @@ Disable sortable rows using `filter('acfe/repeater/lock/name=my_repeater', true,
|
|
198 |
Remove the actions buttons using `filter('acfe/repeater/remove_actions/name=my_repeater', true, $field)`
|
199 |
|
200 |
* **Field Select: Placeholder**
|
201 |
-
Change the default "Select" placeholder text
|
|
|
|
|
|
|
202 |
|
203 |
* **Field Textarea: Code mode**
|
204 |
Switch font family to monospace and allow tab indent
|
@@ -206,13 +212,13 @@ Switch font family to monospace and allow tab indent
|
|
206 |
= ACF: New Fields =
|
207 |
|
208 |
* **New Field: Advanced Link**
|
209 |
-
Display a modern Link Selection in a modal. Post selection can be filtered
|
210 |
|
211 |
* **New Field: Button**
|
212 |
Display a custom submit or button. Built-in ajax call setting. Usage example available in the field administration
|
213 |
|
214 |
* **New Field: Code Editor**
|
215 |
-
Edit code using the native WP Core Codemirror library
|
216 |
|
217 |
* **New Field: Columns**
|
218 |
Re-arrange fields administration using columns
|
@@ -242,7 +248,7 @@ A slug text input (ie: `my-text-input`)
|
|
242 |
Select any taxonomy (format: checkbox, radio or select)
|
243 |
|
244 |
* **New Field: Taxonomy Terms selection**
|
245 |
-
Select any terms of any taxonomies, allow specific terms, level or
|
246 |
|
247 |
* **New Field: User roles selection**
|
248 |
Select any user role (format: checkbox, radio or select)
|
@@ -327,7 +333,7 @@ Manage ACF Block Types from ACF > Block Types.
|
|
327 |
* Empty Message: Change the native Flexible Content 'Click the Add Row button below...' message
|
328 |
* Layouts Thumbnails: Add thumbnails for each layout in the layout selection
|
329 |
* Layouts Settings: Choose a field group to clone and to be used as a layout configuration modal in the administration
|
330 |
-
* Layouts Render: Add `template.php`, `style.css` & `script.js` files settings for each layout. Those settings can be then accessed in the front-end ([More
|
331 |
* Layouts Dynamic Preview: Edit & Preview Layouts on-the-fly from your WordPress administration, just like in Gutenberg (Layouts Render must be turned ON)
|
332 |
* Modal Edition: Edit layouts in a modal
|
333 |
* Modal Selection: Change the layout selection into a modal
|
@@ -340,7 +346,7 @@ Manage ACF Block Types from ACF > Block Types.
|
|
340 |
* Layouts: Hide "Add Layout" buttons
|
341 |
* Layouts: Hide "Remove Layout" buttons. Can also be done using `filter('acfe/flexible/remove_actions/name=my_flexible', true, $field)`
|
342 |
* Lock Layouts: Disable sortable Layouts. Can also be done using `filter('acfe/flexible/lock/name=my_flexible', true, $field)`
|
343 |
-
* Button Label: Supports Dashicons icons
|
344 |
* One Click: the 'Add row' button will add a layout without the selection modal if there is only one layout available in the flexible content
|
345 |
* Asynchronous Layouts: Add layouts using Ajax method. This setting increase performance on complex Flexible Content
|
346 |
* Disable Legacy Layout Title Ajax: Disable the native ACF Layout Title Ajax call on `acf/fields/flexible_content/layout_title`.
|
@@ -358,7 +364,7 @@ Manage ACF Forms from your WordPress administration. All ACF Form settings are a
|
|
358 |
* Add multiple actions on form submission:
|
359 |
* Create or Update Posts
|
360 |
* Create or Update Terms
|
361 |
-
* Create or
|
362 |
* Send multiple e-mails
|
363 |
* Trigger custom PHP actions
|
364 |
* Integration, validation & custom submission examples in the administration
|
@@ -387,7 +393,7 @@ function my_acfe_modules(){
|
|
387 |
}
|
388 |
`
|
389 |
|
390 |
-
Note: It is possible to revert back to the native ACF save process. To do so, keep the feature enabled, get in the post administration you want to revert back. Disable the feature in your code, and save the post. All data will be saved back to individual meta
|
391 |
|
392 |
== ❤️ Supporters ==
|
393 |
|
@@ -465,11 +471,11 @@ Usage example: `the_flexible('my_flexible');`.
|
|
465 |
|
466 |
When using this function, you have access to the following global variables: `$layout`, `$field` & `$is_preview` (when Dynamic Preview setting is enabled).
|
467 |
|
468 |
-
[More
|
469 |
|
470 |
= How the Flexible Content: Dynamic Preview works? =
|
471 |
|
472 |
-
[More
|
473 |
|
474 |
= How to change the Flexible Content: Thumbnails URL in PHP? =
|
475 |
|
@@ -683,6 +689,61 @@ function my_acfe_modules(){
|
|
683 |
|
684 |
== Changelog ==
|
685 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
686 |
= 0.8.4.6 =
|
687 |
* Field: Taxonomy Terms - Fixed a problem with value return when "Load Terms" was enabled
|
688 |
* General: Modal - Fixed z-index problem with WP attachment modal
|
@@ -726,7 +787,7 @@ function my_acfe_modules(){
|
|
726 |
* Field: Flexible Content - Fixed Dynamic Preview overlay z-index
|
727 |
|
728 |
= 0.8.4 =
|
729 |
-
* Module: Added Single Meta Save feature - Compress all fields values from the current post, term or user into one single meta data. This feature is disabled by default, to enable it, use `acf_update_setting('acfe/modules/single_meta', true);`. More
|
730 |
* Module: Dynamic Post Types - Added `while(have_archive()): the_archive();` logic when the "Admin Archive Page" setting is turned on. This template tags can be used in the `archive-post-type.php` template which makes `get_field('my_field')` calls easier
|
731 |
* Module: Dynamic Post Types/Taxonomies - Fixed Posts/Terms column data when object was trashed.
|
732 |
* Module: PHP AutoSync - PHP sync files are now removed when the field group is disabled/trashed.
|
@@ -775,7 +836,7 @@ function my_acfe_modules(){
|
|
775 |
= 0.8.3 =
|
776 |
* Field: Advanced Link - Added "Allowed Post Types" & "Allowed Taxonomies" setting to filter allowed Post types & Taxonomy terms in the post selection
|
777 |
* Field: Flexible Content - Categories in the Layouts Selection Modal are now sticky, the vertical scrollbar is now applied to layouts (Thanks @Damien C.)
|
778 |
-
* Field: Flexible Content - Added filter to disable a potentially
|
779 |
* Field: Flexible Content - Fixed Layout Title Edition input which could disappear in some rare cases
|
780 |
* Field: Flexible Content - Fixed `z-index` CSS conflict in modals when the flexible content was inside an accordion field (Thanks @Damian P.)
|
781 |
* Field: Flexible Content - Fixed `border-bottom` CSS on layout handle when edition modal is set to ON
|
@@ -790,7 +851,7 @@ function my_acfe_modules(){
|
|
790 |
* Fields Groups: Fixed Json/PHP Sync warnings that were not properly checking the ACF setting `load_json` paths (Thanks @doublesharp)
|
791 |
* Fields Groups: Added Export Json & PHP in the Field Group single view (sidebar)
|
792 |
* Fields Groups: Categories are now synced with field groups during the export/import process
|
793 |
-
* Module: Author - Fixed duplicated post revision when
|
794 |
* Module: Author - Fixed an issue where the module would not show up on post types which are registered using a priority higher or equal to 5 (Thanks @yangkennyk)
|
795 |
* Module: Dev Mode - Added fields counter in the metabox title (Feature request: @Damien C.)
|
796 |
* Module: Dynamic Forms - Added the ability to use `{field:field_name}` & `{field:field_key}` values in the "Updated message" setting (Feature request: @alexene22)
|
@@ -821,7 +882,7 @@ function my_acfe_modules(){
|
|
821 |
* Field: Flexible Content - Updated JS filters & added variations `acf.doAction('acfe/fields/flexible_content/preview/name=my_flexible&layout=my_layout', response, flexible.$el, $layout, ajaxData)`
|
822 |
* Field: Flexible Content - Fixed "Remove Collapse" setting not working on newly added layout (Moved RemoveCollapse from acf-extended-fc-control.js to acf-extended-fc.js (acfe/flexible/layouts))
|
823 |
* Fields: Fields are now registered using `acf_register_field_type()`. This will allow developers to use `acf_get_field_type('acfe_field')`
|
824 |
-
* Fields settings: Bidirectional - Added filter which allow to force related field to be updated when migrating from already
|
825 |
* Fields settings: Bidirectional - Added `filter('acfe/bidirectional/force_update/name=my_field', true, $field, $post_id)` (available with /type & /key) (Feature request: @anjanphukan)
|
826 |
* Field Groups: Fixed CSS which wrongly hide instructions when there's no field label (Thanks @Damien C.)
|
827 |
* Field Groups: Third Party - Added PHP filter to change source column output `filter('acfe/field_groups_third_party/source', $source, $post_id, $field_group)`
|
@@ -991,7 +1052,7 @@ function my_acfe_modules(){
|
|
991 |
* Field: Flexible Content - Added `filter('acfe/flexible/render/template', $template, $field, $layout, $is_preview)` to change Layout Render: Template Path (with 6 variations)
|
992 |
* Field: Flexible Content - Added `filter('acfe/flexible/render/style', $style, $field, $layout, $is_preview)` to change Layout Render: Style Path (with 6 variations)
|
993 |
* Field: Flexible Content - Added `filter('acfe/flexible/render/script', $script, $field, $layout, $is_preview)` to change Layout Render: Script Path (with 6 variations)
|
994 |
-
* Field: Flexible Content - Added `filter('acfe/flexible/placeholder/icon', $class, $field)` to change the Placeholder Button
|
995 |
* Module: Dynamic Options Page - Fixed 'Undefined $post_id' PHP warning in Dynamic Options Page screen
|
996 |
* Module: Dynamic Options Page - Fixed registration order for child options pages (thanks @Val)
|
997 |
* Module: Dynamic Post Type - Fixed undefined ID php Warning on edit screen when Dynamic Post Type is registered locally (thanks @Val)
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 0.8.5
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
121 |
Display and filter field groups categories
|
122 |
|
123 |
* **Column: Locations**
|
124 |
+
Quick view of field groups locations information using icons & popover
|
125 |
|
126 |
* **Column: Load**
|
127 |
Quick view of field groups data load source (DB, PHP or Json)
|
135 |
* **Row action: Field group key**
|
136 |
Quick view of field groups keys
|
137 |
|
138 |
+
= ACF: Field Groups - Local =
|
139 |
|
140 |
+
* **Local**
|
141 |
+
Display local field groups that are loaded by ACF, but not available in the ACF field group administration. Example: a field group is registered locally in the `functions.php` file, but not in ACF
|
142 |
|
143 |
* **Export**
|
144 |
Export local field groups into PHP or Json
|
160 |
A more sophisticated validation conditions (AND/OR) with custom error messages based on specified location (administration/front-end). The field group "Advanced settings" must be turned ON.
|
161 |
|
162 |
* **Permissions**
|
163 |
+
Add permission layer to fields. Choose which roles can view & edit fields in the post edition screen. (can be combined with field groups permissions)
|
164 |
|
165 |
* **Save as Meta**
|
166 |
Exclude the field from the "Single Meta Save" compression feature. The global ACF setting "Single Meta Save" must be turned ON.
|
173 |
* **Field Clone: Edit in modal**
|
174 |
Allow users to edit clone fields in a modal. Choose the edit button text, display close button and the modal size
|
175 |
|
176 |
+
* **Field Datepicker/Datetime picker/Timepicker: Improved UI**
|
177 |
+
Fields interfaces have been improved to display a more modern version
|
178 |
+
|
179 |
* **Field File: Uploader type**
|
180 |
Choose the uploader type: Basic or native WP uploader
|
181 |
|
201 |
Remove the actions buttons using `filter('acfe/repeater/remove_actions/name=my_repeater', true, $field)`
|
202 |
|
203 |
* **Field Select: Placeholder**
|
204 |
+
Change the default "Select" placeholder text and Search Input placeholder
|
205 |
+
|
206 |
+
* **Field Select: Allow custom values**
|
207 |
+
Allow user to enter custom value which will be saved
|
208 |
|
209 |
* **Field Textarea: Code mode**
|
210 |
Switch font family to monospace and allow tab indent
|
212 |
= ACF: New Fields =
|
213 |
|
214 |
* **New Field: Advanced Link**
|
215 |
+
Display a modern Link Selection in a modal. Posts, Post Types Archives & terms selection can be filtered in the field administration. Add custom sub fields using `filter('acfe/fields/advanced_link/sub_fields', $sub_fields, $field, $value)`
|
216 |
|
217 |
* **New Field: Button**
|
218 |
Display a custom submit or button. Built-in ajax call setting. Usage example available in the field administration
|
219 |
|
220 |
* **New Field: Code Editor**
|
221 |
+
Edit code using the native WP Core Codemirror library. Default languages: Text/HTML, Javascript, CSS, PHP mixed/plain.
|
222 |
|
223 |
* **New Field: Columns**
|
224 |
Re-arrange fields administration using columns
|
248 |
Select any taxonomy (format: checkbox, radio or select)
|
249 |
|
250 |
* **New Field: Taxonomy Terms selection**
|
251 |
+
Select any terms of any taxonomies, allow specific terms, level or childrens (format: checkbox or select). Terms can be loaded & saved for the current post (just like the native ACF Taxonomy field)
|
252 |
|
253 |
* **New Field: User roles selection**
|
254 |
Select any user role (format: checkbox, radio or select)
|
333 |
* Empty Message: Change the native Flexible Content 'Click the Add Row button below...' message
|
334 |
* Layouts Thumbnails: Add thumbnails for each layout in the layout selection
|
335 |
* Layouts Settings: Choose a field group to clone and to be used as a layout configuration modal in the administration
|
336 |
+
* Layouts Render: Add `template.php`, `style.css` & `script.js` files settings for each layout. Those settings can be then accessed in the front-end ([More information in the FAQ](#faq))
|
337 |
* Layouts Dynamic Preview: Edit & Preview Layouts on-the-fly from your WordPress administration, just like in Gutenberg (Layouts Render must be turned ON)
|
338 |
* Modal Edition: Edit layouts in a modal
|
339 |
* Modal Selection: Change the layout selection into a modal
|
346 |
* Layouts: Hide "Add Layout" buttons
|
347 |
* Layouts: Hide "Remove Layout" buttons. Can also be done using `filter('acfe/flexible/remove_actions/name=my_flexible', true, $field)`
|
348 |
* Lock Layouts: Disable sortable Layouts. Can also be done using `filter('acfe/flexible/lock/name=my_flexible', true, $field)`
|
349 |
+
* Button Label: Supports Dashicons icons elements `<span>`
|
350 |
* 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
|
351 |
* Asynchronous Layouts: Add layouts using Ajax method. This setting increase performance on complex Flexible Content
|
352 |
* Disable Legacy Layout Title Ajax: Disable the native ACF Layout Title Ajax call on `acf/fields/flexible_content/layout_title`.
|
364 |
* Add multiple actions on form submission:
|
365 |
* Create or Update Posts
|
366 |
* Create or Update Terms
|
367 |
+
* Create Update, or Log Users
|
368 |
* Send multiple e-mails
|
369 |
* Trigger custom PHP actions
|
370 |
* Integration, validation & custom submission examples in the administration
|
393 |
}
|
394 |
`
|
395 |
|
396 |
+
Note: It is possible to revert back to the native ACF save process. To do so, keep the feature enabled, get in the post administration you want to revert back. Disable the feature in your code, and save the post. All data will be saved back to individual meta data.
|
397 |
|
398 |
== ❤️ Supporters ==
|
399 |
|
471 |
|
472 |
When using this function, you have access to the following global variables: `$layout`, `$field` & `$is_preview` (when Dynamic Preview setting is enabled).
|
473 |
|
474 |
+
[More information are available on the official website](https://www.acf-extended.com/post/flexible-content-dynamic-layout-preview)
|
475 |
|
476 |
= How the Flexible Content: Dynamic Preview works? =
|
477 |
|
478 |
+
[More information are available on the official website](https://www.acf-extended.com/post/flexible-content-dynamic-layout-preview)
|
479 |
|
480 |
= How to change the Flexible Content: Thumbnails URL in PHP? =
|
481 |
|
689 |
|
690 |
== Changelog ==
|
691 |
|
692 |
+
= 0.8.5 =
|
693 |
+
* General: Added Settings/Options API
|
694 |
+
* General: Improved modules performance
|
695 |
+
* Module: Dynamic Forms - Improved module UI, fields UI & documentation
|
696 |
+
* Module: Dynamic Forms - Added "Cheatsheet" tab to list all available template tags
|
697 |
+
* Module: Dynamic Forms - Added "Validation" tab
|
698 |
+
* Module: Dynamic Forms - Email Action - Added "Reply-to", "Cc", & "Bcc" fields
|
699 |
+
* Module: Dynamic Forms - Email Action - Added "Delete attachment once sent" setting for each Dynamic attachments
|
700 |
+
* Module: Dynamic Forms - Email Action - Added "Static attachments"
|
701 |
+
* Module: Dynamic Forms - User Action - Added "Log user" action type
|
702 |
+
* Module: Dynamic Forms - Post Action - Terms can now be created on the fly using custom template tags. Example: `My new term|my-taxonomy`
|
703 |
+
* Module: Dynamic Forms - Post Action - Fixed terms not being set correctly when user wasn't logged
|
704 |
+
* Module: Dynamic Forms - Template tags are now allowed everywhere
|
705 |
+
* Module: Dynamic Forms - Added "Apply field groups rules" setting to take field group conditional locations into account
|
706 |
+
* Module: Dynamic Forms - Added a switch on "Form HTML override" to explicity explain this setting is optional
|
707 |
+
* Module: Dynamic Forms - Added `{get_field:field_name}` template tags to retrieve field value from DB. More information in the "Cheatsheet" tab
|
708 |
+
* Module: Dynamic Forms - Added `{current:post/term/user/author/form}` template tags to retrieve current data information. More information in the "Cheatsheet" tab
|
709 |
+
* Module: Dynamic Forms - Added `{current:***}` template tags to retrieve current post/term/user/post author/form information. More information in the "Cheatsheet" tab
|
710 |
+
* Module: Dynamic Forms - Added "Hide successful re-validation notice" setting
|
711 |
+
* Module: Dynamic Forms - Google Map return value is now correctly formatted
|
712 |
+
* Module: Dynamic Forms - Fixed WPML compatibility problem when using "honeypot" field
|
713 |
+
* Module: Dynamic Forms - Fields conditional logic are now working when fields are wrapper within custom div
|
714 |
+
* Module: Dynamic Forms - Added CSS to WP Media modal & cleaned accessibility text
|
715 |
+
* Module: Dynamic Forms - Added "Default Uploader Type" setting (based on field setting)
|
716 |
+
* Module: Dynamic Forms - Fixed Loading value not working correctly on repeaters/groups/flexible content
|
717 |
+
* Module: Dynamic Forms - Added PHP function to easily import form. `acfe_import_dynamic_form($array|$json);`
|
718 |
+
* Module: Dynamic Forms - Fixed shortcode being interpreted in admin view (Gutenberg/Dynamic Ajax Preview)
|
719 |
+
* Module: Dynamic Post Type - Fixed capabilities not being correctly mapped
|
720 |
+
* Module: Dynamic Post Type - Fixed Admin orderby & order not working correctly when `has_archive` was disabled
|
721 |
+
* Module: Dynamic Taxonomy - Fixed capabilities not being correctly mapped
|
722 |
+
* Module: Dynamic Taxonomy - Fixed Front posts per page, orderby & order settings
|
723 |
+
* Module: Dynamic Author - Added better post author ID cast
|
724 |
+
* Module: AutoSync - New fields groups now have Json/PHP AutoSync setting checked by default if the corresponding folder exists
|
725 |
+
* Field: Flexible Content - Modal Categories Selection setting is now using Select2 with tags
|
726 |
+
* Field: Flexible Content - The bottom bar in modal now clear potential floating elements
|
727 |
+
* Field: Flexible Content - Fixed clone function not working correctly with tabs that have conditional logic
|
728 |
+
* Field: Select - Added "## Title" markdown to add option group in field's choices
|
729 |
+
* Field: Select - Added "Allow custom" setting
|
730 |
+
* Field: Select2 - Tweaked CSS to match WordPress 5.3 UI
|
731 |
+
* Field: Select2 - Fixed WPML CSS overriding select2 style
|
732 |
+
* Field: Code Editor - The field now correctly trigger `change()` on input
|
733 |
+
* Field: Code Editor - Added "Max rows" setting
|
734 |
+
* Field: Code Editor - Fixed "Default value" javascript code being executed within the Data modal
|
735 |
+
* Field: Advanced Link - Added Term link types
|
736 |
+
* Field: Advanced Link - Added Post Type Archive link types
|
737 |
+
* Field: Advanced Link - Fixed custom sub fields not working correctly when retrieving values
|
738 |
+
* Field: Advanced Link - Reworked the custom sub fields declaration. It's now easier to add custom fields
|
739 |
+
* Field: reCaptcha - Fixed v2 theme & size settings not working correctly
|
740 |
+
* Field: reCaptcha - Fixed v3 JS error on reset
|
741 |
+
* Field: Datepicker/Datetime picker/Timepicker - Added CSS to match WordPress 5.3 UI
|
742 |
+
* Field Group: Fixed Instructions "Tooltip" mode not working correclty in groups
|
743 |
+
* Field Group: Added pre-rendering CSS for field groups with labels on left, removing potential during admin page load
|
744 |
+
* Field Group: Renamed "Third Party" Field Groups types to "Local"
|
745 |
+
* General: Gutenberg - Fixed CSS for modal
|
746 |
+
|
747 |
= 0.8.4.6 =
|
748 |
* Field: Taxonomy Terms - Fixed a problem with value return when "Load Terms" was enabled
|
749 |
* General: Modal - Fixed z-index problem with WP attachment modal
|
787 |
* Field: Flexible Content - Fixed Dynamic Preview overlay z-index
|
788 |
|
789 |
= 0.8.4 =
|
790 |
+
* Module: Added Single Meta Save feature - Compress all fields values from the current post, term or user into one single meta data. This feature is disabled by default, to enable it, use `acf_update_setting('acfe/modules/single_meta', true);`. More information available in the readme.
|
791 |
* Module: Dynamic Post Types - Added `while(have_archive()): the_archive();` logic when the "Admin Archive Page" setting is turned on. This template tags can be used in the `archive-post-type.php` template which makes `get_field('my_field')` calls easier
|
792 |
* Module: Dynamic Post Types/Taxonomies - Fixed Posts/Terms column data when object was trashed.
|
793 |
* Module: PHP AutoSync - PHP sync files are now removed when the field group is disabled/trashed.
|
836 |
= 0.8.3 =
|
837 |
* Field: Advanced Link - Added "Allowed Post Types" & "Allowed Taxonomies" setting to filter allowed Post types & Taxonomy terms in the post selection
|
838 |
* Field: Flexible Content - Categories in the Layouts Selection Modal are now sticky, the vertical scrollbar is now applied to layouts (Thanks @Damien C.)
|
839 |
+
* Field: Flexible Content - Added filter to disable a potentially unnecessary ACF ajax call when closing a layout: `filter('acfe/flexible/remove_ajax_title/name=my_flexible', false, $field);`
|
840 |
* Field: Flexible Content - Fixed Layout Title Edition input which could disappear in some rare cases
|
841 |
* Field: Flexible Content - Fixed `z-index` CSS conflict in modals when the flexible content was inside an accordion field (Thanks @Damian P.)
|
842 |
* Field: Flexible Content - Fixed `border-bottom` CSS on layout handle when edition modal is set to ON
|
851 |
* Fields Groups: Fixed Json/PHP Sync warnings that were not properly checking the ACF setting `load_json` paths (Thanks @doublesharp)
|
852 |
* Fields Groups: Added Export Json & PHP in the Field Group single view (sidebar)
|
853 |
* Fields Groups: Categories are now synced with field groups during the export/import process
|
854 |
+
* Module: Author - Fixed duplicated post revision when updating an ACF value (Thanks: @François B.)
|
855 |
* Module: Author - Fixed an issue where the module would not show up on post types which are registered using a priority higher or equal to 5 (Thanks @yangkennyk)
|
856 |
* Module: Dev Mode - Added fields counter in the metabox title (Feature request: @Damien C.)
|
857 |
* Module: Dynamic Forms - Added the ability to use `{field:field_name}` & `{field:field_key}` values in the "Updated message" setting (Feature request: @alexene22)
|
882 |
* Field: Flexible Content - Updated JS filters & added variations `acf.doAction('acfe/fields/flexible_content/preview/name=my_flexible&layout=my_layout', response, flexible.$el, $layout, ajaxData)`
|
883 |
* Field: Flexible Content - Fixed "Remove Collapse" setting not working on newly added layout (Moved RemoveCollapse from acf-extended-fc-control.js to acf-extended-fc.js (acfe/flexible/layouts))
|
884 |
* Fields: Fields are now registered using `acf_register_field_type()`. This will allow developers to use `acf_get_field_type('acfe_field')`
|
885 |
+
* Fields settings: Bidirectional - Added filter which allow to force related field to be updated when migrating from already existing values
|
886 |
* Fields settings: Bidirectional - Added `filter('acfe/bidirectional/force_update/name=my_field', true, $field, $post_id)` (available with /type & /key) (Feature request: @anjanphukan)
|
887 |
* Field Groups: Fixed CSS which wrongly hide instructions when there's no field label (Thanks @Damien C.)
|
888 |
* Field Groups: Third Party - Added PHP filter to change source column output `filter('acfe/field_groups_third_party/source', $source, $post_id, $field_group)`
|
1052 |
* Field: Flexible Content - Added `filter('acfe/flexible/render/template', $template, $field, $layout, $is_preview)` to change Layout Render: Template Path (with 6 variations)
|
1053 |
* Field: Flexible Content - Added `filter('acfe/flexible/render/style', $style, $field, $layout, $is_preview)` to change Layout Render: Style Path (with 6 variations)
|
1054 |
* Field: Flexible Content - Added `filter('acfe/flexible/render/script', $script, $field, $layout, $is_preview)` to change Layout Render: Script Path (with 6 variations)
|
1055 |
+
* Field: Flexible Content - Added `filter('acfe/flexible/placeholder/icon', $class, $field)` to change the Placeholder Button Dashicons class (default: 'dashicons dashicons-edit') (with 3 variations)
|
1056 |
* Module: Dynamic Options Page - Fixed 'Undefined $post_id' PHP warning in Dynamic Options Page screen
|
1057 |
* Module: Dynamic Options Page - Fixed registration order for child options pages (thanks @Val)
|
1058 |
* Module: Dynamic Post Type - Fixed undefined ID php Warning on edit screen when Dynamic Post Type is registered locally (thanks @Val)
|