Version Description
ACF Extended Pro 0.8.8.2:
* Field: Added Advanced "Color Picker" field settings with RGBA support, Palette display style, Custom predefined colors & Allow null
* Field: Added "Date Range Picker" field with Custom ranges, No weekends, Min/max date & Min/max days support
* Field: Flexible Content Grid System - Fixed sub Flexible Content Grid CSS bug
* Field: Flexible Content Grid System - Tweaked get_flexible_grid_class()
prefix
* Field: Fields Selector - Added "Field Name" return value setting
* Field: Post Field - Fixed Permalink "Save" & "Cancel" missing text when editing a permalink
* Module: Added "Force Sync" module allowing to automatically sync Json Files to DB with the newest version
* Module: Dynamic Template - Improved instruction
* Module: Global Conditional Logic - Fixed compatibility with Terms & Users screen when Enhanced UI is disabled
ACF Extended Basic 0.8.8.2:
* Field: Clone - Fixed internal ACFE module field groups which where selectable in clone
* Field: Google reCaptcha - Renamed the field to Google reCaptcha
* Field: Post Object - Fixed duplicated post creation when using "Custom Value" setting
* Module: Forms - Fixed Clone Render when using "Override Form Render" settings
* Module: Forms - Fixed "Redirect Action" named hook not working with a custom action name
* Module: Forms - Added render actions hooks
* Module: Forms - Fixed acfe_import_form()
function
* Module: Block Types - Changed the "Mode" setting default value to "Preview", as in the documentation
* Module: Multilang - Options Post ID options
can now be excluded from the module translation
* Module: Multilang - Added acfe/modules/multilang/exclude_options
filter to exclude specific Options Post ID from module translation
* Module: Multilang - Added acfe/modules/multilang/include_options
filter to include specific Options Post ID from module translation
* Module: Multilang - Deprecated the acfe/modules/multilang/options
filter
* Module: Multilang - WPML string translations now use wpml_translate_single_string
instead of __()
* Module: Settings UI - Fixed potential duplicated table thead
columns
* Module: Enhanced UI - Fixed possible metaboxes screen name collision with taxonomy name
* General: ACFE Modal - Fixed show_field
on modal open
* General: ACFE Modal - Fixed possible duplicate field instructions in repeaters
* General: The acfe_get_post_id()
helper now correctly retrieve the Post ID in ACF Block Types
* General: Fixed get_fields()
calls in acfe/save
hooks when a bidirectional value is set
* General: Enhanced Local Meta logic
* General: Enhanced acfe/save
& acfe/validate_save
hooks logic
* General: Code format cleanup
* Compatibility: Added ACFE Field Types to WP GraphQL ACF plugin
Release Info
Developer | hwk-fr |
Plugin | Advanced Custom Fields: Extended |
Version | 0.8.8.2 |
Comparing to | |
See all releases |
Code changes from version 0.8.8.1 to 0.8.8.2
- acf-extended.php +10 -10
- assets/css/acfe-admin.css +2 -2
- assets/css/acfe-admin.min.css +1 -1
- assets/js/acfe-input.js +4 -4
- assets/js/acfe.js +8 -2
- assets/js/acfe.min.js +1 -1
- includes/admin/options.class.php +139 -139
- includes/admin/options.php +8 -8
- includes/admin/settings.php +4 -1
- includes/admin/tools/field-groups-export.php +5 -5
- includes/admin/tools/field-groups-local.php +31 -31
- includes/admin/tools/forms-import.php +2 -2
- includes/admin/tools/module-export.php +44 -44
- includes/admin/tools/module-import.php +37 -37
- includes/admin/views/html-options-edit.php +2 -2
- includes/core/compatibility.php +50 -28
- includes/core/helpers.php +112 -121
- includes/core/hooks.php +74 -28
- includes/core/meta.php +197 -174
- includes/core/multilang.php +43 -6
- includes/core/settings.php +210 -210
- includes/core/upgrades.php +574 -574
- includes/field-groups/field-group-advanced.php +5 -5
- includes/field-groups/field-group-display-title.php +10 -10
- includes/field-groups/field-group-hide-on-screen.php +17 -17
- includes/field-groups/field-group-meta.php +3 -3
- includes/field-groups/field-group-permissions.php +10 -10
- includes/field-groups/field-group.php +3 -3
- includes/fields-settings/bidirectional.php +13 -7
- includes/fields-settings/settings.php +6 -6
- includes/fields-settings/validation.php +4 -4
- includes/fields/field-advanced-link.php +157 -199
- includes/fields/field-button.php +19 -19
- includes/fields/field-clone.php +185 -154
- includes/fields/field-code-editor.php +43 -43
- includes/fields/field-column.php +15 -15
- includes/fields/field-dynamic-message.php +0 -33
- includes/fields/field-flexible-content-async.php +3 -3
- includes/fields/field-flexible-content-preview.php +6 -6
- includes/fields/field-flexible-content.php +49 -49
- includes/fields/field-forms.php +144 -144
- includes/fields/field-group.php +145 -118
- includes/fields/field-hidden.php +8 -8
- includes/fields/field-image.php +8 -1
- includes/fields/field-post-object.php +39 -97
- includes/fields/field-post-statuses.php +129 -129
- includes/fields/field-post-types.php +132 -132
- includes/fields/field-recaptcha.php +33 -33
- includes/fields/field-select.php +58 -58
- includes/fields/field-slug.php +25 -25
- includes/fields/field-taxonomies.php +133 -133
- includes/fields/field-taxonomy-terms.php +130 -130
- includes/fields/field-textarea.php +2 -2
- includes/fields/field-user-roles.php +120 -120
- includes/locations/post-type-all.php +1 -1
- includes/locations/post-type-archive.php +31 -31
- includes/locations/post-type-list.php +16 -16
- includes/locations/taxonomy-list.php +12 -12
- includes/modules/autosync.php +8 -134
- includes/modules/block-types.php +15 -15
- includes/modules/dev.php +9 -9
- includes/modules/forms-action-email.php +65 -65
- includes/modules/forms-action-post.php +204 -204
- includes/modules/forms-action-redirect.php +1 -1
- includes/modules/forms-action-term.php +48 -48
- includes/modules/forms-action-user.php +115 -115
- includes/modules/forms-front.php +176 -168
- includes/modules/forms-helpers.php +36 -1
- includes/modules/forms-hooks.php +3 -4
- includes/modules/forms.php +66 -64
- includes/modules/options-pages.php +13 -13
- includes/modules/post-types.php +7 -7
- includes/modules/single-meta.php +9 -9
- includes/modules/taxonomies.php +7 -7
- includes/modules/ui.php +27 -27
- init.php +8 -8
- readme.txt +39 -1
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: All-in-one enhancement suite that improves WordPress & Advanced Custom Fields.
|
5 |
-
* Version: 0.8.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 |
// Vars
|
19 |
-
var $version = '0.8.8.
|
20 |
var $acf = false;
|
21 |
|
22 |
/*
|
@@ -136,9 +136,9 @@ class ACFE{
|
|
136 |
acfe_include('includes/core/meta.php');
|
137 |
acfe_include('includes/core/multilang.php');
|
138 |
acfe_include('includes/core/settings.php');
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
acfe_include('includes/admin/settings.php');
|
143 |
|
144 |
}
|
@@ -292,9 +292,9 @@ class ACFE{
|
|
292 |
|
293 |
}
|
294 |
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
function constants($array = array()){
|
299 |
|
300 |
foreach($array as $name => $value){
|
@@ -309,8 +309,8 @@ class ACFE{
|
|
309 |
}
|
310 |
|
311 |
/*
|
312 |
-
|
313 |
-
|
314 |
function settings($array = array()){
|
315 |
|
316 |
foreach($array as $name => $value){
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: All-in-one enhancement suite that improves WordPress & Advanced Custom Fields.
|
5 |
+
* Version: 0.8.8.2
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
16 |
class ACFE{
|
17 |
|
18 |
// Vars
|
19 |
+
var $version = '0.8.8.2';
|
20 |
var $acf = false;
|
21 |
|
22 |
/*
|
136 |
acfe_include('includes/core/meta.php');
|
137 |
acfe_include('includes/core/multilang.php');
|
138 |
acfe_include('includes/core/settings.php');
|
139 |
+
acfe_include('includes/core/upgrades.php');
|
140 |
+
|
141 |
+
// Admin
|
142 |
acfe_include('includes/admin/settings.php');
|
143 |
|
144 |
}
|
292 |
|
293 |
}
|
294 |
|
295 |
+
/*
|
296 |
+
* Set Constants
|
297 |
+
*/
|
298 |
function constants($array = array()){
|
299 |
|
300 |
foreach($array as $name => $value){
|
309 |
}
|
310 |
|
311 |
/*
|
312 |
+
* Set Settings
|
313 |
+
*/
|
314 |
function settings($array = array()){
|
315 |
|
316 |
foreach($array as $name => $value){
|
@@ -471,12 +471,12 @@ body.post-type-acfe-template .column-acfe-terms {
|
|
471 |
font-size: 21px
|
472 |
}
|
473 |
|
474 |
-
#acfe-admin-settings .inside>.acf-field
|
475 |
padding: 0;
|
476 |
border-bottom: 1px solid #eee
|
477 |
}
|
478 |
|
479 |
-
#acfe-admin-settings .inside>.acf-field
|
480 |
border-top: 0
|
481 |
}
|
482 |
|
471 |
font-size: 21px
|
472 |
}
|
473 |
|
474 |
+
#acfe-admin-settings .inside>.acf-field.acfe-settings-thead>.acf-input {
|
475 |
padding: 0;
|
476 |
border-bottom: 1px solid #eee
|
477 |
}
|
478 |
|
479 |
+
#acfe-admin-settings .inside>.acf-field.acfe-settings-thead+.acf-field {
|
480 |
border-top: 0
|
481 |
}
|
482 |
|
@@ -1 +1 @@
|
|
1 |
-
code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:1em}pre{display:block;padding:9.5px;margin:0;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f9f9f9;border:1px solid #ccc;border-radius:1px;white-space:pre-wrap;overflow:auto}code{-webkit-user-select:all;-moz-user-select:all;user-select:all}pre>code{-webkit-user-select:inherit;-moz-user-select:inherit;-ms-user-select:inherit;user-select:inherit;padding:0;margin:0;background:0 0;font-size:1em;display:block}.code-codemirror>.CodeMirror,.pre-codemirror>.CodeMirror{border:1px solid #ccc;height:auto;width:auto;background:#f9f9f9;padding:9px 6px}.code-codemirror{display:inline;vertical-align:middle}.code-codemirror>.CodeMirror{display:inline-block;padding:0}.code-codemirror>.CodeMirror .CodeMirror-selected,.pre-codemirror>.CodeMirror .CodeMirror-selected{background:#ddd!important}.code-codemirror>.CodeMirror .CodeMirror-lines,.pre-codemirror>.CodeMirror .CodeMirror-lines{padding:0}.widget.open{z-index:inherit!important}.acfe-pre-highlight{display:block;padding:9.5px;margin:0;line-height:1.42857143;color:#333;background-color:#f9f9f9;border:1px solid #ccc;border-radius:1px;overflow:auto;font-family:Menlo,Monaco,Consolas,Courier New,monospace;font-size:1em;white-space:nowrap}.acf-postbox.seamless>.inside>.acf-field{padding:15px 12px}.acf-flexible-content .layout.ui-sortable-helper:first-child+.layout.ui-sortable-placeholder{margin-top:0}.acfe-postbox.acfe-postbox-no-handle h2.hndle{cursor:initial}.acfe-postbox.acfe-postbox-no-handle .handlediv{display:none}.acfe-postbox-top>.inside{position:relative}.acfe-postbox-top>.inside.-border{border:1px solid #ccd0d4;background:#fff}.acfe-postbox-top>.inside>.acf-field{position:relative;margin:0;padding:15px 12px;border-top:1px solid #eee}.acfe-postbox-top>.inside>.acf-field:first-child{border-top:none;margin-top:0}.acfe-postbox-left>.inside{position:relative}.acfe-postbox-left>.inside:after{display:block;clear:both;content:""}.acfe-postbox-left>.inside.-border{border:1px solid #ccd0d4;background:#fff}.acfe-postbox-left>.inside>.acf-field{position:relative;margin:0;border-top:1px solid #eee;padding:15px 0}.acfe-postbox-left>.inside>.acf-field:first-child{border-top:none;margin-top:0}.acfe-postbox-left>.inside.-clear>.acf-field{border:none;padding:0;margin:15px 0}.acfe-postbox-left>.inside>.acf-field:after{display:block;clear:both;content:""}.acfe-postbox-left>.inside>.acf-field:before{content:"";display:block;position:absolute;z-index:0;background:#f9f9f9;border-color:#e1e1e1;border-style:solid;border-width:0 1px 0 0;top:0;bottom:0;left:0;width:20%}.acfe-postbox-left>.inside>.acf-field[data-width]{float:none;width:auto!important;border-left-width:0!important;border-right-width:0!important}.acfe-postbox-left>.inside>.acf-field>.acf-label{float:left;width:20%;margin:0;padding:0 12px}.acfe-postbox-left>.inside>.acf-field>.acf-input{float:left;width:80%;margin:0;padding:0 12px}html[dir=rtl] .acfe-postbox-left>.inside>.acf-field:before{border-width:0 0 0 1px;left:auto;right:0}html[dir=rtl] .acfe-postbox-left>.inside>.acf-field>.acf-input,html[dir=rtl] .acfe-postbox-left>.inside>.acf-field>.acf-label{float:right}#side-sortables .acfe-postbox-left>.inside>.acf-field:before{display:none}#side-sortables .acfe-postbox-left>.inside>.acf-field>.acf-label{width:100%;margin-bottom:10px}#side-sortables .acfe-postbox-left>.inside>.acf-field>.acf-input{width:100%}@media screen and (max-width:640px){.acfe-postbox-left>.inside>.acf-field:before{display:none}.acfe-postbox-left>.inside>.acf-field>.acf-label{width:100%;margin-bottom:10px}.acfe-postbox-left>.inside>.acf-field>.acf-input{width:100%}}.wrap .acfe-dop-admin-config,.wrap .acfe-dpt-admin-config,.wrap .acfe-dt-admin-config{display:inline-block;padding-left:4px;padding-right:4px}.wrap .acfe-dop-admin-config:active,.wrap .acfe-dpt-admin-config:active,.wrap .acfe-dt-admin-config:active{padding-left:4px;padding-right:4px}.wrap .acfe-dop-admin-config span,.wrap .acfe-dpt-admin-config span,.wrap .acfe-dt-admin-config span{font-size:16px;vertical-align:text-top;height:15px;width:19px;line-height:19px}body.post-type-acfe-dbt #minor-publishing-actions,body.post-type-acfe-dbt #misc-publishing-actions #visibility,body.post-type-acfe-dbt #misc-publishing-actions .edit-post-status,body.post-type-acfe-dbt #misc-publishing-actions .edit-timestamp,body.post-type-acfe-dop #minor-publishing-actions,body.post-type-acfe-dop #misc-publishing-actions #visibility,body.post-type-acfe-dop #misc-publishing-actions .edit-post-status,body.post-type-acfe-dop #misc-publishing-actions .edit-timestamp,body.post-type-acfe-dpt #minor-publishing-actions,body.post-type-acfe-dpt #misc-publishing-actions #visibility,body.post-type-acfe-dpt #misc-publishing-actions .edit-post-status,body.post-type-acfe-dpt #misc-publishing-actions .edit-timestamp,body.post-type-acfe-dt #minor-publishing-actions,body.post-type-acfe-dt #misc-publishing-actions #visibility,body.post-type-acfe-dt #misc-publishing-actions .edit-post-status,body.post-type-acfe-dt #misc-publishing-actions .edit-timestamp,body.post-type-acfe-form #minor-publishing-actions,body.post-type-acfe-form #misc-publishing-actions #visibility,body.post-type-acfe-form #misc-publishing-actions .edit-post-status,body.post-type-acfe-form #misc-publishing-actions .edit-timestamp,body.post-type-acfe-template #minor-publishing-actions,body.post-type-acfe-template #misc-publishing-actions #visibility,body.post-type-acfe-template #misc-publishing-actions .edit-post-status,body.post-type-acfe-template #misc-publishing-actions .edit-timestamp{display:none!important}body.post-type-acfe-dbt .acfe-misc-export,body.post-type-acfe-dop .acfe-misc-export,body.post-type-acfe-dpt .acfe-misc-export,body.post-type-acfe-dt .acfe-misc-export,body.post-type-acfe-form .acfe-misc-export,body.post-type-acfe-template .acfe-misc-export{padding-top:2px}body.post-type-acfe-dbt .acfe-misc-export span.dashicons,body.post-type-acfe-dop .acfe-misc-export span.dashicons,body.post-type-acfe-dpt .acfe-misc-export span.dashicons,body.post-type-acfe-dt .acfe-misc-export span.dashicons,body.post-type-acfe-form .acfe-misc-export span.dashicons,body.post-type-acfe-template .acfe-misc-export span.dashicons{font-size:18px;color:#82878c;line-height:1.2;width:18px;margin-right:4px}body.post-type-acfe-dbt.post-new-php .acfe-misc-export,body.post-type-acfe-dop.post-new-php .acfe-misc-export,body.post-type-acfe-dpt.post-new-php .acfe-misc-export,body.post-type-acfe-dt.post-new-php .acfe-misc-export,body.post-type-acfe-form.post-new-php .acfe-misc-export,body.post-type-acfe-template.post-new-php .acfe-misc-export{display:none}body.post-type-acfe-dbt .status-acf-disabled .column-title a,body.post-type-acfe-dbt .status-acf-disabled .column-title code,body.post-type-acfe-dop .status-acf-disabled .column-title a,body.post-type-acfe-dop .status-acf-disabled .column-title code,body.post-type-acfe-dpt .status-acf-disabled .column-title a,body.post-type-acfe-dpt .status-acf-disabled .column-title code,body.post-type-acfe-dt .status-acf-disabled .column-title a,body.post-type-acfe-dt .status-acf-disabled .column-title code,body.post-type-acfe-form .status-acf-disabled .column-title a,body.post-type-acfe-form .status-acf-disabled .column-title code,body.post-type-acfe-template .status-acf-disabled .column-title a,body.post-type-acfe-template .status-acf-disabled .column-title code{color:#555!important}body.post-type-acfe-dbt .status-acf-disabled .column-title strong,body.post-type-acfe-dop .status-acf-disabled .column-title strong,body.post-type-acfe-dpt .status-acf-disabled .column-title strong,body.post-type-acfe-dt .status-acf-disabled .column-title strong,body.post-type-acfe-form .status-acf-disabled .column-title strong,body.post-type-acfe-template .status-acf-disabled .column-title strong{color:#a0a5aa}body.post-type-acfe-dbt .column-acfe-posts,body.post-type-acfe-dbt .column-acfe-terms,body.post-type-acfe-dop .column-acfe-posts,body.post-type-acfe-dop .column-acfe-terms,body.post-type-acfe-dpt .column-acfe-posts,body.post-type-acfe-dpt .column-acfe-terms,body.post-type-acfe-dt .column-acfe-posts,body.post-type-acfe-dt .column-acfe-terms,body.post-type-acfe-form .column-acfe-posts,body.post-type-acfe-form .column-acfe-terms,body.post-type-acfe-template .column-acfe-posts,body.post-type-acfe-template .column-acfe-terms{width:120px}.acf-field.acf-field-acfe-author>.acf-label{display:none}.edit-post-layout__metaboxes:not(:empty){background:#f3f4f5;padding:10px 10px 0!important}.edit-post-layout__metaboxes .edit-post-meta-boxes-area .postbox{margin-bottom:10px;border:1px solid #e1e1e1}.edit-post-layout__metaboxes .edit-post-meta-boxes-area .postbox>.inside{border-bottom:0}#acf-admin-tool-acfe_dynamic_block_types_export ul,#acf-admin-tool-acfe_dynamic_forms_export ul,#acf-admin-tool-acfe_dynamic_options_pages_export ul,#acf-admin-tool-acfe_dynamic_post_types_export ul,#acf-admin-tool-acfe_dynamic_taxonomies_export ul,#acf-admin-tool-acfe_dynamic_templates_export ul{-webkit-column-width:200px;-moz-column-width:200px;column-width:200px}#acf-admin-tool-acfe_dynamic_block_types_export .acf-postbox-columns,#acf-admin-tool-acfe_dynamic_forms_export .acf-postbox-columns,#acf-admin-tool-acfe_dynamic_options_pages_export .acf-postbox-columns,#acf-admin-tool-acfe_dynamic_post_types_export .acf-postbox-columns,#acf-admin-tool-acfe_dynamic_taxonomies_export .acf-postbox-columns,#acf-admin-tool-acfe_dynamic_templates_export .acf-postbox-columns{margin-right:0}.acf-meta-box-wrap.-grid #acf-admin-tool-acfe-fg-local{display:none}#acfe-admin-settings .inside>.acf-field{display:-webkit-box;display:-ms-flexbox;display:flex;padding:0}#acfe-admin-settings .inside>.acf-field>.acf-label{padding-top:15px;padding-bottom:15px;float:none}#acfe-admin-settings .inside>.acf-field>.acf-label label span.acf-js-tooltip{float:right;font-size:14px;color:#ccc}#acfe-admin-settings .inside>.acf-field>.acf-input{display:-webkit-box;display:-ms-flexbox;display:flex;float:none;padding:0}#acfe-admin-settings .inside>.acf-field>.acf-input>div{-webkit-box-flex:1;-ms-flex:1 1 50%;flex:1 1 50%;max-width:50%;padding:8px;min-width:0}#acfe-admin-settings .inside>.acf-field>.acf-input>div:nth-child(2){border-left:1px solid #eee}#acfe-admin-settings .inside>.acf-field>.acf-input .acfe-settings-text{overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap;max-width:100%;display:inline-block}#acfe-admin-settings .inside>.acf-field>.acf-input .acfe-settings-text>code{font-size:12px}#acfe-admin-settings .inside>.acf-field>.acf-input .dashicons-saved{font-size:21px}#acfe-admin-settings .inside>.acf-field>.acf-input .dashicons-no-alt{color:#ccc;font-size:21px}#acfe-admin-settings .inside>.acf-field[data-key=field_acfe_settings_thead]>.acf-input{padding:0;border-bottom:1px solid #eee}#acfe-admin-settings .inside>.acf-field[data-key=field_acfe_settings_thead]+.acf-field{border-top:0}.settings_page_acfe-options .column-option_id{width:65px}.settings_page_acfe-options .column-option_name{width:435px}.settings_page_acfe-options .column-autoload{width:100px;text-align:center}.acf-field[data-name=acfe_form_post_save_post_content_custom],.acf-field[data-name=acfe_form_post_save_post_name_custom],.acf-field[data-name=acfe_form_post_save_post_title_custom],.acf-field[data-name=acfe_form_term_save_description_custom],.acf-field[data-name=acfe_form_term_save_name_custom],.acf-field[data-name=acfe_form_term_save_slug_custom],.acf-field[data-name=acfe_form_user_save_description_custom],.acf-field[data-name=acfe_form_user_save_display_name_custom],.acf-field[data-name=acfe_form_user_save_email_custom],.acf-field[data-name=acfe_form_user_save_first_name_custom],.acf-field[data-name=acfe_form_user_save_last_name_custom],.acf-field[data-name=acfe_form_user_save_nickname_custom],.acf-field[data-name=acfe_form_user_save_password_custom],.acf-field[data-name=acfe_form_user_save_username_custom],.acf-field[data-name=acfe_form_user_save_website_custom]{border-top:0;padding-top:0}.acf-field.acf-field-acfe-form-attributes>.acf-input>.acf-fields>.acf-field,.acf-field.acf-field-acfe-form-fields-attributes>.acf-input>.acf-fields>.acf-field{border-left-width:0}.acf-field-repeater.acf-field-acfe-form-email-files-static>.acf-input>.acf-repeater>.acf-actions,.acf-field-repeater.acf-field-acfe-form-email-files>.acf-input>.acf-repeater>.acf-actions{text-align:left}.postbox#acfe-acf-custom-fields>.inside,.postbox#acfe-wp-custom-fields>.inside,.postbox#acfe-wp-object>.inside{padding:0;margin:0}.postbox#acfe-acf-custom-fields+.tablenav,.postbox#acfe-wp-custom-fields+.tablenav,.postbox#acfe-wp-object+.tablenav{padding-top:0;margin-top:-8px}.postbox#acfe-acf-custom-fields em,.postbox#acfe-wp-custom-fields em,.postbox#acfe-wp-object em{color:#aaa}.postbox#acfe-acf-custom-fields .acfe_dev_meta_count,.postbox#acfe-wp-custom-fields .acfe_dev_meta_count,.postbox#acfe-wp-object .acfe_dev_meta_count{background:#72777c;padding:1px 5px;border-radius:4px;color:#fff;margin-left:7px;font-size:12px;margin-right:auto}@media only screen and (max-width:1100px){.postbox#acfe-acf-custom-fields thead,.postbox#acfe-wp-custom-fields thead,.postbox#acfe-wp-object thead{display:none}.postbox#acfe-acf-custom-fields tbody tr,.postbox#acfe-wp-custom-fields tbody tr,.postbox#acfe-wp-object tbody tr{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.postbox#acfe-acf-custom-fields tbody td,.postbox#acfe-acf-custom-fields tbody th,.postbox#acfe-wp-custom-fields tbody td,.postbox#acfe-wp-custom-fields tbody th,.postbox#acfe-wp-object tbody td,.postbox#acfe-wp-object tbody th{display:block}.postbox#acfe-acf-custom-fields tbody td:first-of-type,.postbox#acfe-wp-custom-fields tbody td:first-of-type,.postbox#acfe-wp-object tbody td:first-of-type{-webkit-box-flex:1;-ms-flex:1;flex:1}.postbox#acfe-acf-custom-fields tbody td:first-of-type strong,.postbox#acfe-wp-custom-fields tbody td:first-of-type strong,.postbox#acfe-wp-object tbody td:first-of-type strong{display:inline-block;word-break:break-all}.postbox#acfe-acf-custom-fields tbody td:first-of-type .row-actions,.postbox#acfe-wp-custom-fields tbody td:first-of-type .row-actions,.postbox#acfe-wp-object tbody td:first-of-type .row-actions{display:inline-block;padding:0;float:right}@media only screen and (max-width:850px){.postbox#acfe-acf-custom-fields tbody td:first-of-type,.postbox#acfe-wp-custom-fields tbody td:first-of-type,.postbox#acfe-wp-object tbody td:first-of-type{line-height:2.2}.postbox#acfe-acf-custom-fields tbody td:first-of-type .row-actions,.postbox#acfe-wp-custom-fields tbody td:first-of-type .row-actions,.postbox#acfe-wp-object tbody td:first-of-type .row-actions{left:auto}}.postbox#acfe-acf-custom-fields tbody td:first-of-type .row-actions .delete,.postbox#acfe-acf-custom-fields tbody td:first-of-type .row-actions a,.postbox#acfe-wp-custom-fields tbody td:first-of-type .row-actions .delete,.postbox#acfe-wp-custom-fields tbody td:first-of-type .row-actions a,.postbox#acfe-wp-object tbody td:first-of-type .row-actions .delete,.postbox#acfe-wp-object tbody td:first-of-type .row-actions a{padding:0}.postbox#acfe-acf-custom-fields tbody td:nth-child(3),.postbox#acfe-wp-custom-fields tbody td:nth-child(3),.postbox#acfe-wp-object tbody td:nth-child(3){-webkit-box-flex:1;-ms-flex:1 1 100%;flex:1 1 100%}}body:not(.acf-admin-5-3) .acf-field .select2-container .select2-selection,body:not(.acf-admin-5-3) .acf-field .select2-container .select2-selection__choice,body:not(.acf-admin-5-3) .acf-field .select2-dropdown{border-color:#dfdfdf!important;border-radius:0!important}body:not(.acf-admin-5-3) .acf-field .select2-container .select2-search--inline .select2-search__field{margin-top:0!important}.acf-field .select2-container .select2-selection--single{border-radius:3px!important;height:30px!important;outline:0}.acf-field .select2-container.select2-container--open .select2-selection--single,.acf-field .select2-container:focus .select2-selection--single{border-color:#007cba!important;color:#016087!important;-webkit-box-shadow:0 0 0 1px #007cba!important;box-shadow:0 0 0 1px #007cba!important}.acf-field .select2-container .select2-selection--single .select2-selection__rendered{font-size:14px;height:28px;line-height:27px!important;padding-right:23px!important}.acf-field .select2-container .select2-selection--single .select2-selection__clear{line-height:26px;height:28px;font-size:16px}.acf-field .select2-container--default .select2-selection--single .select2-selection__arrow{height:28px!important}.acf-field .select2-container--default .select2-selection--single .select2-selection__arrow b{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') 0 0/16px 16px no-repeat;border:0!important;width:16px!important;height:16px!important;margin-left:-11px!important;margin-top:-7px!important}.acf-field .select2-container .select2-search--inline .select2-search__field{margin-top:4px!important;font-size:14px!important;padding-left:2px!important}.acf-field .select2-container .select2-selection--multiple{min-height:30px!important;line-height:1;border-radius:3px!important}.acf-field .select2-container--default .select2-selection--multiple .select2-selection__rendered{padding:0 2px!important}.acf-field .select2-container--default .select2-selection--multiple .select2-selection__choice{margin-right:2px!important;margin-top:2px!important;line-height:1.6;border-radius:3px!important;font-size:14px}.acf-field .select2-container--default .select2-selection--multiple .select2-selection__choice__remove{line-height:15px;font-size:15px}.acf-field .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#7e8993!important}.acf-field .select2-container--default .select2-selection--multiple .select2-selection__clear{margin-top:5px!important;margin-right:5px!important;font-size:16px}.acf-field>.acf-input>.select2 .select2-search{width:auto}.select2-container .select2-dropdown .select2-search__field{min-height:30px!important;border:0!important;-webkit-box-shadow:none!important;box-shadow:none!important}.acf-tab-group li a .acfe-tab-badge{border-radius:100px;background:#ddd;width:18px;height:18px;font-size:12px;display:inline-block;vertical-align:text-bottom;padding:0;text-align:center;margin-left:5px;line-height:18px}.acf-tab-group li a:hover .acfe-tab-badge,.acf-tab-group li.active a .acfe-tab-badge{background:#f1f1f1}.menu-item-settings{position:initial}@media screen and (min-width:783px){.postbox .handle-order-higher,.postbox .handle-order-lower{visibility:hidden}.postbox:hover .handle-order-higher,.postbox:hover .handle-order-lower{visibility:visible}}.postbox .handle-order-higher,.postbox .handle-order-lower{vertical-align:bottom;width:1.42rem}.postbox .handle-order-higher .order-higher-indicator::before,.postbox .handle-order-lower .order-lower-indicator::before{font-size:15px;top:.23rem}.postbox .handlediv{width:1.62rem}.postbox .handlediv .toggle-indicator::before{text-indent:-7px;top:.1rem}#poststuff .stuffbox>h3,#poststuff h2,#poststuff h3.hndle{line-height:1.48}.acf-settings-wrap .acf-box{margin:16px 0}.acf-box .title{padding:8px 15px}.acf-box .title h3{line-height:1.4}.acf-columns-2{margin-right:300px;clear:both}.acf-columns-2:after{display:block;clear:both;content:""}html[dir=rtl] .acf-columns-2{margin-right:0;margin-left:300px}.acf-columns-2 .acf-column-1{float:left;width:100%}html[dir=rtl] .acf-columns-2 .acf-column-1{float:right}.acf-columns-2 .acf-column-2{float:right;margin-right:-300px;width:280px}html[dir=rtl] .acf-columns-2 .acf-column-2{float:left;margin-right:0;margin-left:-300px}@media only screen and (max-width:850px){.acf-columns-2{margin-right:0}.acf-columns-2 .acf-column-1,.acf-columns-2 .acf-column-2{float:none;width:auto;margin:0}}body.is-dragging-metaboxes #acf_after_title-sortables{outline:#646970 dashed 3px;display:flow-root;min-height:60px;margin-bottom:3px!important}.acf-input-wrap .acf-is-prepended+.select2>.selection>.select2-selection{border-radius:0 3px 3px 0!important}
|
1 |
+
code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:1em}pre{display:block;padding:9.5px;margin:0;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f9f9f9;border:1px solid #ccc;border-radius:1px;white-space:pre-wrap;overflow:auto}code{-webkit-user-select:all;-moz-user-select:all;user-select:all}pre>code{-webkit-user-select:inherit;-moz-user-select:inherit;-ms-user-select:inherit;user-select:inherit;padding:0;margin:0;background:0 0;font-size:1em;display:block}.code-codemirror>.CodeMirror,.pre-codemirror>.CodeMirror{border:1px solid #ccc;height:auto;width:auto;background:#f9f9f9;padding:9px 6px}.code-codemirror{display:inline;vertical-align:middle}.code-codemirror>.CodeMirror{display:inline-block;padding:0}.code-codemirror>.CodeMirror .CodeMirror-selected,.pre-codemirror>.CodeMirror .CodeMirror-selected{background:#ddd!important}.code-codemirror>.CodeMirror .CodeMirror-lines,.pre-codemirror>.CodeMirror .CodeMirror-lines{padding:0}.widget.open{z-index:inherit!important}.acfe-pre-highlight{display:block;padding:9.5px;margin:0;line-height:1.42857143;color:#333;background-color:#f9f9f9;border:1px solid #ccc;border-radius:1px;overflow:auto;font-family:Menlo,Monaco,Consolas,Courier New,monospace;font-size:1em;white-space:nowrap}.acf-postbox.seamless>.inside>.acf-field{padding:15px 12px}.acf-flexible-content .layout.ui-sortable-helper:first-child+.layout.ui-sortable-placeholder{margin-top:0}.acfe-postbox.acfe-postbox-no-handle h2.hndle{cursor:initial}.acfe-postbox.acfe-postbox-no-handle .handlediv{display:none}.acfe-postbox-top>.inside{position:relative}.acfe-postbox-top>.inside.-border{border:1px solid #ccd0d4;background:#fff}.acfe-postbox-top>.inside>.acf-field{position:relative;margin:0;padding:15px 12px;border-top:1px solid #eee}.acfe-postbox-top>.inside>.acf-field:first-child{border-top:none;margin-top:0}.acfe-postbox-left>.inside{position:relative}.acfe-postbox-left>.inside:after{display:block;clear:both;content:""}.acfe-postbox-left>.inside.-border{border:1px solid #ccd0d4;background:#fff}.acfe-postbox-left>.inside>.acf-field{position:relative;margin:0;border-top:1px solid #eee;padding:15px 0}.acfe-postbox-left>.inside>.acf-field:first-child{border-top:none;margin-top:0}.acfe-postbox-left>.inside.-clear>.acf-field{border:none;padding:0;margin:15px 0}.acfe-postbox-left>.inside>.acf-field:after{display:block;clear:both;content:""}.acfe-postbox-left>.inside>.acf-field:before{content:"";display:block;position:absolute;z-index:0;background:#f9f9f9;border-color:#e1e1e1;border-style:solid;border-width:0 1px 0 0;top:0;bottom:0;left:0;width:20%}.acfe-postbox-left>.inside>.acf-field[data-width]{float:none;width:auto!important;border-left-width:0!important;border-right-width:0!important}.acfe-postbox-left>.inside>.acf-field>.acf-label{float:left;width:20%;margin:0;padding:0 12px}.acfe-postbox-left>.inside>.acf-field>.acf-input{float:left;width:80%;margin:0;padding:0 12px}html[dir=rtl] .acfe-postbox-left>.inside>.acf-field:before{border-width:0 0 0 1px;left:auto;right:0}html[dir=rtl] .acfe-postbox-left>.inside>.acf-field>.acf-input,html[dir=rtl] .acfe-postbox-left>.inside>.acf-field>.acf-label{float:right}#side-sortables .acfe-postbox-left>.inside>.acf-field:before{display:none}#side-sortables .acfe-postbox-left>.inside>.acf-field>.acf-label{width:100%;margin-bottom:10px}#side-sortables .acfe-postbox-left>.inside>.acf-field>.acf-input{width:100%}@media screen and (max-width:640px){.acfe-postbox-left>.inside>.acf-field:before{display:none}.acfe-postbox-left>.inside>.acf-field>.acf-label{width:100%;margin-bottom:10px}.acfe-postbox-left>.inside>.acf-field>.acf-input{width:100%}}.wrap .acfe-dop-admin-config,.wrap .acfe-dpt-admin-config,.wrap .acfe-dt-admin-config{display:inline-block;padding-left:4px;padding-right:4px}.wrap .acfe-dop-admin-config:active,.wrap .acfe-dpt-admin-config:active,.wrap .acfe-dt-admin-config:active{padding-left:4px;padding-right:4px}.wrap .acfe-dop-admin-config span,.wrap .acfe-dpt-admin-config span,.wrap .acfe-dt-admin-config span{font-size:16px;vertical-align:text-top;height:15px;width:19px;line-height:19px}body.post-type-acfe-dbt #minor-publishing-actions,body.post-type-acfe-dbt #misc-publishing-actions #visibility,body.post-type-acfe-dbt #misc-publishing-actions .edit-post-status,body.post-type-acfe-dbt #misc-publishing-actions .edit-timestamp,body.post-type-acfe-dop #minor-publishing-actions,body.post-type-acfe-dop #misc-publishing-actions #visibility,body.post-type-acfe-dop #misc-publishing-actions .edit-post-status,body.post-type-acfe-dop #misc-publishing-actions .edit-timestamp,body.post-type-acfe-dpt #minor-publishing-actions,body.post-type-acfe-dpt #misc-publishing-actions #visibility,body.post-type-acfe-dpt #misc-publishing-actions .edit-post-status,body.post-type-acfe-dpt #misc-publishing-actions .edit-timestamp,body.post-type-acfe-dt #minor-publishing-actions,body.post-type-acfe-dt #misc-publishing-actions #visibility,body.post-type-acfe-dt #misc-publishing-actions .edit-post-status,body.post-type-acfe-dt #misc-publishing-actions .edit-timestamp,body.post-type-acfe-form #minor-publishing-actions,body.post-type-acfe-form #misc-publishing-actions #visibility,body.post-type-acfe-form #misc-publishing-actions .edit-post-status,body.post-type-acfe-form #misc-publishing-actions .edit-timestamp,body.post-type-acfe-template #minor-publishing-actions,body.post-type-acfe-template #misc-publishing-actions #visibility,body.post-type-acfe-template #misc-publishing-actions .edit-post-status,body.post-type-acfe-template #misc-publishing-actions .edit-timestamp{display:none!important}body.post-type-acfe-dbt .acfe-misc-export,body.post-type-acfe-dop .acfe-misc-export,body.post-type-acfe-dpt .acfe-misc-export,body.post-type-acfe-dt .acfe-misc-export,body.post-type-acfe-form .acfe-misc-export,body.post-type-acfe-template .acfe-misc-export{padding-top:2px}body.post-type-acfe-dbt .acfe-misc-export span.dashicons,body.post-type-acfe-dop .acfe-misc-export span.dashicons,body.post-type-acfe-dpt .acfe-misc-export span.dashicons,body.post-type-acfe-dt .acfe-misc-export span.dashicons,body.post-type-acfe-form .acfe-misc-export span.dashicons,body.post-type-acfe-template .acfe-misc-export span.dashicons{font-size:18px;color:#82878c;line-height:1.2;width:18px;margin-right:4px}body.post-type-acfe-dbt.post-new-php .acfe-misc-export,body.post-type-acfe-dop.post-new-php .acfe-misc-export,body.post-type-acfe-dpt.post-new-php .acfe-misc-export,body.post-type-acfe-dt.post-new-php .acfe-misc-export,body.post-type-acfe-form.post-new-php .acfe-misc-export,body.post-type-acfe-template.post-new-php .acfe-misc-export{display:none}body.post-type-acfe-dbt .status-acf-disabled .column-title a,body.post-type-acfe-dbt .status-acf-disabled .column-title code,body.post-type-acfe-dop .status-acf-disabled .column-title a,body.post-type-acfe-dop .status-acf-disabled .column-title code,body.post-type-acfe-dpt .status-acf-disabled .column-title a,body.post-type-acfe-dpt .status-acf-disabled .column-title code,body.post-type-acfe-dt .status-acf-disabled .column-title a,body.post-type-acfe-dt .status-acf-disabled .column-title code,body.post-type-acfe-form .status-acf-disabled .column-title a,body.post-type-acfe-form .status-acf-disabled .column-title code,body.post-type-acfe-template .status-acf-disabled .column-title a,body.post-type-acfe-template .status-acf-disabled .column-title code{color:#555!important}body.post-type-acfe-dbt .status-acf-disabled .column-title strong,body.post-type-acfe-dop .status-acf-disabled .column-title strong,body.post-type-acfe-dpt .status-acf-disabled .column-title strong,body.post-type-acfe-dt .status-acf-disabled .column-title strong,body.post-type-acfe-form .status-acf-disabled .column-title strong,body.post-type-acfe-template .status-acf-disabled .column-title strong{color:#a0a5aa}body.post-type-acfe-dbt .column-acfe-posts,body.post-type-acfe-dbt .column-acfe-terms,body.post-type-acfe-dop .column-acfe-posts,body.post-type-acfe-dop .column-acfe-terms,body.post-type-acfe-dpt .column-acfe-posts,body.post-type-acfe-dpt .column-acfe-terms,body.post-type-acfe-dt .column-acfe-posts,body.post-type-acfe-dt .column-acfe-terms,body.post-type-acfe-form .column-acfe-posts,body.post-type-acfe-form .column-acfe-terms,body.post-type-acfe-template .column-acfe-posts,body.post-type-acfe-template .column-acfe-terms{width:120px}.acf-field.acf-field-acfe-author>.acf-label{display:none}.edit-post-layout__metaboxes:not(:empty){background:#f3f4f5;padding:10px 10px 0!important}.edit-post-layout__metaboxes .edit-post-meta-boxes-area .postbox{margin-bottom:10px;border:1px solid #e1e1e1}.edit-post-layout__metaboxes .edit-post-meta-boxes-area .postbox>.inside{border-bottom:0}#acf-admin-tool-acfe_dynamic_block_types_export ul,#acf-admin-tool-acfe_dynamic_forms_export ul,#acf-admin-tool-acfe_dynamic_options_pages_export ul,#acf-admin-tool-acfe_dynamic_post_types_export ul,#acf-admin-tool-acfe_dynamic_taxonomies_export ul,#acf-admin-tool-acfe_dynamic_templates_export ul{-webkit-column-width:200px;-moz-column-width:200px;column-width:200px}#acf-admin-tool-acfe_dynamic_block_types_export .acf-postbox-columns,#acf-admin-tool-acfe_dynamic_forms_export .acf-postbox-columns,#acf-admin-tool-acfe_dynamic_options_pages_export .acf-postbox-columns,#acf-admin-tool-acfe_dynamic_post_types_export .acf-postbox-columns,#acf-admin-tool-acfe_dynamic_taxonomies_export .acf-postbox-columns,#acf-admin-tool-acfe_dynamic_templates_export .acf-postbox-columns{margin-right:0}.acf-meta-box-wrap.-grid #acf-admin-tool-acfe-fg-local{display:none}#acfe-admin-settings .inside>.acf-field{display:-webkit-box;display:-ms-flexbox;display:flex;padding:0}#acfe-admin-settings .inside>.acf-field>.acf-label{padding-top:15px;padding-bottom:15px;float:none}#acfe-admin-settings .inside>.acf-field>.acf-label label span.acf-js-tooltip{float:right;font-size:14px;color:#ccc}#acfe-admin-settings .inside>.acf-field>.acf-input{display:-webkit-box;display:-ms-flexbox;display:flex;float:none;padding:0}#acfe-admin-settings .inside>.acf-field>.acf-input>div{-webkit-box-flex:1;-ms-flex:1 1 50%;flex:1 1 50%;max-width:50%;padding:8px;min-width:0}#acfe-admin-settings .inside>.acf-field>.acf-input>div:nth-child(2){border-left:1px solid #eee}#acfe-admin-settings .inside>.acf-field>.acf-input .acfe-settings-text{overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap;max-width:100%;display:inline-block}#acfe-admin-settings .inside>.acf-field>.acf-input .acfe-settings-text>code{font-size:12px}#acfe-admin-settings .inside>.acf-field>.acf-input .dashicons-saved{font-size:21px}#acfe-admin-settings .inside>.acf-field>.acf-input .dashicons-no-alt{color:#ccc;font-size:21px}#acfe-admin-settings .inside>.acf-field.acfe-settings-thead>.acf-input{padding:0;border-bottom:1px solid #eee}#acfe-admin-settings .inside>.acf-field.acfe-settings-thead+.acf-field{border-top:0}.settings_page_acfe-options .column-option_id{width:65px}.settings_page_acfe-options .column-option_name{width:435px}.settings_page_acfe-options .column-autoload{width:100px;text-align:center}.acf-field[data-name=acfe_form_post_save_post_content_custom],.acf-field[data-name=acfe_form_post_save_post_name_custom],.acf-field[data-name=acfe_form_post_save_post_title_custom],.acf-field[data-name=acfe_form_term_save_description_custom],.acf-field[data-name=acfe_form_term_save_name_custom],.acf-field[data-name=acfe_form_term_save_slug_custom],.acf-field[data-name=acfe_form_user_save_description_custom],.acf-field[data-name=acfe_form_user_save_display_name_custom],.acf-field[data-name=acfe_form_user_save_email_custom],.acf-field[data-name=acfe_form_user_save_first_name_custom],.acf-field[data-name=acfe_form_user_save_last_name_custom],.acf-field[data-name=acfe_form_user_save_nickname_custom],.acf-field[data-name=acfe_form_user_save_password_custom],.acf-field[data-name=acfe_form_user_save_username_custom],.acf-field[data-name=acfe_form_user_save_website_custom]{border-top:0;padding-top:0}.acf-field.acf-field-acfe-form-attributes>.acf-input>.acf-fields>.acf-field,.acf-field.acf-field-acfe-form-fields-attributes>.acf-input>.acf-fields>.acf-field{border-left-width:0}.acf-field-repeater.acf-field-acfe-form-email-files-static>.acf-input>.acf-repeater>.acf-actions,.acf-field-repeater.acf-field-acfe-form-email-files>.acf-input>.acf-repeater>.acf-actions{text-align:left}.postbox#acfe-acf-custom-fields>.inside,.postbox#acfe-wp-custom-fields>.inside,.postbox#acfe-wp-object>.inside{padding:0;margin:0}.postbox#acfe-acf-custom-fields+.tablenav,.postbox#acfe-wp-custom-fields+.tablenav,.postbox#acfe-wp-object+.tablenav{padding-top:0;margin-top:-8px}.postbox#acfe-acf-custom-fields em,.postbox#acfe-wp-custom-fields em,.postbox#acfe-wp-object em{color:#aaa}.postbox#acfe-acf-custom-fields .acfe_dev_meta_count,.postbox#acfe-wp-custom-fields .acfe_dev_meta_count,.postbox#acfe-wp-object .acfe_dev_meta_count{background:#72777c;padding:1px 5px;border-radius:4px;color:#fff;margin-left:7px;font-size:12px;margin-right:auto}@media only screen and (max-width:1100px){.postbox#acfe-acf-custom-fields thead,.postbox#acfe-wp-custom-fields thead,.postbox#acfe-wp-object thead{display:none}.postbox#acfe-acf-custom-fields tbody tr,.postbox#acfe-wp-custom-fields tbody tr,.postbox#acfe-wp-object tbody tr{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.postbox#acfe-acf-custom-fields tbody td,.postbox#acfe-acf-custom-fields tbody th,.postbox#acfe-wp-custom-fields tbody td,.postbox#acfe-wp-custom-fields tbody th,.postbox#acfe-wp-object tbody td,.postbox#acfe-wp-object tbody th{display:block}.postbox#acfe-acf-custom-fields tbody td:first-of-type,.postbox#acfe-wp-custom-fields tbody td:first-of-type,.postbox#acfe-wp-object tbody td:first-of-type{-webkit-box-flex:1;-ms-flex:1;flex:1}.postbox#acfe-acf-custom-fields tbody td:first-of-type strong,.postbox#acfe-wp-custom-fields tbody td:first-of-type strong,.postbox#acfe-wp-object tbody td:first-of-type strong{display:inline-block;word-break:break-all}.postbox#acfe-acf-custom-fields tbody td:first-of-type .row-actions,.postbox#acfe-wp-custom-fields tbody td:first-of-type .row-actions,.postbox#acfe-wp-object tbody td:first-of-type .row-actions{display:inline-block;padding:0;float:right}@media only screen and (max-width:850px){.postbox#acfe-acf-custom-fields tbody td:first-of-type,.postbox#acfe-wp-custom-fields tbody td:first-of-type,.postbox#acfe-wp-object tbody td:first-of-type{line-height:2.2}.postbox#acfe-acf-custom-fields tbody td:first-of-type .row-actions,.postbox#acfe-wp-custom-fields tbody td:first-of-type .row-actions,.postbox#acfe-wp-object tbody td:first-of-type .row-actions{left:auto}}.postbox#acfe-acf-custom-fields tbody td:first-of-type .row-actions .delete,.postbox#acfe-acf-custom-fields tbody td:first-of-type .row-actions a,.postbox#acfe-wp-custom-fields tbody td:first-of-type .row-actions .delete,.postbox#acfe-wp-custom-fields tbody td:first-of-type .row-actions a,.postbox#acfe-wp-object tbody td:first-of-type .row-actions .delete,.postbox#acfe-wp-object tbody td:first-of-type .row-actions a{padding:0}.postbox#acfe-acf-custom-fields tbody td:nth-child(3),.postbox#acfe-wp-custom-fields tbody td:nth-child(3),.postbox#acfe-wp-object tbody td:nth-child(3){-webkit-box-flex:1;-ms-flex:1 1 100%;flex:1 1 100%}}body:not(.acf-admin-5-3) .acf-field .select2-container .select2-selection,body:not(.acf-admin-5-3) .acf-field .select2-container .select2-selection__choice,body:not(.acf-admin-5-3) .acf-field .select2-dropdown{border-color:#dfdfdf!important;border-radius:0!important}body:not(.acf-admin-5-3) .acf-field .select2-container .select2-search--inline .select2-search__field{margin-top:0!important}.acf-field .select2-container .select2-selection--single{border-radius:3px!important;height:30px!important;outline:0}.acf-field .select2-container.select2-container--open .select2-selection--single,.acf-field .select2-container:focus .select2-selection--single{border-color:#007cba!important;color:#016087!important;-webkit-box-shadow:0 0 0 1px #007cba!important;box-shadow:0 0 0 1px #007cba!important}.acf-field .select2-container .select2-selection--single .select2-selection__rendered{font-size:14px;height:28px;line-height:27px!important;padding-right:23px!important}.acf-field .select2-container .select2-selection--single .select2-selection__clear{line-height:26px;height:28px;font-size:16px}.acf-field .select2-container--default .select2-selection--single .select2-selection__arrow{height:28px!important}.acf-field .select2-container--default .select2-selection--single .select2-selection__arrow b{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') 0 0/16px 16px no-repeat;border:0!important;width:16px!important;height:16px!important;margin-left:-11px!important;margin-top:-7px!important}.acf-field .select2-container .select2-search--inline .select2-search__field{margin-top:4px!important;font-size:14px!important;padding-left:2px!important}.acf-field .select2-container .select2-selection--multiple{min-height:30px!important;line-height:1;border-radius:3px!important}.acf-field .select2-container--default .select2-selection--multiple .select2-selection__rendered{padding:0 2px!important}.acf-field .select2-container--default .select2-selection--multiple .select2-selection__choice{margin-right:2px!important;margin-top:2px!important;line-height:1.6;border-radius:3px!important;font-size:14px}.acf-field .select2-container--default .select2-selection--multiple .select2-selection__choice__remove{line-height:15px;font-size:15px}.acf-field .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#7e8993!important}.acf-field .select2-container--default .select2-selection--multiple .select2-selection__clear{margin-top:5px!important;margin-right:5px!important;font-size:16px}.acf-field>.acf-input>.select2 .select2-search{width:auto}.select2-container .select2-dropdown .select2-search__field{min-height:30px!important;border:0!important;-webkit-box-shadow:none!important;box-shadow:none!important}.acf-tab-group li a .acfe-tab-badge{border-radius:100px;background:#ddd;width:18px;height:18px;font-size:12px;display:inline-block;vertical-align:text-bottom;padding:0;text-align:center;margin-left:5px;line-height:18px}.acf-tab-group li a:hover .acfe-tab-badge,.acf-tab-group li.active a .acfe-tab-badge{background:#f1f1f1}.menu-item-settings{position:initial}@media screen and (min-width:783px){.postbox .handle-order-higher,.postbox .handle-order-lower{visibility:hidden}.postbox:hover .handle-order-higher,.postbox:hover .handle-order-lower{visibility:visible}}.postbox .handle-order-higher,.postbox .handle-order-lower{vertical-align:bottom;width:1.42rem}.postbox .handle-order-higher .order-higher-indicator::before,.postbox .handle-order-lower .order-lower-indicator::before{font-size:15px;top:.23rem}.postbox .handlediv{width:1.62rem}.postbox .handlediv .toggle-indicator::before{text-indent:-7px;top:.1rem}#poststuff .stuffbox>h3,#poststuff h2,#poststuff h3.hndle{line-height:1.48}.acf-settings-wrap .acf-box{margin:16px 0}.acf-box .title{padding:8px 15px}.acf-box .title h3{line-height:1.4}.acf-columns-2{margin-right:300px;clear:both}.acf-columns-2:after{display:block;clear:both;content:""}html[dir=rtl] .acf-columns-2{margin-right:0;margin-left:300px}.acf-columns-2 .acf-column-1{float:left;width:100%}html[dir=rtl] .acf-columns-2 .acf-column-1{float:right}.acf-columns-2 .acf-column-2{float:right;margin-right:-300px;width:280px}html[dir=rtl] .acf-columns-2 .acf-column-2{float:left;margin-right:0;margin-left:-300px}@media only screen and (max-width:850px){.acf-columns-2{margin-right:0}.acf-columns-2 .acf-column-1,.acf-columns-2 .acf-column-2{float:none;width:auto;margin:0}}body.is-dragging-metaboxes #acf_after_title-sortables{outline:#646970 dashed 3px;display:flow-root;min-height:60px;margin-bottom:3px!important}.acf-input-wrap .acf-is-prepended+.select2>.selection>.select2-selection{border-radius:0 3px 3px 0!important}
|
@@ -1139,11 +1139,11 @@
|
|
1139 |
/**
|
1140 |
* Fires after an element has been duplicated and appended to the DOM.
|
1141 |
*
|
1142 |
-
* @date
|
1143 |
-
* @since
|
1144 |
*
|
1145 |
-
* @param
|
1146 |
-
* @param
|
1147 |
*/
|
1148 |
//acf.doAction('duplicate', $el, $el2 );
|
1149 |
|
1139 |
/**
|
1140 |
* Fires after an element has been duplicated and appended to the DOM.
|
1141 |
*
|
1142 |
+
* @date 30/10/19
|
1143 |
+
* @since 5.8.7
|
1144 |
*
|
1145 |
+
* @param jQuery $el The original element.
|
1146 |
+
* @param jQuery $el2 The duplicated element.
|
1147 |
*/
|
1148 |
//acf.doAction('duplicate', $el, $el2 );
|
1149 |
|
@@ -125,8 +125,14 @@
|
|
125 |
|
126 |
acfe.syncPopup();
|
127 |
|
128 |
-
//
|
129 |
-
acf.getFields(
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
acf.doAction('show_field', field, 'group');
|
131 |
}, this);
|
132 |
|
125 |
|
126 |
acfe.syncPopup();
|
127 |
|
128 |
+
// Get sub fields
|
129 |
+
var getSubFields = acf.getFields({
|
130 |
+
parent: this.$el,
|
131 |
+
visible: true,
|
132 |
+
});
|
133 |
+
|
134 |
+
// Show sub fields
|
135 |
+
getSubFields.map(function(field) {
|
136 |
acf.doAction('show_field', field, 'group');
|
137 |
}, this);
|
138 |
|
@@ -1 +1 @@
|
|
1 |
-
!function(n){var l,o,i;"undefined"!=typeof acf&&(acf.data.acfe={},l={},(window.acfe=l).get=function(e){return acf.data.acfe[e]||null},l.has=function(e){return null!==this.get(e)},l.set=function(e,t){return acf.data.acfe[e]=t,this},o=[],l.Popup=acf.Model.extend({data:{title:!1,footer:!1,size:!1,destroy:!1,onOpen:function(){},onClose:function(){}},events:{"click .acfe-modal-title>.close":"onClickClose","click .acfe-modal-footer>button":"onClickClose"},setup:function(e,t){n.extend(this.data,t),this.$el=e,this.render()},initialize:function(){this.open()},render:function(){this.get("size")&&this.$el.addClass("-"+this.get("size")),this.$("> .acfe-modal-wrapper").length||this.$el.wrapInner('<div class="acfe-modal-wrapper" />');var e=this.$("> .acfe-modal-wrapper");e.find("> .acfe-modal-content").length||e.wrapInner('<div class="acfe-modal-content" />'),this.get("title")&&e.prepend('<div class="acfe-modal-title"><span class="title">'+this.get("title")+'</span><button class="close"></button></div>'),e.prepend('<div class="acfe-modal-wrapper-overlay"></div>'),this.get("footer")&&e.append('<div class="acfe-modal-footer"><button class="button button-primary">'+this.get("footer")+"</button></div>")},open:function(){this.$el.addClass("-open"),o.push(this),l.syncPopup(),acf.getFields(this.$el
|
1 |
+
!function(n){var l,o,i;"undefined"!=typeof acf&&(acf.data.acfe={},l={},(window.acfe=l).get=function(e){return acf.data.acfe[e]||null},l.has=function(e){return null!==this.get(e)},l.set=function(e,t){return acf.data.acfe[e]=t,this},o=[],l.Popup=acf.Model.extend({data:{title:!1,footer:!1,size:!1,destroy:!1,onOpen:function(){},onClose:function(){}},events:{"click .acfe-modal-title>.close":"onClickClose","click .acfe-modal-footer>button":"onClickClose"},setup:function(e,t){n.extend(this.data,t),this.$el=e,this.render()},initialize:function(){this.open()},render:function(){this.get("size")&&this.$el.addClass("-"+this.get("size")),this.$("> .acfe-modal-wrapper").length||this.$el.wrapInner('<div class="acfe-modal-wrapper" />');var e=this.$("> .acfe-modal-wrapper");e.find("> .acfe-modal-content").length||e.wrapInner('<div class="acfe-modal-content" />'),this.get("title")&&e.prepend('<div class="acfe-modal-title"><span class="title">'+this.get("title")+'</span><button class="close"></button></div>'),e.prepend('<div class="acfe-modal-wrapper-overlay"></div>'),this.get("footer")&&e.append('<div class="acfe-modal-footer"><button class="button button-primary">'+this.get("footer")+"</button></div>")},open:function(){this.$el.addClass("-open"),o.push(this),l.syncPopup(),acf.getFields({parent:this.$el,visible:!0}).map(function(e){acf.doAction("show_field",e,"group")},this),acf.doAction("acfe/modal/open",this.$el,this.data),this.get("onOpen").apply(this.$el)},close:function(){this.$(".acfe-modal-wrapper-overlay").remove(),this.$(".acfe-modal-title").remove(),this.$(".acfe-modal-footer").remove(),this.$el.removeAttr("style"),this.$el.removeClass("-open"),l.syncPopup(),acf.doAction("acfe/modal/close",this.$el,this.data),this.get("onClose").apply(this.$el),this.remove(),this.get("destroy")&&this.$el.remove()},remove:function(){this.removeEvents(),this.removeActions(),this.removeFilters()},onClickClose:function(e){if(e.preventDefault(),!o.length)return!1;o.pop().close()}}),l.closePopup=function(){if(!o.length)return!1;o.pop().close()},l.syncPopup=function(){var e=n("body");o.length?(e.hasClass("acfe-modal-opened")||(e.addClass("acfe-modal-opened").append(n('<div class="acfe-modal-overlay" />')),n(".acfe-modal-overlay").on("click",function(e){e.preventDefault(),l.closePopup()})),o.map(function(e,t){return t===o.length-1?e.$el.removeClass("acfe-modal-sub").css("margin-left",""):void e.$el.addClass("acfe-modal-sub").css("margin-left",-500/(t+1))})):(n(".acfe-modal-overlay").remove(),e.removeClass("acfe-modal-opened"))},n(window).on("keydown",function(e){27===e.keyCode&&n("body").hasClass("acfe-modal-opened")&&(e.preventDefault(),l.closePopup())}),l.modal={open:function(e,t){new l.Popup(e,t)},close:function(){l.closePopup()}},i=[],l.disableFilters=function(){i=[]},l.getFilters=function(){return i},l.isFilterEnabled=function(e){return-1<i.indexOf(e)},l.enableFilter=function(e){-1===i.indexOf(e)&&i.push(e)},l.disableFilter=function(e){for(var t=i.length;t--;)i[t]===e&&i.splice(t,1)},l.parseString=function(e){return e?""+e:""},l.inArray=function(e,t){return-1<(t=t.map(function(e){return l.parseString(e)})).indexOf(e)},l.parseURL=function(e){var t={},e=(e=e||l.currentURL).replace(/^[^\?]+\??/,"");if(!e)return t;for(var n=e.split(/[;&]/),o=0;o<n.length;o++){var i,a=n[o].split("=");a&&2===a.length&&(i=decodeURI(a[0]),a=(a=decodeURI(a[1])).replace(/\+/g," "),t[i]=a)}return t},l.currentURL=function(){return self.location.href},l.currentPath=function(){return self.location.pathname},l.currentFilename=function(){return l.currentPath().split("/").pop()},l.parentObject=function(e){return Object.getPrototypeOf(Object.getPrototypeOf(e))},new acf.Model({tooltip:!1,events:{"click .acfe-field-tooltip":"showTitle"},showTitle:function(e,t){var n=t.attr("title");n&&(t.attr("title",""),this.tooltip?this.tooltip.update({text:n,target:t}):this.tooltip=acf.newTooltip({text:n,target:t}))}}),acf.getFileInputData=function(e,t){var n=e.val();if(!n)return!1;var o={url:n},i=!!e[0].files.length&&acf.isget(e[0].files,0);i?(o.size=i.size,o.type=i.type,-1<i.type.indexOf("image")?(n=window.URL||window.webkitURL,(e=new Image).onload=function(){o.width=this.width,o.height=this.height,t(o)},e.src=n.createObjectURL(i)):t(o)):t(o)})}(jQuery);
|
@@ -4,38 +4,38 @@ if(!defined('ABSPATH'))
|
|
4 |
exit;
|
5 |
|
6 |
if(!class_exists('WP_List_Table'))
|
7 |
-
|
8 |
|
9 |
class ACFE_Admin_Options_List extends WP_List_Table{
|
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 |
if(!empty($search)){
|
41 |
|
@@ -43,7 +43,7 @@ class ACFE_Admin_Options_List extends WP_List_Table{
|
|
43 |
|
44 |
}
|
45 |
|
46 |
-
|
47 |
|
48 |
$sql .= ' ORDER BY option_id ASC';
|
49 |
|
@@ -51,10 +51,10 @@ class ACFE_Admin_Options_List extends WP_List_Table{
|
|
51 |
|
52 |
else{
|
53 |
|
54 |
-
|
55 |
-
|
56 |
|
57 |
-
|
58 |
|
59 |
if(empty($search)){
|
60 |
|
@@ -64,23 +64,23 @@ class ACFE_Admin_Options_List extends WP_List_Table{
|
|
64 |
}
|
65 |
|
66 |
|
67 |
-
|
68 |
|
69 |
-
|
70 |
|
71 |
-
|
72 |
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
|
81 |
-
|
82 |
|
83 |
-
|
84 |
|
85 |
if(!empty($search)){
|
86 |
|
@@ -88,28 +88,28 @@ class ACFE_Admin_Options_List extends WP_List_Table{
|
|
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 |
if($column_name === 'option_id'){
|
115 |
|
@@ -144,112 +144,112 @@ class ACFE_Admin_Options_List extends WP_List_Table{
|
|
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 |
// Get columns
|
248 |
$this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
|
249 |
|
250 |
// Vars
|
251 |
$per_page = $this->get_items_per_page('options_per_page', 100);
|
252 |
-
|
253 |
|
254 |
// Search
|
255 |
$search = (isset( $_REQUEST['s'])) ? $_REQUEST['s'] : false;
|
@@ -262,16 +262,16 @@ class ACFE_Admin_Options_List extends WP_List_Table{
|
|
262 |
}*/
|
263 |
|
264 |
// Get total
|
265 |
-
|
266 |
|
267 |
if(!empty($search))
|
268 |
$per_page = $total_items;
|
269 |
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
|
275 |
-
|
276 |
|
277 |
}
|
4 |
exit;
|
5 |
|
6 |
if(!class_exists('WP_List_Table'))
|
7 |
+
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
8 |
|
9 |
class ACFE_Admin_Options_List extends WP_List_Table{
|
10 |
|
11 |
+
/**
|
12 |
+
* Constructor
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
public function __construct(){
|
16 |
|
17 |
+
parent::__construct(array(
|
18 |
+
'singular' => __('Option', 'acfe'),
|
19 |
+
'plural' => __('Options', 'acfe'),
|
20 |
+
'ajax' => false
|
21 |
+
));
|
22 |
|
23 |
+
}
|
24 |
|
25 |
|
26 |
+
/**
|
27 |
+
* Retrieve data from the database
|
28 |
+
*
|
29 |
+
* @param int $per_page
|
30 |
+
* @param int $page_number
|
31 |
+
*
|
32 |
+
* @return mixed
|
33 |
+
*/
|
34 |
+
public static function get_options($per_page = 100, $page_number = 1, $search = ''){
|
35 |
|
36 |
+
global $wpdb;
|
37 |
|
38 |
+
$sql = "SELECT * FROM {$wpdb->options}";
|
39 |
|
40 |
if(!empty($search)){
|
41 |
|
43 |
|
44 |
}
|
45 |
|
46 |
+
if(empty($_REQUEST['orderby'])){
|
47 |
|
48 |
$sql .= ' ORDER BY option_id ASC';
|
49 |
|
51 |
|
52 |
else{
|
53 |
|
54 |
+
$sql .= ' ORDER BY ' . esc_sql($_REQUEST['orderby']);
|
55 |
+
$sql .= !empty($_REQUEST['order']) ? ' ' . esc_sql($_REQUEST['order']) : ' ASC';
|
56 |
|
57 |
+
}
|
58 |
|
59 |
if(empty($search)){
|
60 |
|
64 |
}
|
65 |
|
66 |
|
67 |
+
$result = $wpdb->get_results($sql, 'ARRAY_A');
|
68 |
|
69 |
+
return $result;
|
70 |
|
71 |
+
}
|
72 |
|
73 |
|
74 |
+
/**
|
75 |
+
* Returns the count of records in the database.
|
76 |
+
*
|
77 |
+
* @return null|string
|
78 |
+
*/
|
79 |
+
public static function record_count($search = ''){
|
80 |
|
81 |
+
global $wpdb;
|
82 |
|
83 |
+
$sql = "SELECT COUNT(*) FROM {$wpdb->options}";
|
84 |
|
85 |
if(!empty($search)){
|
86 |
|
88 |
|
89 |
}
|
90 |
|
91 |
+
return $wpdb->get_var($sql);
|
92 |
|
93 |
+
}
|
94 |
|
95 |
|
96 |
+
/** Text displayed when no data is available */
|
97 |
+
public function no_items(){
|
98 |
|
99 |
+
_e('No options avaliable.', 'acfe');
|
100 |
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Render a column when no column specific method exist.
|
106 |
+
*
|
107 |
+
* @param array $item
|
108 |
+
* @param string $column_name
|
109 |
+
*
|
110 |
+
* @return mixed
|
111 |
+
*/
|
112 |
+
public function column_default($item, $column_name){
|
113 |
|
114 |
if($column_name === 'option_id'){
|
115 |
|
144 |
|
145 |
}
|
146 |
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Render the bulk edit checkbox
|
151 |
+
*
|
152 |
+
* @param array $item
|
153 |
+
*
|
154 |
+
* @return string
|
155 |
+
*/
|
156 |
+
public function column_cb($item){
|
157 |
|
158 |
+
return sprintf(
|
159 |
+
'<input type="checkbox" name="bulk-delete[]" value="%s" />', $item['option_id']
|
160 |
+
);
|
161 |
|
162 |
+
}
|
163 |
|
164 |
|
165 |
+
/**
|
166 |
+
* Method for name column
|
167 |
+
*
|
168 |
+
* @param array $item an array of DB data
|
169 |
+
*
|
170 |
+
* @return string
|
171 |
+
*/
|
172 |
+
public function column_option_name($item){
|
173 |
|
174 |
+
$delete_nonce = wp_create_nonce('acfe_options_delete_option');
|
175 |
|
176 |
+
$title = '<strong>' . $item['option_name'] . '</strong>';
|
177 |
|
178 |
+
$actions = array(
|
179 |
+
'edit' => sprintf('<a href="?page=%s&action=edit&option=%s">' . __('Edit') . '</a>', esc_attr($_REQUEST['page']), absint($item['option_id'])),
|
180 |
+
'delete' => sprintf('<a href="?page=%s&action=delete&option=%s&_wpnonce=%s">' . __('Delete') . '</a>', esc_attr($_REQUEST['page']), absint($item['option_id']), $delete_nonce),
|
181 |
+
);
|
182 |
|
183 |
+
return $title . $this->row_actions($actions);
|
184 |
|
185 |
+
}
|
186 |
|
187 |
|
188 |
+
/**
|
189 |
+
* Associative array of columns
|
190 |
+
*
|
191 |
+
* @return array
|
192 |
+
*/
|
193 |
+
public function get_columns(){
|
194 |
|
195 |
+
$columns = array(
|
196 |
+
'cb' => '<input type="checkbox" />',
|
197 |
+
'option_id' => __('ID', 'acfe'),
|
198 |
+
'option_name' => __('Name', 'acfe'),
|
199 |
+
'option_value' => __('Value', 'acfe'),
|
200 |
+
'autoload' => __('Autoload', 'acfe'),
|
201 |
+
);
|
202 |
+
|
203 |
+
return $columns;
|
204 |
|
205 |
+
}
|
206 |
|
207 |
|
208 |
+
/**
|
209 |
+
* Columns to make sortable.
|
210 |
+
*
|
211 |
+
* @return array
|
212 |
+
*/
|
213 |
+
public function get_sortable_columns(){
|
214 |
|
215 |
+
$sortable_columns = array(
|
216 |
+
'option_id' => array('option_id', true),
|
217 |
+
'option_name' => array('option_name', true),
|
218 |
+
'option_value' => array('option_value', true),
|
219 |
+
'autoload' => array('autoload', true),
|
220 |
+
);
|
221 |
+
|
222 |
+
return $sortable_columns;
|
223 |
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Returns an associative array containing the bulk action
|
228 |
+
*
|
229 |
+
* @return array
|
230 |
+
*/
|
231 |
+
public function get_bulk_actions(){
|
232 |
|
233 |
+
$actions = array(
|
234 |
+
'bulk-delete' => __('Delete')
|
235 |
+
);
|
236 |
|
237 |
+
return $actions;
|
238 |
|
239 |
+
}
|
240 |
|
241 |
|
242 |
+
/**
|
243 |
+
* Handles data query and filter, sorting, and pagination.
|
244 |
+
*/
|
245 |
+
public function prepare_items(){
|
246 |
|
247 |
// Get columns
|
248 |
$this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
|
249 |
|
250 |
// Vars
|
251 |
$per_page = $this->get_items_per_page('options_per_page', 100);
|
252 |
+
$current_page = $this->get_pagenum();
|
253 |
|
254 |
// Search
|
255 |
$search = (isset( $_REQUEST['s'])) ? $_REQUEST['s'] : false;
|
262 |
}*/
|
263 |
|
264 |
// Get total
|
265 |
+
$total_items = self::record_count($search);
|
266 |
|
267 |
if(!empty($search))
|
268 |
$per_page = $total_items;
|
269 |
|
270 |
+
$this->set_pagination_args(array(
|
271 |
+
'total_items' => $total_items,
|
272 |
+
'per_page' => $per_page
|
273 |
+
));
|
274 |
|
275 |
+
}
|
276 |
|
277 |
}
|
@@ -247,7 +247,7 @@ function acfe_options_load_edit($action){
|
|
247 |
|
248 |
// Add columns support
|
249 |
add_screen_option('layout_columns', array(
|
250 |
-
'max'
|
251 |
'default' => 2
|
252 |
));
|
253 |
|
@@ -497,13 +497,13 @@ function acfe_options_edit_metabox(){
|
|
497 |
|
498 |
// vars
|
499 |
$o = array(
|
500 |
-
'id'
|
501 |
-
'key'
|
502 |
-
'style'
|
503 |
-
'label'
|
504 |
-
'editLink'
|
505 |
-
'editTitle'
|
506 |
-
'visibility'
|
507 |
);
|
508 |
|
509 |
// load fields
|
247 |
|
248 |
// Add columns support
|
249 |
add_screen_option('layout_columns', array(
|
250 |
+
'max' => 2,
|
251 |
'default' => 2
|
252 |
));
|
253 |
|
497 |
|
498 |
// vars
|
499 |
$o = array(
|
500 |
+
'id' => $id,
|
501 |
+
'key' => $field_group['key'],
|
502 |
+
'style' => $field_group['style'],
|
503 |
+
'label' => $field_group['label_placement'],
|
504 |
+
'editLink' => '',
|
505 |
+
'editTitle' => __('Edit field group', 'acf'),
|
506 |
+
'visibility' => true
|
507 |
);
|
508 |
|
509 |
// load fields
|
@@ -658,7 +658,10 @@ class acfe_admin_settings_ui{
|
|
658 |
acf_render_field_wrap(array(
|
659 |
'type' => 'acfe_dynamic_message',
|
660 |
'label' => '',
|
661 |
-
'key' => '
|
|
|
|
|
|
|
662 |
'render' => function($field){
|
663 |
?>
|
664 |
<div>Default</div>
|
658 |
acf_render_field_wrap(array(
|
659 |
'type' => 'acfe_dynamic_message',
|
660 |
'label' => '',
|
661 |
+
'key' => 'field_acfe_settings_thead_' . $category,
|
662 |
+
'wrapper' => array(
|
663 |
+
'class' => 'acfe-settings-thead'
|
664 |
+
),
|
665 |
'render' => function($field){
|
666 |
?>
|
667 |
<div>Default</div>
|
@@ -9,9 +9,9 @@ class acfe_field_groups_export extends ACF_Admin_Tool{
|
|
9 |
|
10 |
function initialize(){
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
function load(){
|
17 |
|
@@ -53,8 +53,8 @@ class acfe_field_groups_export extends ACF_Admin_Tool{
|
|
53 |
|
54 |
// return
|
55 |
return $action;
|
56 |
-
|
57 |
-
|
58 |
|
59 |
}
|
60 |
|
9 |
|
10 |
function initialize(){
|
11 |
|
12 |
+
$this->name = 'acfe-export';
|
13 |
+
|
14 |
+
}
|
15 |
|
16 |
function load(){
|
17 |
|
53 |
|
54 |
// return
|
55 |
return $action;
|
56 |
+
|
57 |
+
}
|
58 |
|
59 |
}
|
60 |
|
@@ -25,7 +25,7 @@ class acfe_field_groups_local_export extends ACF_Admin_Tool{
|
|
25 |
$total = count($ids);
|
26 |
|
27 |
// Generate text.
|
28 |
-
$text = sprintf( _n( 'Imported 1 field group', 'Imported %s field groups', $total, 'acf' ), $total );
|
29 |
|
30 |
// Add links to text.
|
31 |
$links = array();
|
@@ -110,8 +110,8 @@ class acfe_field_groups_local_export extends ACF_Admin_Tool{
|
|
110 |
}
|
111 |
|
112 |
function html(){
|
113 |
-
|
114 |
-
|
115 |
|
116 |
$data = $this->get_data();
|
117 |
|
@@ -124,16 +124,16 @@ class acfe_field_groups_local_export extends ACF_Admin_Tool{
|
|
124 |
acf_update_setting('l10n_var_export', true);
|
125 |
|
126 |
$str_replace = array(
|
127 |
-
" "
|
128 |
-
"'!!__(!!\'"
|
129 |
-
"!!\', !!\'"
|
130 |
-
"!!\')!!'"
|
131 |
-
"array ("
|
132 |
);
|
133 |
|
134 |
$preg_replace = array(
|
135 |
-
'/([\t\r\n]+?)array/'
|
136 |
-
'/[0-9]+ => array/'
|
137 |
);
|
138 |
|
139 |
?>
|
@@ -199,9 +199,9 @@ class acfe_field_groups_local_export extends ACF_Admin_Tool{
|
|
199 |
|
200 |
// tooltip
|
201 |
acf.newTooltip({
|
202 |
-
text:
|
203 |
-
timeout:
|
204 |
-
target:
|
205 |
});
|
206 |
|
207 |
}catch(err){
|
@@ -215,18 +215,18 @@ class acfe_field_groups_local_export extends ACF_Admin_Tool{
|
|
215 |
</div>
|
216 |
</div>
|
217 |
<?php
|
218 |
-
|
219 |
}
|
220 |
|
221 |
-
|
222 |
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
$data = array();
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
return $data;
|
231 |
|
232 |
// Enable filters
|
@@ -261,13 +261,13 @@ class acfe_field_groups_local_export extends ACF_Admin_Tool{
|
|
261 |
$data[] = $field_group;
|
262 |
|
263 |
}
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
|
270 |
-
|
271 |
|
272 |
// vars
|
273 |
$keys_post = acf_maybe_get_POST('keys');
|
@@ -290,8 +290,8 @@ class acfe_field_groups_local_export extends ACF_Admin_Tool{
|
|
290 |
}
|
291 |
|
292 |
return $keys;
|
293 |
-
|
294 |
-
|
295 |
|
296 |
function get_action(){
|
297 |
|
@@ -305,8 +305,8 @@ class acfe_field_groups_local_export extends ACF_Admin_Tool{
|
|
305 |
|
306 |
// return
|
307 |
return $action;
|
308 |
-
|
309 |
-
|
310 |
|
311 |
}
|
312 |
|
25 |
$total = count($ids);
|
26 |
|
27 |
// Generate text.
|
28 |
+
$text = sprintf( _n( 'Imported 1 field group', 'Imported %s field groups', $total, 'acf' ), $total );
|
29 |
|
30 |
// Add links to text.
|
31 |
$links = array();
|
110 |
}
|
111 |
|
112 |
function html(){
|
113 |
+
|
114 |
+
if($this->is_active()){
|
115 |
|
116 |
$data = $this->get_data();
|
117 |
|
124 |
acf_update_setting('l10n_var_export', true);
|
125 |
|
126 |
$str_replace = array(
|
127 |
+
" " => "\t",
|
128 |
+
"'!!__(!!\'" => "__('",
|
129 |
+
"!!\', !!\'" => "', '",
|
130 |
+
"!!\')!!'" => "')",
|
131 |
+
"array (" => "array("
|
132 |
);
|
133 |
|
134 |
$preg_replace = array(
|
135 |
+
'/([\t\r\n]+?)array/' => 'array',
|
136 |
+
'/[0-9]+ => array/' => 'array'
|
137 |
);
|
138 |
|
139 |
?>
|
199 |
|
200 |
// tooltip
|
201 |
acf.newTooltip({
|
202 |
+
text: "<?php _e('Copied', 'acf' ); ?>",
|
203 |
+
timeout: 250,
|
204 |
+
target: $(this),
|
205 |
});
|
206 |
|
207 |
}catch(err){
|
215 |
</div>
|
216 |
</div>
|
217 |
<?php
|
218 |
+
|
219 |
}
|
220 |
|
221 |
+
}
|
222 |
|
223 |
+
function get_data(){
|
224 |
+
|
225 |
+
// vars
|
226 |
$data = array();
|
227 |
+
$keys = $this->get_keys();
|
228 |
+
|
229 |
+
if(!$keys)
|
230 |
return $data;
|
231 |
|
232 |
// Enable filters
|
261 |
$data[] = $field_group;
|
262 |
|
263 |
}
|
264 |
+
|
265 |
+
// return
|
266 |
+
return $data;
|
267 |
+
|
268 |
+
}
|
269 |
|
270 |
+
function get_keys(){
|
271 |
|
272 |
// vars
|
273 |
$keys_post = acf_maybe_get_POST('keys');
|
290 |
}
|
291 |
|
292 |
return $keys;
|
293 |
+
|
294 |
+
}
|
295 |
|
296 |
function get_action(){
|
297 |
|
305 |
|
306 |
// return
|
307 |
return $action;
|
308 |
+
|
309 |
+
}
|
310 |
|
311 |
}
|
312 |
|
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
|
3 |
if(!defined('ABSPATH'))
|
4 |
-
|
5 |
|
6 |
// Check setting
|
7 |
if(!acf_get_setting('acfe/modules/forms'))
|
8 |
-
|
9 |
|
10 |
if(!class_exists('acfe_dynamic_forms_import')):
|
11 |
|
1 |
<?php
|
2 |
|
3 |
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
|
6 |
// Check setting
|
7 |
if(!acf_get_setting('acfe/modules/forms'))
|
8 |
+
return;
|
9 |
|
10 |
if(!class_exists('acfe_dynamic_forms_import')):
|
11 |
|
@@ -50,13 +50,13 @@ class acfe_module_export extends ACF_Admin_Tool{
|
|
50 |
|
51 |
// render
|
52 |
acf_render_field_wrap(array(
|
53 |
-
'label'
|
54 |
-
'type'
|
55 |
-
'name'
|
56 |
-
'prefix'
|
57 |
-
'value'
|
58 |
-
'toggle'
|
59 |
-
'choices'
|
60 |
));
|
61 |
|
62 |
}
|
@@ -130,9 +130,9 @@ class acfe_module_export extends ACF_Admin_Tool{
|
|
130 |
|
131 |
// tooltip
|
132 |
acf.newTooltip({
|
133 |
-
text:
|
134 |
-
timeout:
|
135 |
-
target:
|
136 |
});
|
137 |
|
138 |
}catch(err){
|
@@ -151,8 +151,8 @@ class acfe_module_export extends ACF_Admin_Tool{
|
|
151 |
|
152 |
function load(){
|
153 |
|
154 |
-
|
155 |
-
|
156 |
|
157 |
$this->action = $this->get_action();
|
158 |
$this->data = $this->get_data();
|
@@ -188,7 +188,7 @@ class acfe_module_export extends ACF_Admin_Tool{
|
|
188 |
$keys = array_keys($this->data);
|
189 |
|
190 |
// validate
|
191 |
-
|
192 |
return acf_add_admin_notice($this->messages['not_selected'], 'warning');
|
193 |
}
|
194 |
|
@@ -235,53 +235,53 @@ class acfe_module_export extends ACF_Admin_Tool{
|
|
235 |
|
236 |
}
|
237 |
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
$data = array();
|
243 |
-
|
244 |
-
|
245 |
|
246 |
-
|
247 |
$args = $this->instance->export_data($key);
|
248 |
|
249 |
if(!$args)
|
250 |
continue;
|
251 |
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
$keys_post = acf_maybe_get_POST('keys');
|
264 |
$keys_get = acf_maybe_get_GET('keys');
|
265 |
$keys = array();
|
266 |
|
267 |
// $_POST
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
}
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
|
277 |
$keys_get = str_replace(' ', '+', $keys_get);
|
278 |
$keys = explode('+', $keys_get);
|
279 |
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
|
286 |
function get_action(){
|
287 |
|
@@ -295,8 +295,8 @@ class acfe_module_export extends ACF_Admin_Tool{
|
|
295 |
|
296 |
// return
|
297 |
return $action;
|
298 |
-
|
299 |
-
|
300 |
|
301 |
}
|
302 |
|
50 |
|
51 |
// render
|
52 |
acf_render_field_wrap(array(
|
53 |
+
'label' => $this->select,
|
54 |
+
'type' => 'checkbox',
|
55 |
+
'name' => 'keys',
|
56 |
+
'prefix' => false,
|
57 |
+
'value' => false,
|
58 |
+
'toggle' => true,
|
59 |
+
'choices' => $choices,
|
60 |
));
|
61 |
|
62 |
}
|
130 |
|
131 |
// tooltip
|
132 |
acf.newTooltip({
|
133 |
+
text: "<?php _e('Copied', 'acf' ); ?>",
|
134 |
+
timeout: 250,
|
135 |
+
target: $(this),
|
136 |
});
|
137 |
|
138 |
}catch(err){
|
151 |
|
152 |
function load(){
|
153 |
|
154 |
+
if(!$this->is_active())
|
155 |
+
return;
|
156 |
|
157 |
$this->action = $this->get_action();
|
158 |
$this->data = $this->get_data();
|
188 |
$keys = array_keys($this->data);
|
189 |
|
190 |
// validate
|
191 |
+
if(!$this->data){
|
192 |
return acf_add_admin_notice($this->messages['not_selected'], 'warning');
|
193 |
}
|
194 |
|
235 |
|
236 |
}
|
237 |
|
238 |
+
function get_data(){
|
239 |
+
|
240 |
+
// vars
|
241 |
+
$keys = $this->get_keys();
|
242 |
$data = array();
|
243 |
+
|
244 |
+
foreach($keys as $key){
|
245 |
|
246 |
+
// export
|
247 |
$args = $this->instance->export_data($key);
|
248 |
|
249 |
if(!$args)
|
250 |
continue;
|
251 |
|
252 |
+
$data[$key] = $args;
|
253 |
+
|
254 |
+
}
|
255 |
+
|
256 |
+
return $data;
|
257 |
+
|
258 |
+
}
|
259 |
|
260 |
+
function get_keys(){
|
261 |
+
|
262 |
+
// vars
|
263 |
$keys_post = acf_maybe_get_POST('keys');
|
264 |
$keys_get = acf_maybe_get_GET('keys');
|
265 |
$keys = array();
|
266 |
|
267 |
// $_POST
|
268 |
+
if($keys_post){
|
269 |
+
|
270 |
+
$keys = (array) $keys_post;
|
271 |
+
|
272 |
}
|
273 |
+
|
274 |
+
// $_GET
|
275 |
+
elseif($keys_get){
|
276 |
|
277 |
$keys_get = str_replace(' ', '+', $keys_get);
|
278 |
$keys = explode('+', $keys_get);
|
279 |
|
280 |
+
}
|
281 |
+
|
282 |
+
return $keys;
|
283 |
+
|
284 |
+
}
|
285 |
|
286 |
function get_action(){
|
287 |
|
295 |
|
296 |
// return
|
297 |
return $action;
|
298 |
+
|
299 |
+
}
|
300 |
|
301 |
}
|
302 |
|
@@ -19,16 +19,16 @@ class acfe_module_import extends ACF_Admin_Tool{
|
|
19 |
|
20 |
<div class="acf-fields">
|
21 |
<?php
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
</div>
|
33 |
|
34 |
<p class="acf-submit">
|
@@ -46,10 +46,10 @@ class acfe_module_import extends ACF_Admin_Tool{
|
|
46 |
if(!$json)
|
47 |
return;
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
// Import
|
55 |
$post_id = $this->instance->import($name, $args);
|
@@ -61,33 +61,33 @@ class acfe_module_import extends ACF_Admin_Tool{
|
|
61 |
continue;
|
62 |
|
63 |
}
|
64 |
-
|
65 |
-
// append message
|
66 |
-
$ids[] = $post_id;
|
67 |
|
68 |
-
|
|
|
|
|
|
|
69 |
|
70 |
if(empty($ids))
|
71 |
return;
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
do_action("acfe/{$this->hook}/import", $ids, $json);
|
92 |
|
93 |
}
|
19 |
|
20 |
<div class="acf-fields">
|
21 |
<?php
|
22 |
+
|
23 |
+
acf_render_field_wrap(array(
|
24 |
+
'label' => __('Select File', 'acf'),
|
25 |
+
'type' => 'file',
|
26 |
+
'name' => 'acf_import_file',
|
27 |
+
'value' => false,
|
28 |
+
'uploader' => 'basic',
|
29 |
+
));
|
30 |
+
|
31 |
+
?>
|
32 |
</div>
|
33 |
|
34 |
<p class="acf-submit">
|
46 |
if(!$json)
|
47 |
return;
|
48 |
|
49 |
+
$ids = array();
|
50 |
+
|
51 |
+
// Loop over json
|
52 |
+
foreach($json as $name => $args){
|
53 |
|
54 |
// Import
|
55 |
$post_id = $this->instance->import($name, $args);
|
61 |
continue;
|
62 |
|
63 |
}
|
|
|
|
|
|
|
64 |
|
65 |
+
// append message
|
66 |
+
$ids[] = $post_id;
|
67 |
+
|
68 |
+
}
|
69 |
|
70 |
if(empty($ids))
|
71 |
return;
|
72 |
+
|
73 |
+
// Count total
|
74 |
+
$total = count($ids);
|
75 |
+
|
76 |
+
// Generate text
|
77 |
+
$text = sprintf(_n($this->messages['success_single'], $this->messages['success_multiple'], $total, 'acf'), $total);
|
78 |
+
|
79 |
+
// Add links to text
|
80 |
+
$links = array();
|
81 |
+
foreach($ids as $id){
|
82 |
+
$links[] = '<a href="' . get_edit_post_link($id) . '">' . get_the_title($id) . '</a>';
|
83 |
+
}
|
84 |
+
|
85 |
+
$text .= ': ' . implode(', ', $links);
|
86 |
+
|
87 |
+
// Add notice
|
88 |
+
acf_add_admin_notice($text, 'success');
|
89 |
+
|
90 |
+
// Do Action
|
91 |
do_action("acfe/{$this->hook}/import", $ids, $json);
|
92 |
|
93 |
}
|
@@ -15,8 +15,8 @@
|
|
15 |
|
16 |
// render post data
|
17 |
acf_form_data(array(
|
18 |
-
'screen'
|
19 |
-
'post_id'
|
20 |
));
|
21 |
|
22 |
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
|
15 |
|
16 |
// render post data
|
17 |
acf_form_data(array(
|
18 |
+
'screen' => 'acfe-options-edit',
|
19 |
+
'post_id' => 'acfe_options_edit',
|
20 |
));
|
21 |
|
22 |
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
|
@@ -7,7 +7,7 @@ if(!class_exists('acfe_compatibility')):
|
|
7 |
|
8 |
class acfe_compatibility{
|
9 |
|
10 |
-
|
11 |
|
12 |
add_action('acf/init', array($this, 'init'), 98);
|
13 |
|
@@ -20,8 +20,9 @@ class acfe_compatibility{
|
|
20 |
add_filter('wpseo_metabox_prio', array($this, 'yoast_metaboxes_priority'));
|
21 |
add_filter('pll_get_post_types', array($this, 'polylang'), 10, 2);
|
22 |
add_action('elementor/documents/register_controls', array($this, 'elementor'));
|
|
|
23 |
|
24 |
-
|
25 |
|
26 |
function init(){
|
27 |
|
@@ -86,13 +87,13 @@ class acfe_compatibility{
|
|
86 |
if(acf_get_setting('acfe/modules/dynamic_taxonomies') !== null){
|
87 |
acf_update_setting('acfe/modules/taxonomies', acf_get_setting('acfe/modules/dynamic_taxonomies'));
|
88 |
}
|
89 |
-
|
90 |
}
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
function field_group_location_list($field_group){
|
97 |
|
98 |
if(!acf_maybe_get($field_group, 'location'))
|
@@ -129,10 +130,10 @@ class acfe_compatibility{
|
|
129 |
|
130 |
}
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
function field_acfe_update($field){
|
137 |
|
138 |
if(!acf_maybe_get($field, 'acfe_update'))
|
@@ -144,10 +145,10 @@ class acfe_compatibility{
|
|
144 |
|
145 |
}
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
function field_seamless_style($field){
|
152 |
|
153 |
if($seamless = acf_maybe_get($field, 'acfe_seemless_style', false)){
|
@@ -160,10 +161,10 @@ class acfe_compatibility{
|
|
160 |
|
161 |
}
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
function field_flexible_settings_title($fields, $parent){
|
168 |
|
169 |
// Check if is tool screen
|
@@ -452,11 +453,11 @@ class acfe_compatibility{
|
|
452 |
|
453 |
}
|
454 |
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
function pto_acf_field_group($ignore, $orderby, $query){
|
461 |
|
462 |
if(is_admin() && $query->is_main_query() && $query->get('post_type') === 'acf-field-group')
|
@@ -544,9 +545,6 @@ class acfe_compatibility{
|
|
544 |
|
545 |
add_filter('acf/load_field_groups', function($field_groups){
|
546 |
|
547 |
-
if(!$field_groups)
|
548 |
-
return $field_groups;
|
549 |
-
|
550 |
// Hidden Local Field Groups
|
551 |
$hidden = acfe_get_setting('reserved_field_groups', array());
|
552 |
|
@@ -563,7 +561,31 @@ class acfe_compatibility{
|
|
563 |
|
564 |
return $field_groups;
|
565 |
|
566 |
-
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
|
568 |
}
|
569 |
|
7 |
|
8 |
class acfe_compatibility{
|
9 |
|
10 |
+
function __construct(){
|
11 |
|
12 |
add_action('acf/init', array($this, 'init'), 98);
|
13 |
|
20 |
add_filter('wpseo_metabox_prio', array($this, 'yoast_metaboxes_priority'));
|
21 |
add_filter('pll_get_post_types', array($this, 'polylang'), 10, 2);
|
22 |
add_action('elementor/documents/register_controls', array($this, 'elementor'));
|
23 |
+
add_filter('wpgraphql_acf_supported_fields', array($this, 'wpgraphql'));
|
24 |
|
25 |
+
}
|
26 |
|
27 |
function init(){
|
28 |
|
87 |
if(acf_get_setting('acfe/modules/dynamic_taxonomies') !== null){
|
88 |
acf_update_setting('acfe/modules/taxonomies', acf_get_setting('acfe/modules/dynamic_taxonomies'));
|
89 |
}
|
90 |
+
|
91 |
}
|
92 |
|
93 |
+
/**
|
94 |
+
* ACF Extended: 0.8
|
95 |
+
* Field Group Location: Archive renamed to List
|
96 |
+
*/
|
97 |
function field_group_location_list($field_group){
|
98 |
|
99 |
if(!acf_maybe_get($field_group, 'location'))
|
130 |
|
131 |
}
|
132 |
|
133 |
+
/**
|
134 |
+
* ACF Extended: 0.8
|
135 |
+
* Field Filter Value: Removed from this version
|
136 |
+
*/
|
137 |
function field_acfe_update($field){
|
138 |
|
139 |
if(!acf_maybe_get($field, 'acfe_update'))
|
145 |
|
146 |
}
|
147 |
|
148 |
+
/**
|
149 |
+
* ACF Extended: 0.8.5
|
150 |
+
* Field Group/Clone: Fixed typo "Seamless"
|
151 |
+
*/
|
152 |
function field_seamless_style($field){
|
153 |
|
154 |
if($seamless = acf_maybe_get($field, 'acfe_seemless_style', false)){
|
161 |
|
162 |
}
|
163 |
|
164 |
+
/**
|
165 |
+
* ACF Extended: 0.8.4.5
|
166 |
+
* Field Flexible Content: Fix duplicated "layout_settings" & "layout_title"
|
167 |
+
*/
|
168 |
function field_flexible_settings_title($fields, $parent){
|
169 |
|
170 |
// Check if is tool screen
|
453 |
|
454 |
}
|
455 |
|
456 |
+
/**
|
457 |
+
* Plugin: Post Types Order
|
458 |
+
* https://wordpress.org/plugins/post-types-order/
|
459 |
+
* The plugin apply custom order to ACF Field Group Post Type. We have to fix this
|
460 |
+
*/
|
461 |
function pto_acf_field_group($ignore, $orderby, $query){
|
462 |
|
463 |
if(is_admin() && $query->is_main_query() && $query->get('post_type') === 'acf-field-group')
|
545 |
|
546 |
add_filter('acf/load_field_groups', function($field_groups){
|
547 |
|
|
|
|
|
|
|
548 |
// Hidden Local Field Groups
|
549 |
$hidden = acfe_get_setting('reserved_field_groups', array());
|
550 |
|
561 |
|
562 |
return $field_groups;
|
563 |
|
564 |
+
}, 25);
|
565 |
+
|
566 |
+
}
|
567 |
+
|
568 |
+
/*
|
569 |
+
* ACF Extended: 0.8.8.2
|
570 |
+
* WP GraphQL ACF Supported Fields
|
571 |
+
*/
|
572 |
+
function wpgraphql($fields){
|
573 |
+
|
574 |
+
$acfe_fields = array(
|
575 |
+
'acfe_advanced_link',
|
576 |
+
'acfe_button',
|
577 |
+
'acfe_code_editor',
|
578 |
+
'acfe_forms',
|
579 |
+
'acfe_hidden',
|
580 |
+
'acfe_post_statuses',
|
581 |
+
'acfe_post_types',
|
582 |
+
'acfe_slug',
|
583 |
+
'acfe_taxonomies',
|
584 |
+
'acfe_taxonomiy_terms',
|
585 |
+
'acfe_user_roles',
|
586 |
+
);
|
587 |
+
|
588 |
+
return array_merge($fields, $acfe_fields);
|
589 |
|
590 |
}
|
591 |
|
@@ -795,12 +795,12 @@ function acfe_get_taxonomy_objects($args = array()){
|
|
795 |
* Similar to acf_get_pretty_post_types() but for Post Statuses
|
796 |
*/
|
797 |
function acfe_get_pretty_post_statuses($posts_statuses = array()){
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
|
805 |
$return = array();
|
806 |
|
@@ -818,7 +818,7 @@ function acfe_get_pretty_post_statuses($posts_statuses = array()){
|
|
818 |
}
|
819 |
|
820 |
return $return;
|
821 |
-
|
822 |
}
|
823 |
|
824 |
/*
|
@@ -826,8 +826,8 @@ function acfe_get_pretty_post_statuses($posts_statuses = array()){
|
|
826 |
* Similar to acf_get_pretty_post_types() but for ACFE Forms
|
827 |
*/
|
828 |
function acfe_get_pretty_forms($forms = array()){
|
829 |
-
|
830 |
-
|
831 |
|
832 |
$forms = get_posts(array(
|
833 |
'post_type' => 'acfe-form',
|
@@ -836,8 +836,8 @@ function acfe_get_pretty_forms($forms = array()){
|
|
836 |
'orderby' => 'title',
|
837 |
'order' => 'ASC',
|
838 |
));
|
839 |
-
|
840 |
-
|
841 |
|
842 |
$return = array();
|
843 |
|
@@ -855,7 +855,7 @@ function acfe_get_pretty_forms($forms = array()){
|
|
855 |
}
|
856 |
|
857 |
return $return;
|
858 |
-
|
859 |
}
|
860 |
|
861 |
/*
|
@@ -1147,55 +1147,55 @@ function acfe_add_validation_error($selector = '', $message = ''){
|
|
1147 |
* Returns "array('256' => 'Category name')" instead of "array('category:category_name' => 'Category name')"
|
1148 |
*/
|
1149 |
function acfe_get_taxonomy_terms_ids($taxonomies = array()){
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
}
|
1200 |
|
1201 |
/*
|
@@ -1235,39 +1235,39 @@ function acfe_number_suffix($num){
|
|
1235 |
* Convert an array to string
|
1236 |
*/
|
1237 |
function acfe_array_to_string($array = array()){
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
}
|
1272 |
|
1273 |
/*
|
@@ -1331,9 +1331,9 @@ function acfe_is_admin_screen($modules = false){
|
|
1331 |
* Check if the developer mode is enabled
|
1332 |
*/
|
1333 |
function acfe_is_dev(){
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
}
|
1338 |
|
1339 |
/*
|
@@ -1341,9 +1341,9 @@ function acfe_is_dev(){
|
|
1341 |
* Only for awesome developers!
|
1342 |
*/
|
1343 |
function acfe_is_super_dev(){
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
}
|
1348 |
|
1349 |
/*
|
@@ -1609,29 +1609,15 @@ function acfe_get_post_id(){
|
|
1609 |
// Legacy ACF method
|
1610 |
$post_id = acf_get_valid_post_id();
|
1611 |
|
1612 |
-
//
|
1613 |
-
|
1614 |
-
|
1615 |
-
// ACF Local Meta
|
1616 |
-
$local_acf_meta = acf_get_instance('ACF_Local_Meta')->meta;
|
1617 |
-
|
1618 |
-
if(!empty($local_acf_meta)){
|
1619 |
-
$local_post_id = array_merge($local_post_id, array_keys($local_acf_meta));
|
1620 |
-
}
|
1621 |
-
|
1622 |
-
// ACFE Local Meta
|
1623 |
-
$local_acfe_meta = acf_get_instance('ACFE_Local_Meta')->meta;
|
1624 |
-
|
1625 |
-
if(!empty($local_acfe_meta)){
|
1626 |
-
$local_post_id = array_merge($local_post_id, array_keys($local_acfe_meta));
|
1627 |
-
}
|
1628 |
|
1629 |
-
|
1630 |
-
|
1631 |
-
$exclude = apply_filters('acfe/get_post_id', $local_post_id);
|
1632 |
|
1633 |
-
|
1634 |
-
|
|
|
|
|
1635 |
|
1636 |
if($post_id)
|
1637 |
return $post_id;
|
@@ -1648,6 +1634,11 @@ function acfe_get_post_id(){
|
|
1648 |
if(!$post_id){
|
1649 |
$post_id = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : 0;
|
1650 |
}
|
|
|
|
|
|
|
|
|
|
|
1651 |
|
1652 |
// $_REQUEST['user_id']
|
1653 |
if(!$post_id){
|
795 |
* Similar to acf_get_pretty_post_types() but for Post Statuses
|
796 |
*/
|
797 |
function acfe_get_pretty_post_statuses($posts_statuses = array()){
|
798 |
+
|
799 |
+
if(empty($posts_statuses)){
|
800 |
+
|
801 |
+
$posts_statuses = get_post_stati(array(), 'names');
|
802 |
+
|
803 |
+
}
|
804 |
|
805 |
$return = array();
|
806 |
|
818 |
}
|
819 |
|
820 |
return $return;
|
821 |
+
|
822 |
}
|
823 |
|
824 |
/*
|
826 |
* Similar to acf_get_pretty_post_types() but for ACFE Forms
|
827 |
*/
|
828 |
function acfe_get_pretty_forms($forms = array()){
|
829 |
+
|
830 |
+
if(empty($forms)){
|
831 |
|
832 |
$forms = get_posts(array(
|
833 |
'post_type' => 'acfe-form',
|
836 |
'orderby' => 'title',
|
837 |
'order' => 'ASC',
|
838 |
));
|
839 |
+
|
840 |
+
}
|
841 |
|
842 |
$return = array();
|
843 |
|
855 |
}
|
856 |
|
857 |
return $return;
|
858 |
+
|
859 |
}
|
860 |
|
861 |
/*
|
1147 |
* Returns "array('256' => 'Category name')" instead of "array('category:category_name' => 'Category name')"
|
1148 |
*/
|
1149 |
function acfe_get_taxonomy_terms_ids($taxonomies = array()){
|
1150 |
+
|
1151 |
+
// force array
|
1152 |
+
$taxonomies = acf_get_array($taxonomies);
|
1153 |
+
|
1154 |
+
// get pretty taxonomy names
|
1155 |
+
$taxonomies = acf_get_taxonomy_labels($taxonomies);
|
1156 |
+
|
1157 |
+
// vars
|
1158 |
+
$r = array();
|
1159 |
+
|
1160 |
+
// populate $r
|
1161 |
+
foreach(array_keys($taxonomies) as $taxonomy){
|
1162 |
+
|
1163 |
+
// vars
|
1164 |
+
$label = $taxonomies[$taxonomy];
|
1165 |
+
$is_hierarchical = is_taxonomy_hierarchical($taxonomy);
|
1166 |
+
|
1167 |
+
$terms = acf_get_terms(array(
|
1168 |
+
'taxonomy' => $taxonomy,
|
1169 |
+
'hide_empty' => false
|
1170 |
+
));
|
1171 |
+
|
1172 |
+
// bail early if no terms
|
1173 |
+
if(empty($terms))
|
1174 |
+
continue;
|
1175 |
+
|
1176 |
+
// sort into hierachial order!
|
1177 |
+
if($is_hierarchical){
|
1178 |
+
|
1179 |
+
$terms = _get_term_children(0, $terms, $taxonomy);
|
1180 |
+
|
1181 |
+
}
|
1182 |
+
|
1183 |
+
// add placeholder
|
1184 |
+
$r[ $label ] = array();
|
1185 |
+
|
1186 |
+
// add choices
|
1187 |
+
foreach($terms as $term){
|
1188 |
+
|
1189 |
+
$k = "{$term->term_id}";
|
1190 |
+
$r[$label][$k] = acf_get_term_title($term);
|
1191 |
+
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
// return
|
1197 |
+
return $r;
|
1198 |
+
|
1199 |
}
|
1200 |
|
1201 |
/*
|
1235 |
* Convert an array to string
|
1236 |
*/
|
1237 |
function acfe_array_to_string($array = array()){
|
1238 |
+
|
1239 |
+
if(!is_array($array))
|
1240 |
+
return $array;
|
1241 |
+
|
1242 |
+
if(empty($array))
|
1243 |
+
return false;
|
1244 |
+
|
1245 |
+
if(acf_is_sequential_array($array)){
|
1246 |
+
|
1247 |
+
foreach($array as $k => $v){
|
1248 |
+
|
1249 |
+
if(!is_string($v))
|
1250 |
+
continue;
|
1251 |
+
|
1252 |
+
return $v;
|
1253 |
+
|
1254 |
+
}
|
1255 |
+
|
1256 |
+
}elseif(acf_is_associative_array($array)){
|
1257 |
+
|
1258 |
+
foreach($array as $k => $v){
|
1259 |
+
|
1260 |
+
if(!is_string($v))
|
1261 |
+
continue;
|
1262 |
+
|
1263 |
+
return $v;
|
1264 |
+
|
1265 |
+
}
|
1266 |
+
|
1267 |
+
}
|
1268 |
+
|
1269 |
+
return false;
|
1270 |
+
|
1271 |
}
|
1272 |
|
1273 |
/*
|
1331 |
* Check if the developer mode is enabled
|
1332 |
*/
|
1333 |
function acfe_is_dev(){
|
1334 |
+
|
1335 |
+
return acf_get_setting('acfe/dev', false) || (defined('ACFE_dev') && ACFE_dev);
|
1336 |
+
|
1337 |
}
|
1338 |
|
1339 |
/*
|
1341 |
* Only for awesome developers!
|
1342 |
*/
|
1343 |
function acfe_is_super_dev(){
|
1344 |
+
|
1345 |
+
return acf_get_setting('acfe/super_dev', false) || (defined('ACFE_super_dev') && ACFE_super_dev);
|
1346 |
+
|
1347 |
}
|
1348 |
|
1349 |
/*
|
1609 |
// Legacy ACF method
|
1610 |
$post_id = acf_get_valid_post_id();
|
1611 |
|
1612 |
+
// Exclude local meta post ids
|
1613 |
+
if(function_exists('acfe_get_local_post_ids')){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1614 |
|
1615 |
+
$exclude_post_ids = acfe_get_local_post_ids();
|
|
|
|
|
1616 |
|
1617 |
+
if(in_array($post_id, $exclude_post_ids))
|
1618 |
+
$post_id = false;
|
1619 |
+
|
1620 |
+
}
|
1621 |
|
1622 |
if($post_id)
|
1623 |
return $post_id;
|
1634 |
if(!$post_id){
|
1635 |
$post_id = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : 0;
|
1636 |
}
|
1637 |
+
|
1638 |
+
// $_REQUEST['post_id'] - ACF Block Type
|
1639 |
+
if(!$post_id){
|
1640 |
+
$post_id = isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : 0;
|
1641 |
+
}
|
1642 |
|
1643 |
// $_REQUEST['user_id']
|
1644 |
if(!$post_id){
|
@@ -47,34 +47,56 @@ class acfe_hooks{
|
|
47 |
|
48 |
// Validate acf
|
49 |
if(!acf_maybe_get_POST('acf'))
|
50 |
-
return
|
51 |
|
52 |
-
//
|
53 |
$data = $this->decode_object($post_id);
|
54 |
|
55 |
if(!$data)
|
56 |
-
return
|
57 |
|
|
|
58 |
$id = $data['id'];
|
59 |
$type = $data['type'];
|
60 |
$object = $data['object'];
|
61 |
$hooks = $data['hooks'];
|
62 |
$suffix = $pre ? 'pre_' : false;
|
63 |
-
|
64 |
-
//
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
}
|
75 |
|
76 |
-
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
acfe_reset_meta();
|
79 |
|
80 |
}
|
@@ -110,30 +132,54 @@ class acfe_hooks{
|
|
110 |
|
111 |
foreach($rows as $post_id => $acf){
|
112 |
|
113 |
-
//
|
114 |
$data = $this->decode_object($post_id);
|
115 |
|
116 |
if(!$data)
|
117 |
continue;
|
118 |
-
|
|
|
119 |
$id = $data['id'];
|
120 |
$type = $data['type'];
|
121 |
$object = $data['object'];
|
122 |
$hooks = $data['hooks'];
|
123 |
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
-
|
127 |
-
do_action("acfe/validate_save/id={$post_id}", $post_id, $object);
|
128 |
|
129 |
-
do_action
|
|
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
acfe_reset_meta();
|
138 |
|
139 |
}
|
@@ -430,9 +476,9 @@ class acfe_hooks{
|
|
430 |
return;
|
431 |
|
432 |
acf_hidden_input(array(
|
433 |
-
'id'
|
434 |
-
'name'
|
435 |
-
'value'
|
436 |
));
|
437 |
|
438 |
}
|
47 |
|
48 |
// Validate acf
|
49 |
if(!acf_maybe_get_POST('acf'))
|
50 |
+
return;
|
51 |
|
52 |
+
// Check data
|
53 |
$data = $this->decode_object($post_id);
|
54 |
|
55 |
if(!$data)
|
56 |
+
return;
|
57 |
|
58 |
+
// Vars
|
59 |
$id = $data['id'];
|
60 |
$type = $data['type'];
|
61 |
$object = $data['object'];
|
62 |
$hooks = $data['hooks'];
|
63 |
$suffix = $pre ? 'pre_' : false;
|
64 |
+
|
65 |
+
// All hooks
|
66 |
+
$all_hooks = array();
|
67 |
+
$all_hooks[] = "acfe/{$suffix}save";
|
68 |
+
$all_hooks[] = "acfe/{$suffix}save/id={$post_id}";
|
69 |
+
$all_hooks[] = "acfe/{$suffix}save_{$type}";
|
70 |
+
foreach($hooks as $hook){
|
71 |
+
$all_hooks[] = "acfe/{$suffix}save_{$type}/{$hook}";
|
72 |
+
}
|
73 |
+
$all_hooks[] = "acfe/{$suffix}save_{$type}/id={$post_id}";
|
74 |
+
|
75 |
+
// Check if hooked
|
76 |
+
$do_action = false;
|
77 |
+
|
78 |
+
foreach($all_hooks as $all_hook){
|
79 |
|
80 |
+
if(!has_action($all_hook)) continue;
|
81 |
|
82 |
+
$do_action = true;
|
83 |
+
break;
|
|
|
84 |
|
85 |
+
}
|
86 |
|
87 |
+
// Bail early
|
88 |
+
if(!$do_action)
|
89 |
+
return;
|
90 |
+
|
91 |
+
// Setup Meta
|
92 |
+
acfe_setup_meta($_POST['acf'], 'acfe/save', true);
|
93 |
+
|
94 |
+
foreach($all_hooks as $all_hook){
|
95 |
+
|
96 |
+
do_action($all_hook, $post_id, $object);
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
acfe_reset_meta();
|
101 |
|
102 |
}
|
132 |
|
133 |
foreach($rows as $post_id => $acf){
|
134 |
|
135 |
+
// Check data
|
136 |
$data = $this->decode_object($post_id);
|
137 |
|
138 |
if(!$data)
|
139 |
continue;
|
140 |
+
|
141 |
+
// Vars
|
142 |
$id = $data['id'];
|
143 |
$type = $data['type'];
|
144 |
$object = $data['object'];
|
145 |
$hooks = $data['hooks'];
|
146 |
|
147 |
+
// All hooks
|
148 |
+
$all_hooks = array();
|
149 |
+
$all_hooks[] = "acfe/validate_save";
|
150 |
+
$all_hooks[] = "acfe/validate_save/id={$post_id}";
|
151 |
+
$all_hooks[] = "acfe/validate_save_{$type}";
|
152 |
+
foreach($hooks as $hook){
|
153 |
+
$all_hooks[] = "acfe/validate_save_{$type}/{$hook}";
|
154 |
+
}
|
155 |
+
$all_hooks[] = "acfe/validate_save_{$type}/id={$post_id}";
|
156 |
+
|
157 |
+
// Check if hooked
|
158 |
+
$do_action = false;
|
159 |
+
|
160 |
+
foreach($all_hooks as $all_hook){
|
161 |
|
162 |
+
if(!has_action($all_hook)) continue;
|
|
|
163 |
|
164 |
+
$do_action = true;
|
165 |
+
break;
|
166 |
|
167 |
+
}
|
168 |
+
|
169 |
+
// Bail early
|
170 |
+
if(!$do_action)
|
171 |
+
continue;
|
172 |
+
|
173 |
+
// Setup Meta
|
174 |
+
acfe_setup_meta($acf, 'acfe/validate_save', true);
|
175 |
|
176 |
+
foreach($all_hooks as $all_hook){
|
177 |
+
|
178 |
+
do_action($all_hook, $post_id, $object);
|
179 |
+
|
180 |
+
}
|
181 |
+
|
182 |
+
// Reset meta
|
183 |
acfe_reset_meta();
|
184 |
|
185 |
}
|
476 |
return;
|
477 |
|
478 |
acf_hidden_input(array(
|
479 |
+
'id' => '_acf_options_page',
|
480 |
+
'name' => '_acf_options_page',
|
481 |
+
'value' => $plugin_page
|
482 |
));
|
483 |
|
484 |
}
|
@@ -4,96 +4,97 @@ if(!defined('ABSPATH'))
|
|
4 |
exit;
|
5 |
|
6 |
if(!class_exists('ACFE_Local_Meta')):
|
7 |
-
|
8 |
class ACFE_Local_Meta{
|
9 |
|
10 |
-
|
11 |
var $meta = array();
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
/**
|
17 |
-
* __construct
|
18 |
-
*
|
19 |
-
* Sets up the class functionality.
|
20 |
-
*
|
21 |
-
* @date 8/10/18
|
22 |
-
* @since 5.8.0
|
23 |
-
*
|
24 |
-
* @param void
|
25 |
-
* @return void
|
26 |
*/
|
27 |
-
function __construct()
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
// add filters
|
30 |
-
add_filter( 'acf/pre_load_post_id', array($this, 'pre_load_post_id'), 1, 2 );
|
31 |
-
add_filter( 'acf/pre_load_meta', array($this, 'pre_load_meta'), 1, 2 );
|
32 |
-
add_filter( 'acf/pre_load_metadata', array($this, 'pre_load_metadata'), 1, 4 );
|
33 |
}
|
34 |
|
35 |
-
|
36 |
-
*
|
37 |
-
*
|
38 |
-
* Adds postmeta to storage.
|
39 |
-
* Accepts data in either raw or request format.
|
40 |
-
*
|
41 |
-
* @date 8/10/18
|
42 |
-
* @since 5.8.0
|
43 |
-
*
|
44 |
-
* @param array $meta An array of metdata to store.
|
45 |
-
* @param mixed $post_id The post_id for this data.
|
46 |
-
* @param bool $is_main Makes this postmeta visible to get_field() without a $post_id value.
|
47 |
-
* @return array
|
48 |
*/
|
49 |
-
function add(
|
50 |
|
51 |
-
// Capture meta
|
52 |
-
if(
|
53 |
-
$meta = $this->capture(
|
54 |
}
|
55 |
|
56 |
-
// Add to storage
|
57 |
-
$this->meta[
|
58 |
|
59 |
-
//
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
62 |
}
|
63 |
|
64 |
// Return meta.
|
65 |
return $meta;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
|
68 |
-
|
69 |
-
*
|
70 |
-
*
|
71 |
-
* Returns true if the supplied $meta is from a REQUEST (serialized <form> data).
|
72 |
-
*
|
73 |
-
* @date 11/3/19
|
74 |
-
* @since 5.7.14
|
75 |
-
*
|
76 |
-
* @param array $meta An array of metdata to check.
|
77 |
-
* @return bool
|
78 |
*/
|
79 |
-
function is_request(
|
80 |
-
return acf_is_field_key(
|
81 |
}
|
82 |
|
83 |
-
|
84 |
-
*
|
85 |
-
*
|
86 |
-
* Returns a flattened array of meta for the given postdata.
|
87 |
-
* This is achieved by simulating a save whilst capturing all meta changes.
|
88 |
-
*
|
89 |
-
* @date 26/2/19
|
90 |
-
* @since 5.7.13
|
91 |
-
*
|
92 |
-
* @param array $values An array of raw values.
|
93 |
-
* @param mixed $post_id The post_id for this data.
|
94 |
-
* @return array
|
95 |
*/
|
96 |
-
function capture(
|
97 |
|
98 |
// Reset meta.
|
99 |
$this->meta[ $post_id ] = array();
|
@@ -102,8 +103,8 @@ class ACFE_Local_Meta{
|
|
102 |
add_filter('acf/pre_update_metadata', array($this, 'capture_update_metadata'), 1, 5);
|
103 |
|
104 |
// Simulate update.
|
105 |
-
if(
|
106 |
-
|
107 |
}
|
108 |
|
109 |
// Remove listener filter.
|
@@ -111,149 +112,171 @@ class ACFE_Local_Meta{
|
|
111 |
|
112 |
// Return meta.
|
113 |
return $this->meta[ $post_id ];
|
|
|
114 |
}
|
115 |
|
116 |
-
|
117 |
-
*
|
118 |
-
*
|
119 |
-
* Records all meta activity and returns a non null value to bypass DB updates.
|
120 |
-
*
|
121 |
-
* @date 26/2/19
|
122 |
-
* @since 5.7.13
|
123 |
-
*
|
124 |
-
* @param null $null .
|
125 |
-
* @param (int|string) $post_id The post id.
|
126 |
-
* @param string $name The meta name.
|
127 |
-
* @param mixed $value The meta value.
|
128 |
-
* @param bool $hidden If the meta is hidden (starts with an underscore).
|
129 |
-
* @return false.
|
130 |
*/
|
131 |
-
function capture_update_metadata(
|
|
|
132 |
$name = ($hidden ? '_' : '') . $name;
|
133 |
$this->meta[ $post_id ][ $name ] = $value;
|
134 |
|
135 |
// Return non null value to escape update process.
|
136 |
return true;
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* remove
|
141 |
-
*
|
142 |
-
* Removes postmeta from storage.
|
143 |
-
*
|
144 |
-
* @date 8/10/18
|
145 |
-
* @since 5.8.0
|
146 |
-
*
|
147 |
-
* @param mixed $post_id The post_id for this data.
|
148 |
-
* @return void
|
149 |
-
*/
|
150 |
-
function remove( $post_id = 0 ) {
|
151 |
-
|
152 |
-
// unset meta
|
153 |
-
unset( $this->meta[ $post_id ] );
|
154 |
|
155 |
-
// reset post_id
|
156 |
-
if( $post_id === 0 || $post_id === end($this->post_id) ) {
|
157 |
-
|
158 |
-
// Remove last post id
|
159 |
-
array_pop($this->post_id);
|
160 |
-
|
161 |
-
}
|
162 |
}
|
163 |
|
164 |
-
|
165 |
-
*
|
166 |
-
*
|
167 |
-
* Injects the local meta.
|
168 |
-
*
|
169 |
-
* @date 8/10/18
|
170 |
-
* @since 5.8.0
|
171 |
-
*
|
172 |
-
* @param null $null An empty parameter. Return a non null value to short-circuit the function.
|
173 |
-
* @param mixed $post_id The post_id for this data.
|
174 |
-
* @return mixed
|
175 |
*/
|
176 |
-
function pre_load_meta(
|
177 |
-
|
|
|
178 |
return $this->meta[ $post_id ];
|
179 |
}
|
|
|
180 |
return $null;
|
|
|
181 |
}
|
182 |
|
183 |
-
|
184 |
-
*
|
185 |
-
*
|
186 |
-
* Injects the local meta.
|
187 |
-
*
|
188 |
-
* @date 8/10/18
|
189 |
-
* @since 5.8.0
|
190 |
-
*
|
191 |
-
* @param null $null An empty parameter. Return a non null value to short-circuit the function.
|
192 |
-
* @param (int|string) $post_id The post id.
|
193 |
-
* @param string $name The meta name.
|
194 |
-
* @param bool $hidden If the meta is hidden (starts with an underscore).
|
195 |
-
* @return mixed
|
196 |
*/
|
197 |
-
function pre_load_metadata(
|
|
|
198 |
$name = ($hidden ? '_' : '') . $name;
|
199 |
-
|
200 |
-
|
|
|
|
|
201 |
return $this->meta[ $post_id ][ $name ];
|
202 |
}
|
203 |
return '__return_null';
|
|
|
204 |
}
|
|
|
205 |
return $null;
|
|
|
206 |
}
|
207 |
|
208 |
-
|
209 |
-
*
|
210 |
-
*
|
211 |
-
* Injects the local post_id.
|
212 |
-
*
|
213 |
-
* @date 8/10/18
|
214 |
-
* @since 5.8.0
|
215 |
-
*
|
216 |
-
* @param null $null An empty parameter. Return a non null value to short-circuit the function.
|
217 |
-
* @param mixed $post_id The post_id for this data.
|
218 |
-
* @return mixed
|
219 |
*/
|
220 |
-
function
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
}
|
224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
|
227 |
}
|
228 |
|
229 |
endif;
|
230 |
|
231 |
-
|
232 |
* acfe_setup_meta
|
233 |
-
*
|
234 |
-
* Adds postmeta to storage.
|
235 |
-
*
|
236 |
-
* @date 8/10/18
|
237 |
-
* @since 5.8.0
|
238 |
-
* @see ACFE_Local_Meta::add() for list of parameters.
|
239 |
-
*
|
240 |
-
* @return array
|
241 |
*/
|
242 |
-
function acfe_setup_meta(
|
243 |
-
return acf_get_instance('ACFE_Local_Meta')->add(
|
244 |
}
|
245 |
|
246 |
-
|
247 |
* acfe_reset_meta
|
248 |
-
*
|
249 |
-
* Removes postmeta to storage.
|
250 |
-
*
|
251 |
-
* @date 8/10/18
|
252 |
-
* @since 5.8.0
|
253 |
-
* @see ACFE_Local_Meta::remove() for list of parameters.
|
254 |
-
*
|
255 |
-
* @return void
|
256 |
*/
|
257 |
-
function acfe_reset_meta(
|
258 |
-
return acf_get_instance('ACFE_Local_Meta')->remove(
|
259 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
exit;
|
5 |
|
6 |
if(!class_exists('ACFE_Local_Meta')):
|
7 |
+
|
8 |
class ACFE_Local_Meta{
|
9 |
|
10 |
+
// Vars
|
11 |
var $meta = array();
|
12 |
+
var $curr_id = array();
|
13 |
+
var $main_id = array();
|
14 |
|
15 |
+
/*
|
16 |
+
* Construct
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
*/
|
18 |
+
function __construct(){
|
19 |
+
|
20 |
+
// Filters
|
21 |
+
add_filter('acf/pre_load_post_id', array($this, 'pre_load_post_id'), 1, 2);
|
22 |
+
add_filter('acf/pre_load_meta', array($this, 'pre_load_meta'), 1, 2);
|
23 |
+
add_filter('acf/pre_load_metadata', array($this, 'pre_load_metadata'), 1, 4);
|
24 |
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
|
27 |
+
/*
|
28 |
+
* Add
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
*/
|
30 |
+
function add($meta = array(), $post_id = 0, $is_main = false){
|
31 |
|
32 |
+
// Capture meta
|
33 |
+
if($this->is_request($meta)){
|
34 |
+
$meta = $this->capture($meta, $post_id);
|
35 |
}
|
36 |
|
37 |
+
// Add to storage
|
38 |
+
$this->meta[$post_id] = $meta;
|
39 |
|
40 |
+
// Add to current ID
|
41 |
+
$this->curr_id[] = $post_id;
|
42 |
+
|
43 |
+
// Add to main ID
|
44 |
+
if($is_main){
|
45 |
+
$this->main_id[] = $post_id;
|
46 |
}
|
47 |
|
48 |
// Return meta.
|
49 |
return $meta;
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
/*
|
54 |
+
* Remove
|
55 |
+
*/
|
56 |
+
function remove(){
|
57 |
+
|
58 |
+
// unset meta
|
59 |
+
unset($this->meta[end($this->curr_id)]);
|
60 |
+
|
61 |
+
// reset main id
|
62 |
+
if(end($this->curr_id) === end($this->main_id)){
|
63 |
+
|
64 |
+
// remove last value of main id
|
65 |
+
array_pop($this->main_id);
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
// remove last value of current id
|
70 |
+
array_pop($this->curr_id);
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
/*
|
75 |
+
* Preload Post ID
|
76 |
+
*/
|
77 |
+
function pre_load_post_id($null, $post_id){
|
78 |
+
|
79 |
+
if(!$post_id && end($this->curr_id) === end($this->main_id)){
|
80 |
+
return end($this->main_id);
|
81 |
+
}
|
82 |
+
|
83 |
+
return $null;
|
84 |
+
|
85 |
}
|
86 |
|
87 |
+
/*
|
88 |
+
* Is Request
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
*/
|
90 |
+
function is_request($meta = array()){
|
91 |
+
return acf_is_field_key(key($meta));
|
92 |
}
|
93 |
|
94 |
+
/*
|
95 |
+
* Capture
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
*/
|
97 |
+
function capture($values = array(), $post_id = 0){
|
98 |
|
99 |
// Reset meta.
|
100 |
$this->meta[ $post_id ] = array();
|
103 |
add_filter('acf/pre_update_metadata', array($this, 'capture_update_metadata'), 1, 5);
|
104 |
|
105 |
// Simulate update.
|
106 |
+
if($values){
|
107 |
+
$this->update_values($values, $post_id);
|
108 |
}
|
109 |
|
110 |
// Remove listener filter.
|
112 |
|
113 |
// Return meta.
|
114 |
return $this->meta[ $post_id ];
|
115 |
+
|
116 |
}
|
117 |
|
118 |
+
/*
|
119 |
+
* Capture Update Metadata
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
*/
|
121 |
+
function capture_update_metadata($null, $post_id, $name, $value, $hidden){
|
122 |
+
|
123 |
$name = ($hidden ? '_' : '') . $name;
|
124 |
$this->meta[ $post_id ][ $name ] = $value;
|
125 |
|
126 |
// Return non null value to escape update process.
|
127 |
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
}
|
130 |
|
131 |
+
/*
|
132 |
+
* Preload Meta
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
*/
|
134 |
+
function pre_load_meta($null, $post_id){
|
135 |
+
|
136 |
+
if(isset($this->meta[ $post_id ])){
|
137 |
return $this->meta[ $post_id ];
|
138 |
}
|
139 |
+
|
140 |
return $null;
|
141 |
+
|
142 |
}
|
143 |
|
144 |
+
/*
|
145 |
+
* Preload Metadata
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
*/
|
147 |
+
function pre_load_metadata($null, $post_id, $name, $hidden){
|
148 |
+
|
149 |
$name = ($hidden ? '_' : '') . $name;
|
150 |
+
|
151 |
+
if(isset($this->meta[ $post_id ])){
|
152 |
+
|
153 |
+
if(isset($this->meta[ $post_id ][ $name ])){
|
154 |
return $this->meta[ $post_id ][ $name ];
|
155 |
}
|
156 |
return '__return_null';
|
157 |
+
|
158 |
}
|
159 |
+
|
160 |
return $null;
|
161 |
+
|
162 |
}
|
163 |
|
164 |
+
/*
|
165 |
+
* Update Values: Proxy acf_update_values
|
166 |
+
* /advanced-custom-fields-pro/includes/acf-value-functions.php:218
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
*/
|
168 |
+
function update_values($values, $post_id){
|
169 |
+
|
170 |
+
foreach($values as $key => $value){
|
171 |
+
|
172 |
+
$field = acf_get_field($key);
|
173 |
+
|
174 |
+
if($field){
|
175 |
+
$this->update_value($value, $post_id, $field);
|
176 |
+
}
|
177 |
+
|
178 |
}
|
179 |
+
|
180 |
+
}
|
181 |
+
|
182 |
+
/*
|
183 |
+
* Update Value: Proxy acf_update_value
|
184 |
+
* /advanced-custom-fields-pro/includes/acf-value-functions.php:164
|
185 |
+
*/
|
186 |
+
function update_value($value, $post_id, $field){
|
187 |
+
|
188 |
+
// Allow filter to short-circuit update_value logic.
|
189 |
+
$check = apply_filters("acf/pre_update_value", null, $value, $post_id, $field);
|
190 |
+
if($check !== null){
|
191 |
+
return $check;
|
192 |
+
}
|
193 |
+
|
194 |
+
// ACF Extended: Use field type filter only
|
195 |
+
$value = apply_filters("acf/update_value/type={$field['type']}", $value, $post_id, $field, $value);
|
196 |
+
|
197 |
+
// Allow null to delete value.
|
198 |
+
if($value === null){
|
199 |
+
return acf_delete_value($post_id, $field);
|
200 |
+
}
|
201 |
+
|
202 |
+
// Update meta.
|
203 |
+
$return = acf_update_metadata($post_id, $field['name'], $value);
|
204 |
+
|
205 |
+
// Update reference.
|
206 |
+
acf_update_metadata($post_id, $field['name'], $field['key'], true);
|
207 |
+
|
208 |
+
// Delete stored data.
|
209 |
+
acf_flush_value_cache($post_id, $field['name']);
|
210 |
+
|
211 |
+
// Return update status.
|
212 |
+
return $return;
|
213 |
+
|
214 |
}
|
215 |
|
216 |
}
|
217 |
|
218 |
endif;
|
219 |
|
220 |
+
/*
|
221 |
* acfe_setup_meta
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
*/
|
223 |
+
function acfe_setup_meta($meta = array(), $post_id = 0, $is_main = false){
|
224 |
+
return acf_get_instance('ACFE_Local_Meta')->add($meta, $post_id, $is_main);
|
225 |
}
|
226 |
|
227 |
+
/*
|
228 |
* acfe_reset_meta
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
*/
|
230 |
+
function acfe_reset_meta($post_id = null){
|
231 |
+
return acf_get_instance('ACFE_Local_Meta')->remove();
|
232 |
}
|
233 |
+
|
234 |
+
/*
|
235 |
+
* acfe_get_local_post_ids
|
236 |
+
*/
|
237 |
+
function acfe_get_local_post_ids(){
|
238 |
+
|
239 |
+
$post_ids = array();
|
240 |
+
|
241 |
+
// ACF Local Meta
|
242 |
+
$acf_meta = acf_get_instance('ACF_Local_Meta')->meta;
|
243 |
+
$post_ids = array_merge($post_ids, array_keys($acf_meta));
|
244 |
+
|
245 |
+
// ACFE Local Meta
|
246 |
+
$acfe_meta = acf_get_instance('ACFE_Local_Meta')->meta;
|
247 |
+
$post_ids = array_merge($post_ids, array_keys($acfe_meta));
|
248 |
+
|
249 |
+
return array_unique($post_ids);
|
250 |
+
|
251 |
+
}
|
252 |
+
|
253 |
+
/*
|
254 |
+
* acfe_get_local_post_id
|
255 |
+
*/
|
256 |
+
function acfe_get_local_post_id(){
|
257 |
+
|
258 |
+
$post_ids = acfe_get_local_post_ids();
|
259 |
+
|
260 |
+
return end($post_ids);
|
261 |
+
|
262 |
+
}
|
263 |
+
|
264 |
+
/*
|
265 |
+
* acfe_is_local_post_id
|
266 |
+
*/
|
267 |
+
function acfe_is_local_post_id($post_id){
|
268 |
+
|
269 |
+
$local_post_ids = acfe_get_local_post_ids();
|
270 |
+
|
271 |
+
return in_array($post_id, $local_post_ids);
|
272 |
+
|
273 |
+
}
|
274 |
+
|
275 |
+
/*
|
276 |
+
* acfe_is_local_meta
|
277 |
+
*/
|
278 |
+
function acfe_is_local_meta(){
|
279 |
+
|
280 |
+
return !empty(acfe_get_local_post_ids());
|
281 |
+
|
282 |
+
}
|
@@ -283,7 +283,7 @@ class acfe_multilang{
|
|
283 |
function set_options_post_id($post_id, $original_post_id){
|
284 |
|
285 |
// Bail early if original post id is 'options' ||'option'
|
286 |
-
if(!is_string($post_id)
|
287 |
return $post_id;
|
288 |
|
289 |
$data = acf_get_post_id_info($post_id);
|
@@ -291,6 +291,21 @@ class acfe_multilang{
|
|
291 |
// Bail early if post id isn't an option type
|
292 |
if($data['type'] !== 'option')
|
293 |
return $post_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
// Bail early if no Options Page found with that post id
|
296 |
if(!$this->is_options_page($post_id))
|
@@ -362,8 +377,8 @@ class acfe_multilang{
|
|
362 |
|
363 |
// Add 'Post Types List' location
|
364 |
$post_types = acf_get_post_types(array(
|
365 |
-
'show_ui'
|
366 |
-
'exclude'
|
367 |
));
|
368 |
|
369 |
if(!empty($post_types)){
|
@@ -389,7 +404,29 @@ class acfe_multilang{
|
|
389 |
|
390 |
}
|
391 |
|
392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
|
394 |
$this->options_pages = $list;
|
395 |
|
@@ -669,9 +706,9 @@ function acfe__(&$string, $name = false, $textdomain = 'acfe'){
|
|
669 |
// WPML
|
670 |
if(acfe_is_wpml()){
|
671 |
|
672 |
-
do_action(
|
673 |
|
674 |
-
$string =
|
675 |
|
676 |
return $string;
|
677 |
|
283 |
function set_options_post_id($post_id, $original_post_id){
|
284 |
|
285 |
// Bail early if original post id is 'options' ||'option'
|
286 |
+
if(!is_string($post_id))
|
287 |
return $post_id;
|
288 |
|
289 |
$data = acf_get_post_id_info($post_id);
|
291 |
// Bail early if post id isn't an option type
|
292 |
if($data['type'] !== 'option')
|
293 |
return $post_id;
|
294 |
+
|
295 |
+
// Options Exception
|
296 |
+
// $post_id already translated during the native acf/validate_post_id
|
297 |
+
if(in_array($original_post_id, array('options', 'option'))){
|
298 |
+
|
299 |
+
// Exclude filter
|
300 |
+
$exclude = apply_filters('acfe/modules/multilang/exclude_options', array());
|
301 |
+
|
302 |
+
if(in_array('options', $exclude)){
|
303 |
+
return 'options';
|
304 |
+
}
|
305 |
+
|
306 |
+
return $post_id;
|
307 |
+
|
308 |
+
}
|
309 |
|
310 |
// Bail early if no Options Page found with that post id
|
311 |
if(!$this->is_options_page($post_id))
|
377 |
|
378 |
// Add 'Post Types List' location
|
379 |
$post_types = acf_get_post_types(array(
|
380 |
+
'show_ui' => 1,
|
381 |
+
'exclude' => array('attachment')
|
382 |
));
|
383 |
|
384 |
if(!empty($post_types)){
|
404 |
|
405 |
}
|
406 |
|
407 |
+
// Depreacted filter
|
408 |
+
$list = apply_filters_deprecated('acfe/modules/multilang/options', array($list), '0.8.8.2', 'acfe/modules/multilang/exclude_options');
|
409 |
+
|
410 |
+
// Include filter
|
411 |
+
$list = apply_filters('acfe/modules/multilang/include_options', $list);
|
412 |
+
|
413 |
+
// Exclude filter
|
414 |
+
$exclude = apply_filters('acfe/modules/multilang/exclude_options', array());
|
415 |
+
|
416 |
+
if(is_array($exclude) && !empty($exclude)){
|
417 |
+
|
418 |
+
foreach($list as $i => $option){
|
419 |
+
|
420 |
+
if(!in_array($option, $exclude))
|
421 |
+
continue;
|
422 |
+
|
423 |
+
unset($list[$i]);
|
424 |
+
|
425 |
+
}
|
426 |
+
|
427 |
+
$list = array_values($list);
|
428 |
+
|
429 |
+
}
|
430 |
|
431 |
$this->options_pages = $list;
|
432 |
|
706 |
// WPML
|
707 |
if(acfe_is_wpml()){
|
708 |
|
709 |
+
do_action('wpml_register_single_string', $textdomain, $name, $string);
|
710 |
|
711 |
+
$string = apply_filters('wpml_translate_single_string', $string, $textdomain, $name);
|
712 |
|
713 |
return $string;
|
714 |
|
@@ -4,218 +4,218 @@ if(!class_exists('acfe_settings')):
|
|
4 |
|
5 |
class acfe_settings{
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
$this->settings = get_option('acfe', array());
|
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 |
-
|
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 |
|
4 |
|
5 |
class acfe_settings{
|
6 |
|
7 |
+
public $settings = array();
|
8 |
+
|
9 |
+
/*
|
10 |
+
* Construct
|
11 |
+
*/
|
12 |
+
function __construct(){
|
13 |
+
|
14 |
$this->settings = get_option('acfe', array());
|
15 |
|
16 |
+
}
|
17 |
+
|
18 |
+
function get($selector = null, $default = null){
|
19 |
+
|
20 |
+
return $this->array_get($this->settings, $selector, $default);
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
function set($selector = null, $value = null, $append = false){
|
25 |
+
|
26 |
+
if($value === null)
|
27 |
+
return false;
|
28 |
+
|
29 |
+
if($append){
|
30 |
+
|
31 |
+
$this->array_append($this->settings, $selector, $value);
|
32 |
+
|
33 |
+
}else{
|
34 |
+
|
35 |
+
$this->array_set($this->settings, $selector, $value);
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
$this->update();
|
40 |
+
|
41 |
+
return $this;
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
function clear($selector = null){
|
46 |
+
|
47 |
+
$this->array_clear($this->settings, $selector);
|
48 |
+
$this->update();
|
49 |
+
|
50 |
+
return $this;
|
51 |
+
|
52 |
+
}
|
53 |
+
|
54 |
+
function delete($selector = null){
|
55 |
+
|
56 |
+
// Single
|
57 |
+
if(strpos($selector, '.') === false){
|
58 |
+
|
59 |
+
unset($this->settings[$selector]);
|
60 |
+
|
61 |
+
// Array
|
62 |
+
}else{
|
63 |
+
|
64 |
+
$this->array_remove($this->settings, $selector);
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
$this->update();
|
69 |
+
|
70 |
+
return $this;
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
function append($selector = null, $value = null){
|
75 |
+
|
76 |
+
if($selector === null && $value === null)
|
77 |
+
return false;
|
78 |
+
|
79 |
+
// Allow simple append without selector
|
80 |
+
if($value === null){
|
81 |
+
|
82 |
+
$value = $selector;
|
83 |
+
$selector = null;
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
return $this->set($selector, $value, true);
|
88 |
+
|
89 |
+
}
|
90 |
+
|
91 |
+
function array_get($array, $key, $default = null){
|
92 |
+
|
93 |
+
if(empty($key))
|
94 |
+
return $array;
|
95 |
+
|
96 |
+
if(!is_array($key))
|
97 |
+
$key = explode('.', $key);
|
98 |
+
|
99 |
+
$count = count($key);
|
100 |
+
$i=-1;
|
101 |
+
|
102 |
+
foreach($key as $segment){
|
103 |
+
|
104 |
+
$i++;
|
105 |
+
|
106 |
+
if(!isset($array[$segment]))
|
107 |
+
continue;
|
108 |
+
|
109 |
+
if($i+1 === $count){
|
110 |
+
|
111 |
+
return $array[$segment];
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
unset($key[$i]);
|
116 |
+
|
117 |
+
return $this->array_get($array[$segment], $key, $default);
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
return $default;
|
122 |
+
|
123 |
+
}
|
124 |
+
|
125 |
+
function array_set(&$array, $key, $value){
|
126 |
+
|
127 |
+
if(empty($key))
|
128 |
+
return $array = $value;
|
129 |
+
|
130 |
+
$keys = explode('.', $key);
|
131 |
+
|
132 |
+
while(count($keys) > 1){
|
133 |
+
|
134 |
+
$key = array_shift($keys);
|
135 |
+
|
136 |
+
if(!isset($array[$key]) || !is_array($array[$key])){
|
137 |
+
|
138 |
+
$array[$key] = array();
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
$array =& $array[$key];
|
143 |
+
|
144 |
+
}
|
145 |
+
|
146 |
+
$array[array_shift($keys)] = $value;
|
147 |
+
|
148 |
+
return $array;
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
+
function array_append(&$array, $key, $value){
|
153 |
+
|
154 |
+
$get = $this->array_get($array, $key);
|
155 |
+
|
156 |
+
$old = acf_get_array($get);
|
157 |
+
$value = acf_get_array($value);
|
158 |
+
|
159 |
+
$value = array_merge($old, $value);
|
160 |
+
|
161 |
+
$this->array_set($array, $key, $value);
|
162 |
+
|
163 |
+
return $array;
|
164 |
+
|
165 |
+
}
|
166 |
+
|
167 |
+
function array_clear(&$array, $key){
|
168 |
+
|
169 |
+
$get = $this->array_get($array, $key);
|
170 |
+
|
171 |
+
if($get === null)
|
172 |
+
return $array;
|
173 |
+
|
174 |
+
$value = null;
|
175 |
+
|
176 |
+
if(is_array($get))
|
177 |
+
$value = array();
|
178 |
+
|
179 |
+
$this->array_set($array, $key, $value);
|
180 |
+
|
181 |
+
return $array;
|
182 |
+
|
183 |
+
}
|
184 |
+
|
185 |
+
function array_remove(&$array, $keys){
|
186 |
+
|
187 |
+
$original =& $array;
|
188 |
+
|
189 |
+
foreach((array)$keys as $key){
|
190 |
+
|
191 |
+
$parts = explode('.', $key);
|
192 |
+
|
193 |
+
while(count($parts) > 1){
|
194 |
+
|
195 |
+
$part = array_shift($parts);
|
196 |
+
|
197 |
+
if(isset($array[$part]) && is_array($array[$part])){
|
198 |
+
|
199 |
+
$array =& $array[$part];
|
200 |
+
|
201 |
+
}
|
202 |
+
|
203 |
+
}
|
204 |
+
|
205 |
+
unset($array[array_shift($parts)]);
|
206 |
+
|
207 |
+
// clean up after each pass
|
208 |
+
$array =& $original;
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
+
}
|
213 |
+
|
214 |
+
function update(){
|
215 |
+
|
216 |
+
update_option('acfe', $this->settings, 'true');
|
217 |
+
|
218 |
+
}
|
219 |
|
220 |
}
|
221 |
|
@@ -21,7 +21,7 @@ class acfe_upgrades{
|
|
21 |
)
|
22 |
);
|
23 |
|
24 |
-
|
25 |
|
26 |
$db_version = acfe_get_settings('version');
|
27 |
|
@@ -46,7 +46,7 @@ class acfe_upgrades{
|
|
46 |
|
47 |
acfe_update_settings($model);
|
48 |
|
49 |
-
|
50 |
|
51 |
/*
|
52 |
* Reset Modules
|
@@ -60,11 +60,11 @@ class acfe_upgrades{
|
|
60 |
acf_get_instance('acfe_dynamic_taxonomies')->reset();
|
61 |
|
62 |
}
|
63 |
-
|
64 |
/*
|
65 |
* ACF Extended: 0.8.8
|
66 |
*/
|
67 |
-
|
68 |
|
69 |
$tasks = array(
|
70 |
'block_types',
|
@@ -176,540 +176,540 @@ class acfe_upgrades{
|
|
176 |
}
|
177 |
|
178 |
}
|
179 |
-
|
180 |
}
|
181 |
-
|
182 |
/*
|
183 |
* ACF Extended: 0.8.6
|
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 |
acf_log('[ACF Extended] 0.8.6 Upgrade: Options Pages');
|
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 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
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 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
|
496 |
acf_log('[ACF Extended] 0.8.5 Upgrade: Forms');
|
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 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
|
714 |
delete_option('acfe_dynamic_post_types');
|
715 |
|
@@ -717,16 +717,16 @@ class acfe_upgrades{
|
|
717 |
continue;
|
718 |
|
719 |
acf_log('[ACF Extended] 0.8.5 Upgrade: Post Types');
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
|
731 |
$old = get_option('acfe_dynamic_taxonomies', array());
|
732 |
$new = acfe_get_settings('modules.taxonomies', array());
|
@@ -735,18 +735,18 @@ class acfe_upgrades{
|
|
735 |
|
736 |
if(empty($old))
|
737 |
continue;
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
acfe_update_settings('modules.taxonomies', array_merge($old, $new));
|
743 |
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
|
751 |
$old = get_option('acfe_dynamic_block_types', array());
|
752 |
$new = acfe_get_settings('modules.block_types', array());
|
@@ -755,18 +755,18 @@ class acfe_upgrades{
|
|
755 |
|
756 |
if(empty($old))
|
757 |
continue;
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
|
771 |
$old = get_option('acfe_dynamic_options_pages', array());
|
772 |
$new = acfe_get_settings('modules.options_pages', array());
|
@@ -775,17 +775,17 @@ class acfe_upgrades{
|
|
775 |
|
776 |
if(empty($old))
|
777 |
continue;
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
acfe_update_settings('modules.options_pages', array_merge($old, $new));
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
|
790 |
function parse_args_r(&$a, $b){
|
791 |
|
@@ -806,7 +806,7 @@ class acfe_upgrades{
|
|
806 |
return $r;
|
807 |
|
808 |
}
|
809 |
-
|
810 |
}
|
811 |
|
812 |
acf_new_instance('acfe_upgrades');
|
21 |
)
|
22 |
);
|
23 |
|
24 |
+
function __construct(){
|
25 |
|
26 |
$db_version = acfe_get_settings('version');
|
27 |
|
46 |
|
47 |
acfe_update_settings($model);
|
48 |
|
49 |
+
}
|
50 |
|
51 |
/*
|
52 |
* Reset Modules
|
60 |
acf_get_instance('acfe_dynamic_taxonomies')->reset();
|
61 |
|
62 |
}
|
63 |
+
|
64 |
/*
|
65 |
* ACF Extended: 0.8.8
|
66 |
*/
|
67 |
+
function do_0_8_8(){
|
68 |
|
69 |
$tasks = array(
|
70 |
'block_types',
|
176 |
}
|
177 |
|
178 |
}
|
179 |
+
|
180 |
}
|
181 |
+
|
182 |
/*
|
183 |
* ACF Extended: 0.8.6
|
184 |
*/
|
185 |
+
function do_0_8_6(){
|
186 |
+
|
187 |
+
$get_options = get_posts(array(
|
188 |
+
'post_type' => 'acfe-dop',
|
189 |
+
'posts_per_page' => -1,
|
190 |
+
'fields' => 'ids'
|
191 |
+
));
|
192 |
+
|
193 |
+
if(!empty($get_options)){
|
194 |
+
|
195 |
+
$updated = false;
|
196 |
+
|
197 |
+
foreach($get_options as $post_id){
|
198 |
+
|
199 |
+
$menu_slug = get_field('menu_slug', $post_id);
|
200 |
+
$acfe_dop_name = get_field('acfe_dop_name', $post_id);
|
201 |
+
$post_name = get_post_field('post_name', $post_id);
|
202 |
+
|
203 |
+
// Update empty 'menu_slug' fields in options pages
|
204 |
+
if(empty($menu_slug)){
|
205 |
+
|
206 |
+
// Page Title
|
207 |
+
$page_title = get_post_field('post_title', $post_id);
|
208 |
+
|
209 |
+
// Menu Title
|
210 |
+
$menu_title = get_field('menu_title', $post_id);
|
211 |
+
|
212 |
+
if(empty($menu_title)){
|
213 |
+
|
214 |
+
$menu_title = $page_title;
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
// Menu Slug
|
219 |
+
$menu_slug = sanitize_title($menu_title);
|
220 |
+
|
221 |
+
// Update field
|
222 |
+
update_field('menu_slug', $menu_slug, $post_id);
|
223 |
+
|
224 |
+
$updated = true;
|
225 |
+
|
226 |
+
}
|
227 |
+
|
228 |
+
// Upgrade old name to menu_slug
|
229 |
+
if($acfe_dop_name === $post_name){
|
230 |
+
|
231 |
+
// Get ACFE option
|
232 |
+
$option = acfe_get_settings('modules.options_pages', array());
|
233 |
+
|
234 |
+
// Check ACFE option
|
235 |
+
if(isset($option[$acfe_dop_name])){
|
236 |
+
|
237 |
+
$register_args = $option[$acfe_dop_name];
|
238 |
+
|
239 |
+
// Delete old option page slug
|
240 |
+
unset($option[$acfe_dop_name]);
|
241 |
+
|
242 |
+
// Re-assign to menu_slug
|
243 |
+
$option[$menu_slug] = $register_args;
|
244 |
+
|
245 |
+
// Sort keys ASC
|
246 |
+
ksort($option);
|
247 |
+
|
248 |
+
// Update ACFE option
|
249 |
+
acfe_update_settings('modules.options_pages', $option);
|
250 |
+
|
251 |
+
// Update post: force menu slug as name
|
252 |
+
wp_update_post(array(
|
253 |
+
'ID' => $post_id,
|
254 |
+
'post_name' => $menu_slug,
|
255 |
+
));
|
256 |
+
|
257 |
+
$updated = true;
|
258 |
+
|
259 |
+
}
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
}
|
264 |
+
|
265 |
+
if($updated)
|
266 |
acf_log('[ACF Extended] 0.8.6 Upgrade: Options Pages');
|
267 |
+
|
268 |
+
}
|
269 |
+
|
270 |
+
}
|
271 |
+
|
272 |
+
/*
|
273 |
+
* ACF Extended: 0.8.5
|
274 |
+
*/
|
275 |
+
function do_0_8_5(){
|
276 |
+
|
277 |
+
$tasks = array(
|
278 |
+
'forms',
|
279 |
+
'post_types',
|
280 |
+
'taxonomies',
|
281 |
+
'block_types',
|
282 |
+
'options_pages',
|
283 |
+
);
|
284 |
+
|
285 |
+
foreach($tasks as $task){
|
286 |
+
|
287 |
+
/*
|
288 |
+
* Forms
|
289 |
+
*/
|
290 |
+
if($task === 'forms'){
|
291 |
+
|
292 |
+
// Retrieve all forms posts
|
293 |
+
$get_forms = get_posts(array(
|
294 |
+
'post_type' => 'acfe-form',
|
295 |
+
'posts_per_page' => -1,
|
296 |
+
'fields' => 'ids',
|
297 |
+
'post_status' => 'any'
|
298 |
+
));
|
299 |
+
|
300 |
+
// Bail early if no form found
|
301 |
+
if(empty($get_forms))
|
302 |
+
continue;
|
303 |
+
|
304 |
+
$flexible = acf_get_field_type('flexible_content');
|
305 |
+
$field = acf_get_field('acfe_form_actions');
|
306 |
+
|
307 |
+
global $wpdb;
|
308 |
+
|
309 |
+
foreach($get_forms as $post_id){
|
310 |
+
|
311 |
+
// init
|
312 |
+
$wp_meta = array();
|
313 |
+
$acf_meta = array();
|
314 |
+
|
315 |
+
// Retrieve meta
|
316 |
+
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d ", $post_id));
|
317 |
+
|
318 |
+
// Sort
|
319 |
+
usort($get_meta, function($a, $b){
|
320 |
+
return strcmp($a->meta_key, $b->meta_key);
|
321 |
+
});
|
322 |
+
|
323 |
+
// Store
|
324 |
+
foreach($get_meta as $meta){
|
325 |
+
|
326 |
+
$wp_meta[$meta->meta_key] = $meta->meta_value;
|
327 |
+
|
328 |
+
}
|
329 |
+
|
330 |
+
// Check if is acf meta
|
331 |
+
foreach($wp_meta as $key => $value){
|
332 |
+
|
333 |
+
// ACF Meta
|
334 |
+
if(isset($wp_meta["_$key"])){
|
335 |
+
|
336 |
+
$acf_meta[] = array(
|
337 |
+
'key' => $key,
|
338 |
+
'value' => $wp_meta[$key],
|
339 |
+
);
|
340 |
+
|
341 |
+
}
|
342 |
+
|
343 |
+
}
|
344 |
+
|
345 |
+
/*
|
346 |
+
* Step 1: Upgrade old group fields
|
347 |
+
*/
|
348 |
+
$prefix = 'acfe_form_actions';
|
349 |
+
|
350 |
+
// Define script rules
|
351 |
+
$rules = array(
|
352 |
+
|
353 |
+
// Post: title
|
354 |
+
array(
|
355 |
+
'group' => 'acfe_form_post_save_post_title_group',
|
356 |
+
'sub_field' => 'acfe_form_post_save_post_title_group_acfe_form_post_save_post_title',
|
357 |
+
'sub_field_custom' => 'acfe_form_post_save_post_title_group_acfe_form_post_save_post_title_custom',
|
358 |
+
'new_field' => 'acfe_form_post_save_post_title',
|
359 |
+
),
|
360 |
+
|
361 |
+
// Post: name
|
362 |
+
array(
|
363 |
+
'group' => 'acfe_form_post_save_post_name_group',
|
364 |
+
'sub_field' => 'acfe_form_post_save_post_name_group_acfe_form_post_save_post_name',
|
365 |
+
'sub_field_custom' => 'acfe_form_post_save_post_name_group_acfe_form_post_save_post_name_custom',
|
366 |
+
'new_field' => 'acfe_form_post_save_post_name',
|
367 |
+
),
|
368 |
+
|
369 |
+
// Term: name
|
370 |
+
array(
|
371 |
+
'group' => 'acfe_form_term_save_name_group',
|
372 |
+
'sub_field' => 'acfe_form_term_save_name_group_acfe_form_term_save_name',
|
373 |
+
'sub_field_custom' => 'acfe_form_term_save_name_group_acfe_form_term_save_name_custom',
|
374 |
+
'new_field' => 'acfe_form_term_save_name',
|
375 |
+
),
|
376 |
+
|
377 |
+
// Term: slug
|
378 |
+
array(
|
379 |
+
'group' => 'acfe_form_term_save_slug_group',
|
380 |
+
'sub_field' => 'acfe_form_term_save_slug_group_acfe_form_term_save_slug',
|
381 |
+
'sub_field_custom' => 'acfe_form_term_save_slug_group_acfe_form_term_save_slug_custom',
|
382 |
+
'new_field' => 'acfe_form_term_save_slug',
|
383 |
+
),
|
384 |
+
|
385 |
+
// User: e-mail
|
386 |
+
array(
|
387 |
+
'group' => 'acfe_form_user_save_email_group',
|
388 |
+
'sub_field' => 'acfe_form_user_save_email_group_acfe_form_user_save_email',
|
389 |
+
'sub_field_custom' => 'acfe_form_user_save_email_group_acfe_form_user_save_email_custom',
|
390 |
+
'new_field' => 'acfe_form_user_save_email',
|
391 |
+
),
|
392 |
+
|
393 |
+
// User: username
|
394 |
+
array(
|
395 |
+
'group' => 'acfe_form_user_save_username_group',
|
396 |
+
'sub_field' => 'acfe_form_user_save_username_group_acfe_form_user_save_username',
|
397 |
+
'sub_field_custom' => 'acfe_form_user_save_username_group_acfe_form_user_save_username_custom',
|
398 |
+
'new_field' => 'acfe_form_user_save_username',
|
399 |
+
),
|
400 |
+
|
401 |
+
// User: password
|
402 |
+
array(
|
403 |
+
'group' => 'acfe_form_user_save_password_group',
|
404 |
+
'sub_field' => 'acfe_form_user_save_password_group_acfe_form_user_save_password',
|
405 |
+
'sub_field_custom' => 'acfe_form_user_save_password_group_acfe_form_user_save_password_custom',
|
406 |
+
'new_field' => 'acfe_form_user_save_password',
|
407 |
+
),
|
408 |
+
|
409 |
+
// User: first name
|
410 |
+
array(
|
411 |
+
'group' => 'acfe_form_user_save_first_name_group',
|
412 |
+
'sub_field' => 'acfe_form_user_save_first_name_group_acfe_form_user_save_first_name',
|
413 |
+
'sub_field_custom' => 'acfe_form_user_save_first_name_group_acfe_form_user_save_first_name_custom',
|
414 |
+
'new_field' => 'acfe_form_user_save_first_name',
|
415 |
+
),
|
416 |
+
|
417 |
+
// User: last name
|
418 |
+
array(
|
419 |
+
'group' => 'acfe_form_user_save_last_name_group',
|
420 |
+
'sub_field' => 'acfe_form_user_save_last_name_group_acfe_form_user_save_last_name',
|
421 |
+
'sub_field_custom' => 'acfe_form_user_save_last_name_group_acfe_form_user_save_last_name_custom',
|
422 |
+
'new_field' => 'acfe_form_user_save_last_name',
|
423 |
+
),
|
424 |
+
|
425 |
+
// User: nickname
|
426 |
+
array(
|
427 |
+
'group' => 'acfe_form_user_save_nickname_group',
|
428 |
+
'sub_field' => 'acfe_form_user_save_nickname_group_acfe_form_user_save_nickname',
|
429 |
+
'sub_field_custom' => 'acfe_form_user_save_nickname_group_acfe_form_user_save_nickname_custom',
|
430 |
+
'new_field' => 'acfe_form_user_save_nickname',
|
431 |
+
),
|
432 |
+
|
433 |
+
// User: display name
|
434 |
+
array(
|
435 |
+
'group' => 'acfe_form_user_save_display_name_group',
|
436 |
+
'sub_field' => 'acfe_form_user_save_display_name_group_acfe_form_user_save_display_name',
|
437 |
+
'sub_field_custom' => 'acfe_form_user_save_display_name_group_acfe_form_user_save_display_name_custom',
|
438 |
+
'new_field' => 'acfe_form_user_save_display_name',
|
439 |
+
),
|
440 |
+
|
441 |
+
// User: website
|
442 |
+
array(
|
443 |
+
'group' => 'acfe_form_user_save_website_group',
|
444 |
+
'sub_field' => 'acfe_form_user_save_website_group_acfe_form_user_save_website',
|
445 |
+
'sub_field_custom' => 'acfe_form_user_save_website_group_acfe_form_user_save_website_custom',
|
446 |
+
'new_field' => 'acfe_form_user_save_website',
|
447 |
+
),
|
448 |
+
|
449 |
+
);
|
450 |
+
|
451 |
+
// Process rules
|
452 |
+
foreach($rules as $rule){
|
453 |
+
|
454 |
+
$updates = array();
|
455 |
+
|
456 |
+
foreach($acf_meta as $acf){
|
457 |
+
|
458 |
+
// Bail early if doesn't starts with 'acfe_form_actions'
|
459 |
+
if(strpos($acf['key'], $prefix) !== 0)
|
460 |
+
continue;
|
461 |
+
|
462 |
+
// Regex: 'acfe_form_actions_2_acfe_form_post_save_post_title_group'
|
463 |
+
// Match: '2'
|
464 |
+
if(preg_match('/^' . $prefix . '_([0-9]+)_' . $rule['group'] . '$/', $acf['key'], $match)){
|
465 |
+
|
466 |
+
$updates[$rule['new_field']][$match[1]]['group'] = array(
|
467 |
+
'key' => $acf['key'],
|
468 |
+
'value' => $acf['value'],
|
469 |
+
);
|
470 |
+
|
471 |
+
// Regex: 'acfe_form_post_2_save_post_title_group_acfe_form_post_save_post_title'
|
472 |
+
// Match: '2'
|
473 |
+
}elseif(preg_match('/^' . $prefix . '_([0-9]+)_' . $rule['sub_field'] . '$/', $acf['key'], $match)){
|
474 |
+
|
475 |
+
$updates[$rule['new_field']][$match[1]]['sub_field'] = array(
|
476 |
+
'key' => $acf['key'],
|
477 |
+
'value' => $acf['value'],
|
478 |
+
);
|
479 |
+
|
480 |
+
// Regex: 'acfe_form_post_2_save_post_title_group_acfe_form_post_save_post_title_custom'
|
481 |
+
// Match: '2'
|
482 |
+
}elseif(preg_match('/^' . $prefix . '_([0-9]+)_' . $rule['sub_field_custom'] . '$/', $acf['key'], $match)){
|
483 |
+
|
484 |
+
// Generate: array[acfe_form_post_save_post_title][2]['sub_field_custom']
|
485 |
+
$updates[$rule['new_field']][$match[1]]['sub_field_custom'] = array(
|
486 |
+
'key' => $acf['key'],
|
487 |
+
'value' => $acf['value'],
|
488 |
+
);
|
489 |
+
|
490 |
+
}
|
491 |
+
|
492 |
+
}
|
493 |
+
|
494 |
+
if(!empty($updates)){
|
495 |
|
496 |
acf_log('[ACF Extended] 0.8.5 Upgrade: Forms');
|
497 |
+
|
498 |
+
// Update meta
|
499 |
+
foreach($updates as $new_field => $data){
|
500 |
+
|
501 |
+
foreach($data as $i => $row){
|
502 |
+
|
503 |
+
$group = acf_maybe_get($row, 'group');
|
504 |
+
$sub_field = acf_maybe_get($row, 'sub_field');
|
505 |
+
$sub_field_custom = acf_maybe_get($row, 'sub_field_custom');
|
506 |
+
|
507 |
+
if($sub_field){
|
508 |
+
|
509 |
+
$new_field_name = "{$prefix}_{$i}_{$new_field}";
|
510 |
+
|
511 |
+
// update field
|
512 |
+
if($sub_field['value'] === 'custom'){
|
513 |
+
|
514 |
+
update_post_meta($post_id, $new_field_name, $sub_field_custom['value']);
|
515 |
+
|
516 |
+
}else{
|
517 |
+
|
518 |
+
update_post_meta($post_id, $new_field_name, $sub_field['value']);
|
519 |
+
|
520 |
+
}
|
521 |
+
|
522 |
+
// update reference
|
523 |
+
update_post_meta($post_id, '_' . $new_field_name, 'field_' . $new_field);
|
524 |
+
|
525 |
+
}
|
526 |
+
|
527 |
+
// Delete old group
|
528 |
+
delete_post_meta($post_id, $group['key']);
|
529 |
+
delete_post_meta($post_id, $sub_field['key']);
|
530 |
+
delete_post_meta($post_id, $sub_field_custom['key']);
|
531 |
+
|
532 |
+
}
|
533 |
+
|
534 |
+
}
|
535 |
+
|
536 |
+
}
|
537 |
+
|
538 |
+
}
|
539 |
+
|
540 |
+
/*
|
541 |
+
* Step 2: Upgrade map fields which now require "Load values" to be enabled
|
542 |
+
*/
|
543 |
+
if(have_rows('acfe_form_actions', $post_id)):
|
544 |
+
while(have_rows('acfe_form_actions', $post_id)): the_row();
|
545 |
+
|
546 |
+
$layout = get_row_layout();
|
547 |
+
$row = get_row_index();
|
548 |
+
$i = $row-1;
|
549 |
+
|
550 |
+
// Post Action
|
551 |
+
if($layout === 'post'){
|
552 |
+
|
553 |
+
$load_values = get_sub_field('acfe_form_post_load_values');
|
554 |
+
|
555 |
+
$fields = array(
|
556 |
+
'field_acfe_form_post_save_post_type' => get_sub_field('acfe_form_post_map_post_type', false),
|
557 |
+
'field_acfe_form_post_save_post_status' => get_sub_field('acfe_form_post_map_post_status', false),
|
558 |
+
'field_acfe_form_post_save_post_title' => get_sub_field('acfe_form_post_map_post_title', false),
|
559 |
+
'field_acfe_form_post_save_post_name' => get_sub_field('acfe_form_post_map_post_name', false),
|
560 |
+
'field_acfe_form_post_save_post_content' => get_sub_field('acfe_form_post_map_post_content', false),
|
561 |
+
'field_acfe_form_post_save_post_author' => get_sub_field('acfe_form_post_map_post_author', false),
|
562 |
+
'field_acfe_form_post_save_post_parent' => get_sub_field('acfe_form_post_map_post_parent', false),
|
563 |
+
'field_acfe_form_post_save_post_terms' => get_sub_field('acfe_form_post_map_post_terms', false),
|
564 |
+
);
|
565 |
+
|
566 |
+
if(!$load_values){
|
567 |
+
|
568 |
+
foreach($fields as $field_key => $field_value){
|
569 |
+
|
570 |
+
// Bail early if map field has no value
|
571 |
+
if(empty($field_value))
|
572 |
+
continue;
|
573 |
+
|
574 |
+
// args
|
575 |
+
$update = array();
|
576 |
+
$update['acf_fc_layout'] = $layout;
|
577 |
+
|
578 |
+
// Post content inside group
|
579 |
+
if($field_key === 'field_acfe_form_post_save_post_content'){
|
580 |
+
|
581 |
+
$update['field_acfe_form_post_save_post_content_group'] = array(
|
582 |
+
'field_acfe_form_post_save_post_content' => $field_value
|
583 |
+
);
|
584 |
+
|
585 |
+
}else{
|
586 |
+
|
587 |
+
$update[$field_key] = $field_value;
|
588 |
+
|
589 |
+
}
|
590 |
+
|
591 |
+
// update
|
592 |
+
$flexible->update_row($update, $i, $field, $post_id);
|
593 |
+
|
594 |
+
}
|
595 |
+
|
596 |
+
}
|
597 |
+
|
598 |
+
}
|
599 |
+
|
600 |
+
// Term Action
|
601 |
+
elseif($layout === 'term'){
|
602 |
+
|
603 |
+
$load_values = get_sub_field('acfe_form_term_load_values');
|
604 |
+
|
605 |
+
$fields = array(
|
606 |
+
'field_acfe_form_term_save_name' => get_sub_field('acfe_form_term_map_name', false),
|
607 |
+
'field_acfe_form_term_save_slug' => get_sub_field('acfe_form_term_map_slug', false),
|
608 |
+
'field_acfe_form_term_save_taxonomy' => get_sub_field('acfe_form_term_map_taxonomy', false),
|
609 |
+
'field_acfe_form_term_save_parent' => get_sub_field('acfe_form_term_map_parent', false),
|
610 |
+
'field_acfe_form_term_save_description' => get_sub_field('acfe_form_term_map_description', false),
|
611 |
+
);
|
612 |
+
|
613 |
+
if(!$load_values){
|
614 |
+
|
615 |
+
foreach($fields as $field_key => $field_value){
|
616 |
+
|
617 |
+
// Bail early if map field has no value
|
618 |
+
if(empty($field_value))
|
619 |
+
continue;
|
620 |
+
|
621 |
+
// args
|
622 |
+
$update = array();
|
623 |
+
$update['acf_fc_layout'] = $layout;
|
624 |
+
|
625 |
+
// Post content inside group
|
626 |
+
if($field_key === 'field_acfe_form_term_save_description'){
|
627 |
+
|
628 |
+
$update['field_acfe_form_term_save_description_group'] = array(
|
629 |
+
'field_acfe_form_term_save_description' => $field_value
|
630 |
+
);
|
631 |
+
|
632 |
+
}else{
|
633 |
+
|
634 |
+
$update[$field_key] = $field_value;
|
635 |
+
|
636 |
+
}
|
637 |
+
|
638 |
+
// update
|
639 |
+
$flexible->update_row($update, $i, $field, $post_id);
|
640 |
+
|
641 |
+
}
|
642 |
+
|
643 |
+
}
|
644 |
+
|
645 |
+
}
|
646 |
+
|
647 |
+
// User Action
|
648 |
+
elseif($layout === 'user'){
|
649 |
+
|
650 |
+
$load_values = get_sub_field('acfe_form_user_load_values');
|
651 |
+
|
652 |
+
$fields = array(
|
653 |
+
'field_acfe_form_user_save_email' => get_sub_field('acfe_form_user_map_email', false),
|
654 |
+
'field_acfe_form_user_save_username' => get_sub_field('acfe_form_user_map_username', false),
|
655 |
+
'field_acfe_form_user_save_password' => get_sub_field('acfe_form_user_map_password', false),
|
656 |
+
'field_acfe_form_user_save_first_name' => get_sub_field('acfe_form_user_map_first_name', false),
|
657 |
+
'field_acfe_form_user_save_last_name' => get_sub_field('acfe_form_user_map_last_name', false),
|
658 |
+
'field_acfe_form_user_save_nickname' => get_sub_field('acfe_form_user_map_nickname', false),
|
659 |
+
'field_acfe_form_user_save_display_name' => get_sub_field('acfe_form_user_map_display_name', false),
|
660 |
+
'field_acfe_form_user_save_website' => get_sub_field('acfe_form_user_map_website', false),
|
661 |
+
'field_acfe_form_user_save_description' => get_sub_field('acfe_form_user_map_description', false),
|
662 |
+
'field_acfe_form_user_save_role' => get_sub_field('acfe_form_user_map_role', false),
|
663 |
+
);
|
664 |
+
|
665 |
+
if(!$load_values){
|
666 |
+
|
667 |
+
foreach($fields as $field_key => $field_value){
|
668 |
+
|
669 |
+
// Bail early if map field has no value
|
670 |
+
if(empty($field_value))
|
671 |
+
continue;
|
672 |
+
|
673 |
+
// args
|
674 |
+
$update = array();
|
675 |
+
$update['acf_fc_layout'] = $layout;
|
676 |
+
|
677 |
+
// Post content inside group
|
678 |
+
if($field_key === 'field_acfe_form_user_save_description'){
|
679 |
+
|
680 |
+
$update['field_acfe_form_user_save_description_group'] = array(
|
681 |
+
'field_acfe_form_user_save_description' => $field_value
|
682 |
+
);
|
683 |
+
|
684 |
+
}else{
|
685 |
+
|
686 |
+
$update[$field_key] = $field_value;
|
687 |
+
|
688 |
+
}
|
689 |
+
|
690 |
+
// update
|
691 |
+
$flexible->update_row($update, $i, $field, $post_id);
|
692 |
+
|
693 |
+
}
|
694 |
+
|
695 |
+
}
|
696 |
+
|
697 |
+
}
|
698 |
+
|
699 |
+
endwhile;
|
700 |
+
endif;
|
701 |
+
|
702 |
+
}
|
703 |
+
|
704 |
+
}
|
705 |
+
|
706 |
+
/*
|
707 |
+
* Post Types
|
708 |
+
*/
|
709 |
+
elseif($task === 'post_types'){
|
710 |
+
|
711 |
+
$old = get_option('acfe_dynamic_post_types', array());
|
712 |
+
$new = acfe_get_settings('modules.post_types', array());
|
713 |
|
714 |
delete_option('acfe_dynamic_post_types');
|
715 |
|
717 |
continue;
|
718 |
|
719 |
acf_log('[ACF Extended] 0.8.5 Upgrade: Post Types');
|
720 |
+
|
721 |
+
// Update
|
722 |
+
acfe_update_settings('modules.post_types', array_merge($old, $new));
|
723 |
+
|
724 |
+
}
|
725 |
+
|
726 |
+
/*
|
727 |
+
* Taxonomies
|
728 |
+
*/
|
729 |
+
elseif($task === 'taxonomies'){
|
730 |
|
731 |
$old = get_option('acfe_dynamic_taxonomies', array());
|
732 |
$new = acfe_get_settings('modules.taxonomies', array());
|
735 |
|
736 |
if(empty($old))
|
737 |
continue;
|
738 |
+
|
739 |
+
acf_log('[ACF Extended] 0.8.5 Upgrade: Taxonomies');
|
740 |
+
|
741 |
+
// Update
|
742 |
acfe_update_settings('modules.taxonomies', array_merge($old, $new));
|
743 |
|
744 |
+
}
|
745 |
+
|
746 |
+
/*
|
747 |
+
* Block Types
|
748 |
+
*/
|
749 |
+
elseif($task === 'block_types'){
|
750 |
|
751 |
$old = get_option('acfe_dynamic_block_types', array());
|
752 |
$new = acfe_get_settings('modules.block_types', array());
|
755 |
|
756 |
if(empty($old))
|
757 |
continue;
|
758 |
+
|
759 |
+
acf_log('[ACF Extended] 0.8.5 Upgrade: Block Types');
|
760 |
+
|
761 |
+
// Update
|
762 |
+
acfe_update_settings('modules.block_types', array_merge($old, $new));
|
763 |
+
|
764 |
+
}
|
765 |
+
|
766 |
+
/*
|
767 |
+
* Option Pages
|
768 |
+
*/
|
769 |
+
elseif($task === 'options_pages'){
|
770 |
|
771 |
$old = get_option('acfe_dynamic_options_pages', array());
|
772 |
$new = acfe_get_settings('modules.options_pages', array());
|
775 |
|
776 |
if(empty($old))
|
777 |
continue;
|
778 |
+
|
779 |
+
acf_log('[ACF Extended] 0.8.5 Upgrade: Options Pages');
|
780 |
+
|
781 |
+
// Update
|
782 |
acfe_update_settings('modules.options_pages', array_merge($old, $new));
|
783 |
+
|
784 |
+
}
|
785 |
+
|
786 |
+
}
|
787 |
+
|
788 |
+
}
|
789 |
|
790 |
function parse_args_r(&$a, $b){
|
791 |
|
806 |
return $r;
|
807 |
|
808 |
}
|
809 |
+
|
810 |
}
|
811 |
|
812 |
acf_new_instance('acfe_upgrades');
|
@@ -19,8 +19,8 @@ class acfe_field_group_advanced{
|
|
19 |
}
|
20 |
|
21 |
/*
|
22 |
-
|
23 |
-
|
24 |
function admin_head(){
|
25 |
|
26 |
global $field_group;
|
@@ -42,9 +42,9 @@ class acfe_field_group_advanced{
|
|
42 |
'label' => __('Advanced settings'),
|
43 |
'name' => 'acfe_form',
|
44 |
'prefix' => 'acf_field_group',
|
45 |
-
'type'
|
46 |
-
'ui'
|
47 |
-
'instructions'
|
48 |
'value' => (isset($field_group['acfe_form'])) ? $field_group['acfe_form'] : '',
|
49 |
'required' => false,
|
50 |
'wrapper' => array(
|
19 |
}
|
20 |
|
21 |
/*
|
22 |
+
* Admin Head
|
23 |
+
*/
|
24 |
function admin_head(){
|
25 |
|
26 |
global $field_group;
|
42 |
'label' => __('Advanced settings'),
|
43 |
'name' => 'acfe_form',
|
44 |
'prefix' => 'acf_field_group',
|
45 |
+
'type' => 'true_false',
|
46 |
+
'ui' => 1,
|
47 |
+
'instructions' => __('Enable advanced fields settings & validation'),
|
48 |
'value' => (isset($field_group['acfe_form'])) ? $field_group['acfe_form'] : '',
|
49 |
'required' => false,
|
50 |
'wrapper' => array(
|
@@ -7,16 +7,16 @@ if(!class_exists('acfe_field_group_display_title')):
|
|
7 |
|
8 |
class acfe_field_group_display_title{
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
add_filter('acfe/prepare_field_group', array($this, 'prepare_field_group'));
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
20 |
|
21 |
if(!acf_maybe_get($field_group, 'acfe_display_title'))
|
22 |
return $field_group;
|
@@ -24,7 +24,7 @@ class acfe_field_group_display_title{
|
|
24 |
$field_group['title'] = $field_group['acfe_display_title'];
|
25 |
|
26 |
return $field_group;
|
27 |
-
|
28 |
}
|
29 |
|
30 |
}
|
7 |
|
8 |
class acfe_field_group_display_title{
|
9 |
|
10 |
+
function __construct(){
|
|
|
|
|
11 |
|
12 |
+
add_filter('acfe/prepare_field_group', array($this, 'prepare_field_group'));
|
13 |
+
|
14 |
+
}
|
15 |
+
|
16 |
+
/*
|
17 |
+
* Prepare Field Group
|
18 |
+
*/
|
19 |
+
function prepare_field_group($field_group){
|
20 |
|
21 |
if(!acf_maybe_get($field_group, 'acfe_display_title'))
|
22 |
return $field_group;
|
24 |
$field_group['title'] = $field_group['acfe_display_title'];
|
25 |
|
26 |
return $field_group;
|
27 |
+
|
28 |
}
|
29 |
|
30 |
}
|
@@ -7,9 +7,9 @@ if(!class_exists('acfe_field_group_hide_on_screen')):
|
|
7 |
|
8 |
class acfe_field_group_hide_on_screen{
|
9 |
|
10 |
-
|
11 |
|
12 |
-
|
13 |
add_action('acf/field_group/admin_head', array($this, 'admin_head'));
|
14 |
|
15 |
// Post Metaboxes
|
@@ -19,12 +19,12 @@ class acfe_field_group_hide_on_screen{
|
|
19 |
add_action('load-post.php', array($this, 'hide_block_editor'));
|
20 |
add_action('load-post-new.php', array($this, 'hide_block_editor'));
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
|
26 |
add_filter('acf/prepare_field/name=hide_on_screen', array($this, 'prepare_hide_on_screen'));
|
27 |
-
|
28 |
}
|
29 |
|
30 |
/*
|
@@ -50,7 +50,7 @@ class acfe_field_group_hide_on_screen{
|
|
50 |
$field['choices'] = $choices;
|
51 |
|
52 |
return $field;
|
53 |
-
|
54 |
}
|
55 |
|
56 |
/*
|
@@ -58,19 +58,19 @@ class acfe_field_group_hide_on_screen{
|
|
58 |
* Fix ACF only which only use the first Field Group style
|
59 |
*/
|
60 |
function acf_add_meta_boxes($post_type, $post, $field_groups){
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
|
68 |
$styles .= acf_get_field_group_style($field_group);
|
69 |
-
|
70 |
}
|
71 |
|
72 |
$instance->style = $styles;
|
73 |
-
|
74 |
}
|
75 |
|
76 |
/*
|
@@ -101,8 +101,8 @@ class acfe_field_group_hide_on_screen{
|
|
101 |
}
|
102 |
|
103 |
$field_groups = acf_get_field_groups(array(
|
104 |
-
'post_id'
|
105 |
-
'post_type'
|
106 |
));
|
107 |
|
108 |
$hide_block_editor = false;
|
7 |
|
8 |
class acfe_field_group_hide_on_screen{
|
9 |
|
10 |
+
function __construct(){
|
11 |
|
12 |
+
// Field Group
|
13 |
add_action('acf/field_group/admin_head', array($this, 'admin_head'));
|
14 |
|
15 |
// Post Metaboxes
|
19 |
add_action('load-post.php', array($this, 'hide_block_editor'));
|
20 |
add_action('load-post-new.php', array($this, 'hide_block_editor'));
|
21 |
|
22 |
+
}
|
23 |
+
|
24 |
+
function admin_head(){
|
25 |
|
26 |
add_filter('acf/prepare_field/name=hide_on_screen', array($this, 'prepare_hide_on_screen'));
|
27 |
+
|
28 |
}
|
29 |
|
30 |
/*
|
50 |
$field['choices'] = $choices;
|
51 |
|
52 |
return $field;
|
53 |
+
|
54 |
}
|
55 |
|
56 |
/*
|
58 |
* Fix ACF only which only use the first Field Group style
|
59 |
*/
|
60 |
function acf_add_meta_boxes($post_type, $post, $field_groups){
|
61 |
+
|
62 |
+
$instance = acf_get_instance('ACF_Form_Post');
|
63 |
+
|
64 |
+
$styles = '';
|
65 |
+
|
66 |
+
foreach($field_groups as $field_group){
|
67 |
|
68 |
$styles .= acf_get_field_group_style($field_group);
|
69 |
+
|
70 |
}
|
71 |
|
72 |
$instance->style = $styles;
|
73 |
+
|
74 |
}
|
75 |
|
76 |
/*
|
101 |
}
|
102 |
|
103 |
$field_groups = acf_get_field_groups(array(
|
104 |
+
'post_id' => $post_id,
|
105 |
+
'post_type' => $post_type
|
106 |
));
|
107 |
|
108 |
$hide_block_editor = false;
|
@@ -11,12 +11,12 @@ if(!class_exists('acfe_field_group_meta')):
|
|
11 |
|
12 |
class acfe_field_group_meta{
|
13 |
|
14 |
-
|
15 |
|
16 |
add_action('acf/field_group/admin_head', array($this, 'admin_head'));
|
17 |
add_action('acf/field_group/admin_head', array($this, 'prepare_meta'));
|
18 |
|
19 |
-
|
20 |
|
21 |
/**
|
22 |
* Admin Head
|
@@ -95,7 +95,7 @@ class acfe_field_group_meta{
|
|
95 |
'name' => 'acfe_note',
|
96 |
'prefix' => 'acf_field_group',
|
97 |
'type' => 'textarea',
|
98 |
-
'instructions'
|
99 |
'value' => (isset($field_group['acfe_note'])) ? $field_group['acfe_note'] : '',
|
100 |
'required' => false,
|
101 |
'wrapper' => array(
|
11 |
|
12 |
class acfe_field_group_meta{
|
13 |
|
14 |
+
function __construct(){
|
15 |
|
16 |
add_action('acf/field_group/admin_head', array($this, 'admin_head'));
|
17 |
add_action('acf/field_group/admin_head', array($this, 'prepare_meta'));
|
18 |
|
19 |
+
}
|
20 |
|
21 |
/**
|
22 |
* Admin Head
|
95 |
'name' => 'acfe_note',
|
96 |
'prefix' => 'acf_field_group',
|
97 |
'type' => 'textarea',
|
98 |
+
'instructions' => __('Add personal note. Only visible to administrators'),
|
99 |
'value' => (isset($field_group['acfe_note'])) ? $field_group['acfe_note'] : '',
|
100 |
'required' => false,
|
101 |
'wrapper' => array(
|
@@ -7,16 +7,16 @@ if(!class_exists('acfe_field_group_permissions')):
|
|
7 |
|
8 |
class acfe_field_group_permissions{
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
add_filter('acfe/prepare_field_group', array($this, 'prepare_field_group'));
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
20 |
|
21 |
if(!acf_maybe_get($field_group, 'acfe_permissions'))
|
22 |
return $field_group;
|
@@ -45,7 +45,7 @@ class acfe_field_group_permissions{
|
|
45 |
$field_group = false;
|
46 |
|
47 |
return $field_group;
|
48 |
-
|
49 |
}
|
50 |
|
51 |
}
|
7 |
|
8 |
class acfe_field_group_permissions{
|
9 |
|
10 |
+
function __construct(){
|
|
|
|
|
11 |
|
12 |
+
add_filter('acfe/prepare_field_group', array($this, 'prepare_field_group'));
|
13 |
+
|
14 |
+
}
|
15 |
+
|
16 |
+
/*
|
17 |
+
* Prepare Field Group
|
18 |
+
*/
|
19 |
+
function prepare_field_group($field_group){
|
20 |
|
21 |
if(!acf_maybe_get($field_group, 'acfe_permissions'))
|
22 |
return $field_group;
|
45 |
$field_group = false;
|
46 |
|
47 |
return $field_group;
|
48 |
+
|
49 |
}
|
50 |
|
51 |
}
|
@@ -268,7 +268,7 @@ class ACFE_Field_Group{
|
|
268 |
'name' => 'acfe_permissions',
|
269 |
'prefix' => 'acf_field_group',
|
270 |
'type' => 'checkbox',
|
271 |
-
'instructions'
|
272 |
'required' => false,
|
273 |
'default_value' => false,
|
274 |
'choices' => acfe_get_roles(),
|
@@ -358,8 +358,8 @@ class ACFE_Field_Group{
|
|
358 |
method: 'POST',
|
359 |
dataType: 'json',
|
360 |
data: acf.prepareForAjax({
|
361 |
-
action:
|
362 |
-
id:
|
363 |
})
|
364 |
})
|
365 |
.done(function( data, textStatus, jqXHR ) {
|
268 |
'name' => 'acfe_permissions',
|
269 |
'prefix' => 'acf_field_group',
|
270 |
'type' => 'checkbox',
|
271 |
+
'instructions' => __('Select user roles that are allowed to view and edit this field group in post edition'),
|
272 |
'required' => false,
|
273 |
'default_value' => false,
|
274 |
'choices' => acfe_get_roles(),
|
358 |
method: 'POST',
|
359 |
dataType: 'json',
|
360 |
data: acf.prepareForAjax({
|
361 |
+
action: 'acf/ajax/local_json_diff',
|
362 |
+
id: props.id
|
363 |
})
|
364 |
})
|
365 |
.done(function( data, textStatus, jqXHR ) {
|
@@ -21,8 +21,8 @@ class acfe_bidirectional{
|
|
21 |
|
22 |
}
|
23 |
|
24 |
-
add_action('wp_ajax_acfe/fields_settings/bidirectional/query',
|
25 |
-
add_action('wp_ajax_nopriv_acfe/fields_settings/bidirectional/query',
|
26 |
|
27 |
add_filter('acf/prepare_field/name=acfe_bidirectional_related', array($this, 'field_settings_default_value'));
|
28 |
|
@@ -141,12 +141,14 @@ class acfe_bidirectional{
|
|
141 |
if(empty($r_field_groups))
|
142 |
return false;
|
143 |
|
|
|
|
|
144 |
$choices = array();
|
145 |
-
|
146 |
foreach($r_field_groups as $r_field_group){
|
147 |
|
148 |
// Bypass ACFE native groups
|
149 |
-
if(in_array($r_field_group['key'],
|
150 |
continue;
|
151 |
|
152 |
// Get related fields
|
@@ -445,13 +447,17 @@ class acfe_bidirectional{
|
|
445 |
*/
|
446 |
function update_value($value, $post_id, $field){
|
447 |
|
448 |
-
|
449 |
-
if(
|
450 |
return $value;
|
451 |
|
452 |
-
//
|
453 |
if(!$this->get_field_bidirectional($field))
|
454 |
return $value;
|
|
|
|
|
|
|
|
|
455 |
|
456 |
// Decode current post_id (ie: user_1)
|
457 |
$request = acf_decode_post_id($post_id);
|
21 |
|
22 |
}
|
23 |
|
24 |
+
add_action('wp_ajax_acfe/fields_settings/bidirectional/query', array($this, 'ajax_query'));
|
25 |
+
add_action('wp_ajax_nopriv_acfe/fields_settings/bidirectional/query', array($this, 'ajax_query'));
|
26 |
|
27 |
add_filter('acf/prepare_field/name=acfe_bidirectional_related', array($this, 'field_settings_default_value'));
|
28 |
|
141 |
if(empty($r_field_groups))
|
142 |
return false;
|
143 |
|
144 |
+
// Vars
|
145 |
+
$hidden = acfe_get_setting('reserved_field_groups', array());
|
146 |
$choices = array();
|
147 |
+
|
148 |
foreach($r_field_groups as $r_field_group){
|
149 |
|
150 |
// Bypass ACFE native groups
|
151 |
+
if(in_array($r_field_group['key'], $hidden))
|
152 |
continue;
|
153 |
|
154 |
// Get related fields
|
447 |
*/
|
448 |
function update_value($value, $post_id, $field){
|
449 |
|
450 |
+
// Bail early if updating a relation
|
451 |
+
if(acf_is_filter_enabled('acfe/bidirectional'))
|
452 |
return $value;
|
453 |
|
454 |
+
// Bail early if no bidirectional setting
|
455 |
if(!$this->get_field_bidirectional($field))
|
456 |
return $value;
|
457 |
+
|
458 |
+
// Bail early if local meta
|
459 |
+
if(acfe_is_local_post_id($post_id))
|
460 |
+
return $value;
|
461 |
|
462 |
// Decode current post_id (ie: user_1)
|
463 |
$request = acf_decode_post_id($post_id);
|
@@ -7,8 +7,8 @@ if(!class_exists('acfe_field_settings')):
|
|
7 |
|
8 |
class acfe_field_settings{
|
9 |
|
10 |
-
|
11 |
-
|
12 |
// Actions
|
13 |
add_action('acf/field_group/admin_head', array($this, 'load'));
|
14 |
add_action('wp_ajax_acf/field_group/render_field_settings', array($this, 'load_ajax'), 5);
|
@@ -18,11 +18,11 @@ class acfe_field_settings{
|
|
18 |
add_filter('acfe/load_field', array($this, 'load_field_additional'), 20);
|
19 |
add_filter('acf/prepare_field', array($this, 'prepare_field'), 20);
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
function load(){
|
27 |
|
28 |
if(!acf_is_filter_enabled('acfe/field_group/advanced'))
|
7 |
|
8 |
class acfe_field_settings{
|
9 |
|
10 |
+
function __construct(){
|
11 |
+
|
12 |
// Actions
|
13 |
add_action('acf/field_group/admin_head', array($this, 'load'));
|
14 |
add_action('wp_ajax_acf/field_group/render_field_settings', array($this, 'load_ajax'), 5);
|
18 |
add_filter('acfe/load_field', array($this, 'load_field_additional'), 20);
|
19 |
add_filter('acf/prepare_field', array($this, 'prepare_field'), 20);
|
20 |
|
21 |
+
}
|
22 |
|
23 |
+
/*
|
24 |
+
* Admin Head
|
25 |
+
*/
|
26 |
function load(){
|
27 |
|
28 |
if(!acf_is_filter_enabled('acfe/field_group/advanced'))
|
@@ -7,7 +7,7 @@ if(!class_exists('acfe_field_validation')):
|
|
7 |
|
8 |
class acfe_field_validation{
|
9 |
|
10 |
-
|
11 |
|
12 |
// Actions
|
13 |
add_action('acf/field_group/admin_head', array($this, 'load'));
|
@@ -16,11 +16,11 @@ class acfe_field_validation{
|
|
16 |
// Filters
|
17 |
add_filter('acf/validate_value', array($this, 'validate_value'), 99, 4);
|
18 |
|
19 |
-
|
20 |
|
21 |
/*
|
22 |
-
|
23 |
-
|
24 |
function load(){
|
25 |
|
26 |
if(!acf_is_filter_enabled('acfe/field_group/advanced'))
|
7 |
|
8 |
class acfe_field_validation{
|
9 |
|
10 |
+
function __construct(){
|
11 |
|
12 |
// Actions
|
13 |
add_action('acf/field_group/admin_head', array($this, 'load'));
|
16 |
// Filters
|
17 |
add_filter('acf/validate_value', array($this, 'validate_value'), 99, 4);
|
18 |
|
19 |
+
}
|
20 |
|
21 |
/*
|
22 |
+
* Admin Head
|
23 |
+
*/
|
24 |
function load(){
|
25 |
|
26 |
if(!acf_is_filter_enabled('acfe/field_group/advanced'))
|
@@ -16,11 +16,11 @@ class acfe_field_advanced_link extends acf_field{
|
|
16 |
$this->category = 'relational';
|
17 |
$this->defaults = array(
|
18 |
'post_type' => array(),
|
19 |
-
|
20 |
);
|
21 |
|
22 |
-
add_action('wp_ajax_acfe/fields/advanced_link/post_query',
|
23 |
-
|
24 |
|
25 |
$this->post_object = acf_get_field_type('post_object');
|
26 |
|
@@ -32,31 +32,31 @@ class acfe_field_advanced_link extends acf_field{
|
|
32 |
}
|
33 |
|
34 |
function post_object_render_field($field){
|
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 |
$post_type = $field['value'];
|
62 |
$post_type_label = acf_get_post_type_label($post_type);
|
@@ -64,30 +64,30 @@ class acfe_field_advanced_link extends acf_field{
|
|
64 |
$field['choices'][$field['value']] = $post_type_label . ' Archive';
|
65 |
|
66 |
}
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
|
73 |
function ajax_query(){
|
74 |
|
75 |
// validate
|
76 |
-
|
77 |
die();
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
|
82 |
$options = acf_parse_args($_POST, array(
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
$field = acf_get_field($options['field_key']);
|
90 |
-
|
91 |
return false;
|
92 |
|
93 |
if($options['paged'] > 1)
|
@@ -99,20 +99,20 @@ class acfe_field_advanced_link extends acf_field{
|
|
99 |
|
100 |
if($options['s'] !== ''){
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
|
107 |
if(!empty($field['post_type'])){
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
|
117 |
$post_types_archives = array();
|
118 |
|
@@ -157,96 +157,54 @@ class acfe_field_advanced_link extends acf_field{
|
|
157 |
));
|
158 |
|
159 |
}
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
|
164 |
}
|
165 |
|
166 |
function render_field_settings($field){
|
167 |
|
168 |
// Filter Post Type
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
// Filter Taxonomy
|
182 |
-
acf_render_field_setting($field, array(
|
183 |
-
'label' => __('Filter by Taxonomy','acf'),
|
184 |
-
'instructions' => '',
|
185 |
-
'type' => 'select',
|
186 |
-
'name' => 'taxonomy',
|
187 |
-
'choices' => acf_get_taxonomy_terms(),
|
188 |
-
'multiple' => 1,
|
189 |
-
'ui' => 1,
|
190 |
-
'allow_null' => 1,
|
191 |
-
'placeholder' => __("All taxonomies",'acf'),
|
192 |
-
));
|
193 |
-
|
194 |
-
$field_name = 'field_name';
|
195 |
-
if(acf_maybe_get($field, 'name'))
|
196 |
-
$field_name = $field['name'];
|
197 |
-
|
198 |
-
ob_start();
|
199 |
-
?>
|
200 |
-
Add your own sub fields using the following hook:<br /><br />
|
201 |
-
<pre>
|
202 |
-
add_filter('acfe/fields/advanced_link/sub_fields/name=<?php echo $field_name; ?>', 'my_acf_advanced_link_sub_fields', 10, 3);
|
203 |
-
function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
204 |
-
|
205 |
-
/**
|
206 |
-
* @array $sub_fields Sub fields array
|
207 |
-
* @array $field Advanced Link field
|
208 |
-
* @array $value Advanced Link values
|
209 |
-
*/
|
210 |
-
|
211 |
-
$sub_fields[] = array(
|
212 |
-
'name' => 'my_field',
|
213 |
-
'label' => 'My field',
|
214 |
-
'type' => 'true_false',
|
215 |
-
'ui' => true
|
216 |
-
);
|
217 |
-
|
218 |
-
return $sub_fields;
|
219 |
-
|
220 |
-
}
|
221 |
-
</pre>
|
222 |
-
<?php
|
223 |
-
|
224 |
-
$message = ob_get_clean();
|
225 |
|
226 |
-
//
|
227 |
acf_render_field_setting($field, array(
|
228 |
-
'label'
|
229 |
-
'instructions'
|
230 |
-
'type'
|
231 |
-
'name'
|
232 |
-
'
|
233 |
-
'
|
|
|
|
|
|
|
234 |
));
|
235 |
|
236 |
}
|
237 |
|
238 |
function get_value($value = array()){
|
239 |
-
|
240 |
-
|
241 |
$value = wp_parse_args($value, array(
|
242 |
'type' => 'url',
|
243 |
'post' => '',
|
244 |
'term' => '',
|
245 |
-
|
246 |
'url' => false,
|
247 |
'url_title' => '',
|
248 |
-
|
249 |
-
|
250 |
|
251 |
$value['url_title'] = $value['url'];
|
252 |
|
@@ -288,30 +246,30 @@ function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
|
288 |
|
289 |
}
|
290 |
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
|
296 |
function render_field($field){
|
297 |
|
298 |
// vars
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
|
310 |
$div['class'] .= ' -value';
|
311 |
|
312 |
}
|
313 |
-
|
314 |
-
|
315 |
|
316 |
$div['class'] .= ' -external';
|
317 |
|
@@ -320,26 +278,26 @@ function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
|
320 |
$sub_fields = array(
|
321 |
|
322 |
array(
|
323 |
-
'name'
|
324 |
-
'key'
|
325 |
-
'label'
|
326 |
-
'type'
|
327 |
-
'required'
|
328 |
'class' => 'input-type',
|
329 |
'choices' => array(
|
330 |
-
'url'
|
331 |
-
'post'
|
332 |
-
'term'
|
333 |
),
|
334 |
),
|
335 |
|
336 |
array(
|
337 |
-
'name'
|
338 |
-
'key'
|
339 |
-
'label'
|
340 |
-
'type'
|
341 |
-
'required'
|
342 |
-
'class'
|
343 |
'conditional_logic' => array(
|
344 |
array(
|
345 |
array(
|
@@ -353,14 +311,14 @@ function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
|
353 |
),
|
354 |
|
355 |
array(
|
356 |
-
'name'
|
357 |
-
'key'
|
358 |
-
'label'
|
359 |
-
'type'
|
360 |
-
'required'
|
361 |
-
'class'
|
362 |
-
'allow_null'
|
363 |
-
'ajax_action'
|
364 |
'conditional_logic' => array(
|
365 |
array(
|
366 |
array(
|
@@ -373,16 +331,16 @@ function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
|
373 |
),
|
374 |
|
375 |
array(
|
376 |
-
'name'
|
377 |
-
'key'
|
378 |
-
'label'
|
379 |
-
'type'
|
380 |
-
'required'
|
381 |
-
'class'
|
382 |
-
'field_type'
|
383 |
-
'return_format'
|
384 |
-
'ui'
|
385 |
-
'allow_null'
|
386 |
'conditional_logic' => array(
|
387 |
array(
|
388 |
array(
|
@@ -395,21 +353,21 @@ function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
|
395 |
),
|
396 |
|
397 |
array(
|
398 |
-
'name'
|
399 |
-
'key'
|
400 |
-
'label'
|
401 |
-
'type'
|
402 |
-
'required'
|
403 |
'class' => 'input-title',
|
404 |
),
|
405 |
|
406 |
array(
|
407 |
-
'name'
|
408 |
-
'key'
|
409 |
-
'label'
|
410 |
-
'type'
|
411 |
'message' => __('Open in an new window', 'acf'),
|
412 |
-
'required'
|
413 |
'class' => 'input-target',
|
414 |
),
|
415 |
|
@@ -436,7 +394,7 @@ function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
|
436 |
$sub_field = acf_prepare_field($sub_field);
|
437 |
|
438 |
}
|
439 |
-
|
440 |
?>
|
441 |
|
442 |
<div <?php acf_esc_attr_e($div); ?>>
|
@@ -471,9 +429,9 @@ function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
|
471 |
}
|
472 |
|
473 |
function format_value($value, $post_id, $field){
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
|
478 |
// clean
|
479 |
acfe_unset($value, 'type');
|
@@ -481,14 +439,14 @@ function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
|
481 |
acfe_unset($value, 'term');
|
482 |
acfe_unset($value, 'url_title');
|
483 |
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
return $valid;
|
493 |
|
494 |
// URL is required
|
@@ -498,10 +456,10 @@ function my_acf_advanced_link_sub_fields($sub_fields, $field, $value){
|
|
498 |
if((acf_maybe_get($value, 'type') === 'url' && !acf_maybe_get($value, 'url')) || (acf_maybe_get($value, 'type') === 'post' && !acf_maybe_get($value, 'post')) || (acf_maybe_get($value, 'type') === 'term' && !acf_maybe_get($value, 'term')))
|
499 |
return false;
|
500 |
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
|
506 |
}
|
507 |
|
16 |
$this->category = 'relational';
|
17 |
$this->defaults = array(
|
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 |
|
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 |
+
// append to choices
|
53 |
+
$field['choices'][ $post->ID ] = $this->post_object->get_post_title($post, $field);
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
if(acf_maybe_get($field, '_name') === 'post' && !empty($field['value']) && !is_array($field['value']) && !is_numeric($field['value'])){
|
60 |
|
61 |
$post_type = $field['value'];
|
62 |
$post_type_label = acf_get_post_type_label($post_type);
|
64 |
$field['choices'][$field['value']] = $post_type_label . ' Archive';
|
65 |
|
66 |
}
|
67 |
+
|
68 |
+
// render
|
69 |
+
acf_render_field( $field );
|
70 |
+
|
71 |
+
}
|
72 |
|
73 |
function ajax_query(){
|
74 |
|
75 |
// validate
|
76 |
+
if(!acf_verify_ajax())
|
77 |
die();
|
78 |
+
|
79 |
+
// get choices
|
80 |
+
$response = $this->post_object->get_ajax_query($_POST);
|
81 |
|
82 |
$options = acf_parse_args($_POST, array(
|
83 |
+
'post_id' => 0,
|
84 |
+
's' => '',
|
85 |
+
'field_key' => '',
|
86 |
+
'paged' => 1
|
87 |
+
));
|
88 |
|
89 |
$field = acf_get_field($options['field_key']);
|
90 |
+
if(!$field)
|
91 |
return false;
|
92 |
|
93 |
if($options['paged'] > 1)
|
99 |
|
100 |
if($options['s'] !== ''){
|
101 |
|
102 |
+
$s = wp_unslash(strval($options['s']));
|
103 |
+
$is_search = true;
|
104 |
+
|
105 |
+
}
|
106 |
|
107 |
if(!empty($field['post_type'])){
|
108 |
+
|
109 |
+
$post_types = acf_get_array($field['post_type']);
|
110 |
+
|
111 |
+
}else{
|
112 |
+
|
113 |
+
$post_types = acf_get_post_types();
|
114 |
+
|
115 |
+
}
|
116 |
|
117 |
$post_types_archives = array();
|
118 |
|
157 |
));
|
158 |
|
159 |
}
|
160 |
+
|
161 |
+
// return
|
162 |
+
acf_send_ajax_results($response);
|
163 |
|
164 |
}
|
165 |
|
166 |
function render_field_settings($field){
|
167 |
|
168 |
// Filter Post Type
|
169 |
+
acf_render_field_setting($field, array(
|
170 |
+
'label' => __('Filter by Post Type','acf'),
|
171 |
+
'instructions' => '',
|
172 |
+
'type' => 'select',
|
173 |
+
'name' => 'post_type',
|
174 |
+
'choices' => acf_get_pretty_post_types(),
|
175 |
+
'multiple' => 1,
|
176 |
+
'ui' => 1,
|
177 |
+
'allow_null' => 1,
|
178 |
+
'placeholder' => __("All post types",'acf'),
|
179 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
|
181 |
+
// Filter Taxonomy
|
182 |
acf_render_field_setting($field, array(
|
183 |
+
'label' => __('Filter by Taxonomy','acf'),
|
184 |
+
'instructions' => '',
|
185 |
+
'type' => 'select',
|
186 |
+
'name' => 'taxonomy',
|
187 |
+
'choices' => acf_get_taxonomy_terms(),
|
188 |
+
'multiple' => 1,
|
189 |
+
'ui' => 1,
|
190 |
+
'allow_null' => 1,
|
191 |
+
'placeholder' => __("All taxonomies",'acf'),
|
192 |
));
|
193 |
|
194 |
}
|
195 |
|
196 |
function get_value($value = array()){
|
197 |
+
|
198 |
+
// vars
|
199 |
$value = wp_parse_args($value, array(
|
200 |
'type' => 'url',
|
201 |
'post' => '',
|
202 |
'term' => '',
|
203 |
+
'title' => '',
|
204 |
'url' => false,
|
205 |
'url_title' => '',
|
206 |
+
'target' => false,
|
207 |
+
));
|
208 |
|
209 |
$value['url_title'] = $value['url'];
|
210 |
|
246 |
|
247 |
}
|
248 |
|
249 |
+
// return
|
250 |
+
return $value;
|
251 |
+
|
252 |
+
}
|
253 |
|
254 |
function render_field($field){
|
255 |
|
256 |
// vars
|
257 |
+
$div = array(
|
258 |
+
'id' => $field['id'],
|
259 |
+
'class' => $field['class'] . ' acf-link',
|
260 |
+
);
|
261 |
+
|
262 |
+
// get link
|
263 |
+
$value = $this->get_value($field['value']);
|
264 |
+
|
265 |
+
// classes
|
266 |
+
if($value['url']){
|
267 |
|
268 |
$div['class'] .= ' -value';
|
269 |
|
270 |
}
|
271 |
+
|
272 |
+
if($value['target'] === '_blank'){
|
273 |
|
274 |
$div['class'] .= ' -external';
|
275 |
|
278 |
$sub_fields = array(
|
279 |
|
280 |
array(
|
281 |
+
'name' => 'type',
|
282 |
+
'key' => 'type',
|
283 |
+
'label' => __('Type', 'acf'),
|
284 |
+
'type' => 'radio',
|
285 |
+
'required' => false,
|
286 |
'class' => 'input-type',
|
287 |
'choices' => array(
|
288 |
+
'url' => __('URL', 'acf'),
|
289 |
+
'post' => __('Post', 'acf'),
|
290 |
+
'term' => __('Term', 'acf'),
|
291 |
),
|
292 |
),
|
293 |
|
294 |
array(
|
295 |
+
'name' => 'url',
|
296 |
+
'key' => 'url',
|
297 |
+
'label' => __('URL', 'acf'),
|
298 |
+
'type' => 'text',
|
299 |
+
'required' => false,
|
300 |
+
'class' => 'input-url',
|
301 |
'conditional_logic' => array(
|
302 |
array(
|
303 |
array(
|
311 |
),
|
312 |
|
313 |
array(
|
314 |
+
'name' => 'post',
|
315 |
+
'key' => 'post',
|
316 |
+
'label' => __('Post', 'acf'),
|
317 |
+
'type' => 'post_object',
|
318 |
+
'required' => false,
|
319 |
+
'class' => 'input-post',
|
320 |
+
'allow_null' => 0,
|
321 |
+
'ajax_action' => 'acfe/fields/advanced_link/post_query',
|
322 |
'conditional_logic' => array(
|
323 |
array(
|
324 |
array(
|
331 |
),
|
332 |
|
333 |
array(
|
334 |
+
'name' => 'term',
|
335 |
+
'key' => 'term',
|
336 |
+
'label' => __('Term', 'acf'),
|
337 |
+
'type' => 'acfe_taxonomy_terms',
|
338 |
+
'required' => false,
|
339 |
+
'class' => 'input-term',
|
340 |
+
'field_type' => 'select',
|
341 |
+
'return_format' => 'id',
|
342 |
+
'ui' => 1,
|
343 |
+
'allow_null' => 0,
|
344 |
'conditional_logic' => array(
|
345 |
array(
|
346 |
array(
|
353 |
),
|
354 |
|
355 |
array(
|
356 |
+
'name' => 'title',
|
357 |
+
'key' => 'title',
|
358 |
+
'label' => __('Link text', 'acf'),
|
359 |
+
'type' => 'text',
|
360 |
+
'required' => false,
|
361 |
'class' => 'input-title',
|
362 |
),
|
363 |
|
364 |
array(
|
365 |
+
'name' => 'target',
|
366 |
+
'key' => 'target',
|
367 |
+
'label' => __('Target', 'acf'),
|
368 |
+
'type' => 'true_false',
|
369 |
'message' => __('Open in an new window', 'acf'),
|
370 |
+
'required' => false,
|
371 |
'class' => 'input-target',
|
372 |
),
|
373 |
|
394 |
$sub_field = acf_prepare_field($sub_field);
|
395 |
|
396 |
}
|
397 |
+
|
398 |
?>
|
399 |
|
400 |
<div <?php acf_esc_attr_e($div); ?>>
|
429 |
}
|
430 |
|
431 |
function format_value($value, $post_id, $field){
|
432 |
+
|
433 |
+
// get value
|
434 |
+
$value = $this->get_value($value);
|
435 |
|
436 |
// clean
|
437 |
acfe_unset($value, 'type');
|
439 |
acfe_unset($value, 'term');
|
440 |
acfe_unset($value, 'url_title');
|
441 |
|
442 |
+
return $value;
|
443 |
+
|
444 |
+
}
|
445 |
|
446 |
+
function validate_value($valid, $value, $field, $input){
|
447 |
+
|
448 |
+
// bail early if not required
|
449 |
+
if(!$field['required'])
|
450 |
return $valid;
|
451 |
|
452 |
// URL is required
|
456 |
if((acf_maybe_get($value, 'type') === 'url' && !acf_maybe_get($value, 'url')) || (acf_maybe_get($value, 'type') === 'post' && !acf_maybe_get($value, 'post')) || (acf_maybe_get($value, 'type') === 'term' && !acf_maybe_get($value, 'term')))
|
457 |
return false;
|
458 |
|
459 |
+
// return
|
460 |
+
return $valid;
|
461 |
+
|
462 |
+
}
|
463 |
|
464 |
}
|
465 |
|
@@ -13,12 +13,12 @@ class acfe_field_button extends acf_field{
|
|
13 |
$this->label = __('Button', 'acfe');
|
14 |
$this->category = 'basic';
|
15 |
$this->defaults = array(
|
16 |
-
'button_value'
|
17 |
-
'button_type'
|
18 |
'button_before' => '',
|
19 |
-
'button_after'
|
20 |
-
'button_class'
|
21 |
-
'button_id'
|
22 |
);
|
23 |
|
24 |
add_action('wp_ajax_acfe/fields/button', array($this, 'ajax_request'), 99);
|
@@ -69,27 +69,27 @@ class acfe_field_button extends acf_field{
|
|
69 |
'default_value' => 'button',
|
70 |
'layout' => 'horizontal',
|
71 |
'choices' => array(
|
72 |
-
'button'
|
73 |
-
'submit'
|
74 |
),
|
75 |
));
|
76 |
|
77 |
// class
|
78 |
acf_render_field_setting($field, array(
|
79 |
-
'label'
|
80 |
-
'instructions'
|
81 |
-
'type'
|
82 |
-
'name'
|
83 |
-
'prepend'
|
84 |
));
|
85 |
|
86 |
// id
|
87 |
acf_render_field_setting($field, array(
|
88 |
-
'label'
|
89 |
-
'instructions'
|
90 |
-
'type'
|
91 |
-
'name'
|
92 |
-
'prepend'
|
93 |
'_append' => 'button_class'
|
94 |
));
|
95 |
|
@@ -116,8 +116,8 @@ class acfe_field_button extends acf_field{
|
|
116 |
'label' => __('Ajax call', 'acfe'),
|
117 |
'instructions' => __('Trigger ajax event on click. <a href="https://www.acf-extended.com/features/fields/button" target="_blank">See documentation</a>', 'acfe'),
|
118 |
'name' => 'button_ajax',
|
119 |
-
'type'
|
120 |
-
|
121 |
));
|
122 |
|
123 |
}
|
13 |
$this->label = __('Button', 'acfe');
|
14 |
$this->category = 'basic';
|
15 |
$this->defaults = array(
|
16 |
+
'button_value' => __('Submit', 'acfe'),
|
17 |
+
'button_type' => 'button',
|
18 |
'button_before' => '',
|
19 |
+
'button_after' => '',
|
20 |
+
'button_class' => 'button button-secondary',
|
21 |
+
'button_id' => '',
|
22 |
);
|
23 |
|
24 |
add_action('wp_ajax_acfe/fields/button', array($this, 'ajax_request'), 99);
|
69 |
'default_value' => 'button',
|
70 |
'layout' => 'horizontal',
|
71 |
'choices' => array(
|
72 |
+
'button' => __('Button', 'acfe'),
|
73 |
+
'submit' => __('Input', 'acfe'),
|
74 |
),
|
75 |
));
|
76 |
|
77 |
// class
|
78 |
acf_render_field_setting($field, array(
|
79 |
+
'label' => __('Button attributes','acf'),
|
80 |
+
'instructions' => '',
|
81 |
+
'type' => 'text',
|
82 |
+
'name' => 'button_class',
|
83 |
+
'prepend' => __('class', 'acf'),
|
84 |
));
|
85 |
|
86 |
// id
|
87 |
acf_render_field_setting($field, array(
|
88 |
+
'label' => '',
|
89 |
+
'instructions' => '',
|
90 |
+
'type' => 'text',
|
91 |
+
'name' => 'button_id',
|
92 |
+
'prepend' => __('id', 'acf'),
|
93 |
'_append' => 'button_class'
|
94 |
));
|
95 |
|
116 |
'label' => __('Ajax call', 'acfe'),
|
117 |
'instructions' => __('Trigger ajax event on click. <a href="https://www.acf-extended.com/features/fields/button" target="_blank">See documentation</a>', 'acfe'),
|
118 |
'name' => 'button_ajax',
|
119 |
+
'type' => 'true_false',
|
120 |
+
'ui' => 1,
|
121 |
));
|
122 |
|
123 |
}
|
@@ -3,198 +3,229 @@
|
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
'
|
16 |
-
'
|
17 |
-
'
|
18 |
-
'
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
array(
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
)
|
30 |
)
|
31 |
-
)
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
'conditional_logic' => array(
|
44 |
-
array(
|
45 |
array(
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
49 |
)
|
50 |
)
|
51 |
-
)
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
'conditional_logic' => array(
|
64 |
-
array(
|
65 |
array(
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
70 |
)
|
71 |
-
)
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
'conditional_logic' => array(
|
82 |
-
array(
|
83 |
array(
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
88 |
)
|
89 |
-
)
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
'conditional_logic' => array(
|
107 |
-
array(
|
108 |
array(
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
113 |
)
|
114 |
-
)
|
115 |
-
|
|
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
function
|
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 |
-
add_filter('acf/load_field_groups', 'acfe_field_clone_ajax_query');
|
152 |
-
function acfe_field_clone_ajax_query($field_groups){
|
153 |
-
|
154 |
-
if(!acf_verify_ajax())
|
155 |
-
return $field_groups;
|
156 |
-
|
157 |
-
if(acf_maybe_get_POST('field_key') !== 'clone')
|
158 |
-
return $field_groups;
|
159 |
-
|
160 |
-
if(empty($field_groups))
|
161 |
-
return $field_groups;
|
162 |
-
|
163 |
-
foreach($field_groups as $i => $field_group){
|
164 |
|
165 |
-
if(
|
166 |
-
|
167 |
-
'
|
168 |
-
|
169 |
-
|
170 |
-
'group_acfe_dynamic_post_type',
|
171 |
-
'group_acfe_dynamic_taxonomy')
|
172 |
-
))
|
173 |
-
continue;
|
174 |
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
}
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
add_filter('acf/prepare_field/type=clone', 'acfe_field_clone_type_class', 99);
|
184 |
-
function acfe_field_clone_type_class($field){
|
185 |
-
|
186 |
-
if(acf_maybe_get($field, 'acfe_seamless_style')){
|
187 |
|
188 |
-
|
|
|
|
|
189 |
|
|
|
|
|
|
|
190 |
}
|
191 |
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
-
$
|
195 |
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
-
|
|
|
|
|
199 |
|
200 |
-
}
|
|
|
|
|
|
|
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
+
if(!class_exists('acfe_field_clone')):
|
7 |
+
|
8 |
+
class acfe_field_clone{
|
9 |
+
|
10 |
+
/*
|
11 |
+
* Cosntruct
|
12 |
+
*/
|
13 |
+
function __construct(){
|
14 |
+
|
15 |
+
add_action('acf/render_field_settings/type=clone', array($this, 'render_field_settings'));
|
16 |
+
add_filter('acfe/field_wrapper_attributes/type=clone', array($this, 'field_wrapper_attributes'), 10, 2);
|
17 |
+
add_filter('acf/prepare_field/type=clone', array($this, 'prepare_field'), 99);
|
18 |
+
add_action('wp_ajax_acf/fields/clone/query', array($this, 'ajax_query'), 5);
|
19 |
+
|
20 |
+
}
|
21 |
+
|
22 |
+
/*
|
23 |
+
* Render Field Settings
|
24 |
+
*/
|
25 |
+
function render_field_settings($field){
|
26 |
+
|
27 |
+
acf_render_field_setting($field, array(
|
28 |
+
'label' => __('Seamless Style', 'acfe'),
|
29 |
+
'name' => 'acfe_seamless_style',
|
30 |
+
'key' => 'acfe_seamless_style',
|
31 |
+
'instructions' => __('Enable better CSS integration: remove borders and padding'),
|
32 |
+
'type' => 'true_false',
|
33 |
+
'message' => '',
|
34 |
+
'default_value' => false,
|
35 |
+
'ui' => true,
|
36 |
+
'conditional_logic' => array(
|
37 |
array(
|
38 |
+
array(
|
39 |
+
'field' => 'display',
|
40 |
+
'operator' => '==',
|
41 |
+
'value' => 'group',
|
42 |
+
),
|
43 |
+
array(
|
44 |
+
'field' => 'acfe_clone_modal',
|
45 |
+
'operator' => '!=',
|
46 |
+
'value' => '1',
|
47 |
+
)
|
48 |
)
|
49 |
)
|
50 |
+
));
|
51 |
+
|
52 |
+
acf_render_field_setting($field, array(
|
53 |
+
'label' => __('Edition modal'),
|
54 |
+
'name' => 'acfe_clone_modal',
|
55 |
+
'key' => 'acfe_clone_modal',
|
56 |
+
'instructions' => __('Edit fields in a modal'),
|
57 |
+
'type' => 'true_false',
|
58 |
+
'message' => '',
|
59 |
+
'default_value' => false,
|
60 |
+
'ui' => true,
|
61 |
+
'conditional_logic' => array(
|
|
|
|
|
62 |
array(
|
63 |
+
array(
|
64 |
+
'field' => 'display',
|
65 |
+
'operator' => '==',
|
66 |
+
'value' => 'group',
|
67 |
+
)
|
68 |
)
|
69 |
)
|
70 |
+
));
|
71 |
+
|
72 |
+
acf_render_field_setting($field, array(
|
73 |
+
'label' => __('Edition modal: Close button'),
|
74 |
+
'name' => 'acfe_clone_modal_close',
|
75 |
+
'key' => 'acfe_clone_modal_close',
|
76 |
+
'instructions' => __('Display close button'),
|
77 |
+
'type' => 'true_false',
|
78 |
+
'message' => '',
|
79 |
+
'default_value' => false,
|
80 |
+
'ui' => true,
|
81 |
+
'conditional_logic' => array(
|
|
|
|
|
82 |
array(
|
83 |
+
array(
|
84 |
+
'field' => 'acfe_clone_modal',
|
85 |
+
'operator' => '==',
|
86 |
+
'value' => '1',
|
87 |
+
),
|
88 |
+
)
|
89 |
)
|
90 |
+
));
|
91 |
+
|
92 |
+
acf_render_field_setting($field, array(
|
93 |
+
'label' => __('Edition modal: Text button'),
|
94 |
+
'name' => 'acfe_clone_modal_button',
|
95 |
+
'key' => 'acfe_clone_modal_button',
|
96 |
+
'instructions' => __('Text displayed in the edition modal button'),
|
97 |
+
'type' => 'text',
|
98 |
+
'placeholder' => __('Edit', 'acf'),
|
99 |
+
'conditional_logic' => array(
|
|
|
|
|
100 |
array(
|
101 |
+
array(
|
102 |
+
'field' => 'acfe_clone_modal',
|
103 |
+
'operator' => '==',
|
104 |
+
'value' => '1',
|
105 |
+
),
|
106 |
+
)
|
107 |
)
|
108 |
+
));
|
109 |
+
|
110 |
+
acf_render_field_setting($field, array(
|
111 |
+
'label' => __('Edition modal: Size'),
|
112 |
+
'name' => 'acfe_clone_modal_size',
|
113 |
+
'key' => 'acfe_clone_modal_size',
|
114 |
+
'instructions' => __('Choose the modal size'),
|
115 |
+
'type' => 'select',
|
116 |
+
'choices' => array(
|
117 |
+
'small' => 'Small',
|
118 |
+
'medium' => 'Medium',
|
119 |
+
'large' => 'Large',
|
120 |
+
'xlarge' => 'Extra Large',
|
121 |
+
'full' => 'Full',
|
122 |
+
),
|
123 |
+
'default_value' => 'large',
|
124 |
+
'conditional_logic' => array(
|
|
|
|
|
125 |
array(
|
126 |
+
array(
|
127 |
+
'field' => 'acfe_clone_modal',
|
128 |
+
'operator' => '==',
|
129 |
+
'value' => '1',
|
130 |
+
),
|
131 |
+
)
|
132 |
)
|
133 |
+
));
|
134 |
+
|
135 |
+
}
|
136 |
|
137 |
+
/*
|
138 |
+
* Field Wrapper Attributes
|
139 |
+
*/
|
140 |
+
function field_wrapper_attributes($wrapper, $field){
|
141 |
|
142 |
+
if(acf_maybe_get($field, 'acfe_clone_modal')){
|
143 |
|
144 |
+
$wrapper['data-acfe-clone-modal'] = 1;
|
145 |
+
$wrapper['data-acfe-clone-modal-button'] = __('Edit', 'acf');
|
146 |
|
147 |
+
if(acf_maybe_get($field, 'acfe_clone_modal_button')){
|
148 |
|
149 |
+
$wrapper['data-acfe-clone-modal-button'] = $field['acfe_clone_modal_button'];
|
150 |
|
151 |
+
}
|
152 |
|
153 |
+
if(acf_maybe_get($field, 'acfe_clone_modal_close')){
|
154 |
|
155 |
+
$wrapper['data-acfe-clone-modal-close'] = $field['acfe_clone_modal_close'];
|
156 |
|
157 |
+
}
|
158 |
|
159 |
+
if(acf_maybe_get($field, 'acfe_clone_modal_size')){
|
160 |
|
161 |
+
$wrapper['data-acfe-clone-modal-size'] = $field['acfe_clone_modal_size'];
|
162 |
|
163 |
+
}
|
164 |
+
|
165 |
}
|
166 |
+
|
167 |
+
return $wrapper;
|
168 |
|
169 |
}
|
170 |
|
171 |
+
/*
|
172 |
+
* Prepare Field
|
173 |
+
*/
|
174 |
+
function prepare_field($field){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
+
if(acf_maybe_get($field, 'acfe_seamless_style')){
|
177 |
+
|
178 |
+
$field['wrapper']['class'] .= ' acfe-seamless-style';
|
179 |
+
|
180 |
+
}
|
|
|
|
|
|
|
|
|
181 |
|
182 |
+
if(acf_maybe_get($field, 'layout')){
|
183 |
+
|
184 |
+
$field['wrapper']['class'] .= ' acfe-field-clone-layout-' . $field['layout'];
|
185 |
+
|
186 |
+
}
|
187 |
+
|
188 |
+
return $field;
|
189 |
|
190 |
}
|
191 |
|
192 |
+
/*
|
193 |
+
* Ajax Query
|
194 |
+
*/
|
195 |
+
function ajax_query(){
|
|
|
|
|
|
|
|
|
196 |
|
197 |
+
// validate
|
198 |
+
if(!acf_verify_ajax())
|
199 |
+
die();
|
200 |
|
201 |
+
// local field groups are added at priortiy 20
|
202 |
+
add_filter('acf/load_field_groups', array($this, 'load_field_groups'), 25);
|
203 |
+
|
204 |
}
|
205 |
|
206 |
+
/*
|
207 |
+
* Load Field Groups
|
208 |
+
*/
|
209 |
+
function load_field_groups($field_groups){
|
210 |
+
|
211 |
+
// Hidden Local Field Groups
|
212 |
+
$hidden = acfe_get_setting('reserved_field_groups', array());
|
213 |
|
214 |
+
foreach($field_groups as $i => $field_group){
|
215 |
|
216 |
+
if(!in_array($field_group['key'], $hidden))
|
217 |
+
continue;
|
218 |
+
|
219 |
+
unset($field_groups[$i]);
|
220 |
+
|
221 |
+
}
|
222 |
|
223 |
+
return $field_groups;
|
224 |
+
|
225 |
+
}
|
226 |
|
227 |
+
}
|
228 |
+
|
229 |
+
new acfe_field_clone();
|
230 |
+
|
231 |
+
endif;
|
@@ -16,14 +16,14 @@ class acfe_field_code_editor extends acf_field{
|
|
16 |
$this->label = __('Code Editor', 'acfe');
|
17 |
$this->category = 'content';
|
18 |
$this->defaults = array(
|
19 |
-
'default_value'
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
);
|
28 |
|
29 |
$this->textarea = acf_get_field_type('textarea');
|
@@ -57,28 +57,28 @@ class acfe_field_code_editor extends acf_field{
|
|
57 |
|
58 |
// default_value
|
59 |
acf_render_field_setting($field, array(
|
60 |
-
'label'
|
61 |
-
'instructions'
|
62 |
-
'type'
|
63 |
-
'name'
|
64 |
'rows' => 4
|
65 |
));
|
66 |
|
67 |
// placeholder
|
68 |
acf_render_field_setting($field, array(
|
69 |
-
'label'
|
70 |
-
'instructions'
|
71 |
-
'type'
|
72 |
-
'name'
|
73 |
'rows' => 4
|
74 |
));
|
75 |
|
76 |
// Mode
|
77 |
acf_render_field_setting($field, array(
|
78 |
-
'label'
|
79 |
-
'instructions'
|
80 |
'type' => 'select',
|
81 |
-
'name'
|
82 |
'choices' => array(
|
83 |
'text/html' => __('Text/HTML', 'acf'),
|
84 |
'javascript' => __('JavaScript', 'acf'),
|
@@ -90,46 +90,46 @@ class acfe_field_code_editor extends acf_field{
|
|
90 |
|
91 |
// Lines
|
92 |
acf_render_field_setting($field, array(
|
93 |
-
'label'
|
94 |
-
'instructions'
|
95 |
-
'type'
|
96 |
-
'name'
|
97 |
'ui' => true,
|
98 |
));
|
99 |
|
100 |
// Indent Unit
|
101 |
acf_render_field_setting($field, array(
|
102 |
-
'label'
|
103 |
-
'instructions'
|
104 |
-
'type'
|
105 |
-
'min'
|
106 |
-
'name'
|
107 |
));
|
108 |
|
109 |
// maxlength
|
110 |
acf_render_field_setting($field, array(
|
111 |
-
'label'
|
112 |
-
'instructions'
|
113 |
-
'type'
|
114 |
-
'name'
|
115 |
));
|
116 |
|
117 |
// rows
|
118 |
acf_render_field_setting($field, array(
|
119 |
-
'label'
|
120 |
-
'instructions'
|
121 |
-
'type'
|
122 |
-
'name'
|
123 |
-
'placeholder'
|
124 |
));
|
125 |
|
126 |
// max rows
|
127 |
acf_render_field_setting($field, array(
|
128 |
-
'label'
|
129 |
-
'instructions'
|
130 |
-
'type'
|
131 |
-
'name'
|
132 |
-
'placeholder'
|
133 |
));
|
134 |
|
135 |
}
|
@@ -145,7 +145,7 @@ class acfe_field_code_editor extends acf_field{
|
|
145 |
|
146 |
return $this->textarea->validate_value($valid, $value, $field, $input);
|
147 |
|
148 |
-
|
149 |
|
150 |
}
|
151 |
|
16 |
$this->label = __('Code Editor', 'acfe');
|
17 |
$this->category = 'content';
|
18 |
$this->defaults = array(
|
19 |
+
'default_value' => '',
|
20 |
+
'placeholder' => '',
|
21 |
+
'mode' => 'text/html',
|
22 |
+
'lines' => true,
|
23 |
+
'indent_unit' => 4,
|
24 |
+
'maxlength' => '',
|
25 |
+
'rows' => '',
|
26 |
+
'max_rows' => ''
|
27 |
);
|
28 |
|
29 |
$this->textarea = acf_get_field_type('textarea');
|
57 |
|
58 |
// default_value
|
59 |
acf_render_field_setting($field, array(
|
60 |
+
'label' => __('Default Value','acf'),
|
61 |
+
'instructions' => __('Appears when creating a new post','acf'),
|
62 |
+
'type' => 'acfe_code_editor',
|
63 |
+
'name' => 'default_value',
|
64 |
'rows' => 4
|
65 |
));
|
66 |
|
67 |
// placeholder
|
68 |
acf_render_field_setting($field, array(
|
69 |
+
'label' => __('Placeholder','acf'),
|
70 |
+
'instructions' => __('Appears within the input','acf'),
|
71 |
+
'type' => 'acfe_code_editor',
|
72 |
+
'name' => 'placeholder',
|
73 |
'rows' => 4
|
74 |
));
|
75 |
|
76 |
// Mode
|
77 |
acf_render_field_setting($field, array(
|
78 |
+
'label' => __('Editor mode','acf'),
|
79 |
+
'instructions' => __('Choose the syntax highlight','acf'),
|
80 |
'type' => 'select',
|
81 |
+
'name' => 'mode',
|
82 |
'choices' => array(
|
83 |
'text/html' => __('Text/HTML', 'acf'),
|
84 |
'javascript' => __('JavaScript', 'acf'),
|
90 |
|
91 |
// Lines
|
92 |
acf_render_field_setting($field, array(
|
93 |
+
'label' => __('Show Lines', 'acf'),
|
94 |
+
'instructions' => 'Whether to show line numbers to the left of the editor',
|
95 |
+
'type' => 'true_false',
|
96 |
+
'name' => 'lines',
|
97 |
'ui' => true,
|
98 |
));
|
99 |
|
100 |
// Indent Unit
|
101 |
acf_render_field_setting($field, array(
|
102 |
+
'label' => __('Indent Unit', 'acf'),
|
103 |
+
'instructions' => 'How many spaces a block (whatever that means in the edited language) should be indented',
|
104 |
+
'type' => 'number',
|
105 |
+
'min' => 0,
|
106 |
+
'name' => 'indent_unit',
|
107 |
));
|
108 |
|
109 |
// maxlength
|
110 |
acf_render_field_setting($field, array(
|
111 |
+
'label' => __('Character Limit','acf'),
|
112 |
+
'instructions' => __('Leave blank for no limit','acf'),
|
113 |
+
'type' => 'number',
|
114 |
+
'name' => 'maxlength',
|
115 |
));
|
116 |
|
117 |
// rows
|
118 |
acf_render_field_setting($field, array(
|
119 |
+
'label' => __('Rows','acf'),
|
120 |
+
'instructions' => __('Sets the textarea height','acf'),
|
121 |
+
'type' => 'number',
|
122 |
+
'name' => 'rows',
|
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 |
}
|
145 |
|
146 |
return $this->textarea->validate_value($valid, $value, $field, $input);
|
147 |
|
148 |
+
}
|
149 |
|
150 |
}
|
151 |
|
@@ -82,17 +82,17 @@ class acfe_field_column extends acf_field{
|
|
82 |
)
|
83 |
)
|
84 |
)
|
85 |
-
|
86 |
|
87 |
// endpoint
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
'class' => 'acfe-field-columns-endpoint',
|
95 |
-
|
96 |
|
97 |
}
|
98 |
|
@@ -118,13 +118,13 @@ class acfe_field_column extends acf_field{
|
|
118 |
function render_field($field){
|
119 |
|
120 |
// vars
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
|
129 |
}
|
130 |
|
82 |
)
|
83 |
)
|
84 |
)
|
85 |
+
));
|
86 |
|
87 |
// endpoint
|
88 |
+
acf_render_field_setting( $field, array(
|
89 |
+
'label' => __('Endpoint','acf'),
|
90 |
+
'instructions' => __('Define an endpoint for the previous columns to stop.', 'acf'),
|
91 |
+
'name' => 'endpoint',
|
92 |
+
'type' => 'true_false',
|
93 |
+
'ui' => 1,
|
94 |
'class' => 'acfe-field-columns-endpoint',
|
95 |
+
));
|
96 |
|
97 |
}
|
98 |
|
118 |
function render_field($field){
|
119 |
|
120 |
// vars
|
121 |
+
$atts = array(
|
122 |
+
'class' => 'acf-fields',
|
123 |
+
);
|
124 |
+
|
125 |
+
?>
|
126 |
+
<div <?php acf_esc_attr_e($atts); ?>></div>
|
127 |
+
<?php
|
128 |
|
129 |
}
|
130 |
|
@@ -17,39 +17,6 @@ class acfe_field_dynamic_message extends acf_field{
|
|
17 |
|
18 |
}
|
19 |
|
20 |
-
function render_field_settings($field){
|
21 |
-
|
22 |
-
$field_name = 'field_name';
|
23 |
-
if(acf_maybe_get($field, 'name'))
|
24 |
-
$field_name = $field['name'];
|
25 |
-
|
26 |
-
ob_start();
|
27 |
-
?>
|
28 |
-
Write your own PHP/HTML content using the following hook:<br /><br />
|
29 |
-
<pre>
|
30 |
-
add_action('acf/render_field/name=<?php echo $field_name; ?>', 'my_acf_dynamic_message');
|
31 |
-
function my_acf_dynamic_message(){
|
32 |
-
|
33 |
-
echo 'Hello World';
|
34 |
-
|
35 |
-
}
|
36 |
-
</pre>
|
37 |
-
<?php
|
38 |
-
|
39 |
-
$message = ob_get_clean();
|
40 |
-
|
41 |
-
// field_type
|
42 |
-
acf_render_field_setting($field, array(
|
43 |
-
'label' => __('Instructions','acf'),
|
44 |
-
'instructions' => '',
|
45 |
-
'type' => 'message',
|
46 |
-
'name' => 'instructions',
|
47 |
-
'message' => $message,
|
48 |
-
'new_lines' => false
|
49 |
-
));
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
function render_field($field){
|
54 |
|
55 |
if(!isset($field['render']) || !is_callable($field['render']))
|
17 |
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
function render_field($field){
|
21 |
|
22 |
if(!isset($field['render']) || !is_callable($field['render']))
|
@@ -112,9 +112,9 @@ class acfe_field_flexible_content_async{
|
|
112 |
$l_name = $layout['name'];
|
113 |
|
114 |
$div = array(
|
115 |
-
'class'
|
116 |
-
'data-id'
|
117 |
-
'data-layout'
|
118 |
);
|
119 |
|
120 |
$div = apply_filters("acfe/flexible/layouts/div", $div, $layout, $field, $i, $value, $prefix);
|
112 |
$l_name = $layout['name'];
|
113 |
|
114 |
$div = array(
|
115 |
+
'class' => 'layout acf-clone',
|
116 |
+
'data-id' => 'acfcloneindex',
|
117 |
+
'data-layout' => $layout['name']
|
118 |
);
|
119 |
|
120 |
$div = apply_filters("acfe/flexible/layouts/div", $div, $layout, $field, $i, $value, $prefix);
|
@@ -319,12 +319,12 @@ class acfe_field_flexible_content_preview{
|
|
319 |
|
320 |
// Options
|
321 |
$options = acf_parse_args($_POST, array(
|
322 |
-
'post_id'
|
323 |
-
'i'
|
324 |
-
'field_key'
|
325 |
-
'nonce'
|
326 |
-
'layout'
|
327 |
-
'value'
|
328 |
));
|
329 |
|
330 |
}
|
319 |
|
320 |
// Options
|
321 |
$options = acf_parse_args($_POST, array(
|
322 |
+
'post_id' => 0,
|
323 |
+
'i' => 0,
|
324 |
+
'field_key' => '',
|
325 |
+
'nonce' => '',
|
326 |
+
'layout' => '',
|
327 |
+
'value' => array()
|
328 |
));
|
329 |
|
330 |
}
|
@@ -62,8 +62,8 @@ class acfe_field_flexible_content{
|
|
62 |
}
|
63 |
|
64 |
/*
|
65 |
-
|
66 |
-
|
67 |
function render_field_layouts_settings($field){
|
68 |
|
69 |
if($field['_name'] !== 'max' || stripos($field['name'], '[layouts]') === false)
|
@@ -104,8 +104,8 @@ class acfe_field_flexible_content{
|
|
104 |
}
|
105 |
|
106 |
/*
|
107 |
-
|
108 |
-
|
109 |
function validate_field($field){
|
110 |
|
111 |
// Defaults
|
@@ -161,8 +161,8 @@ class acfe_field_flexible_content{
|
|
161 |
}
|
162 |
|
163 |
/*
|
164 |
-
|
165 |
-
|
166 |
function prepare_field($field){
|
167 |
|
168 |
// Vars
|
@@ -202,8 +202,8 @@ class acfe_field_flexible_content{
|
|
202 |
}
|
203 |
|
204 |
/*
|
205 |
-
|
206 |
-
|
207 |
function load_fields($fields, $field){
|
208 |
|
209 |
if(acfe_is_admin_screen())
|
@@ -226,8 +226,8 @@ class acfe_field_flexible_content{
|
|
226 |
}
|
227 |
|
228 |
/*
|
229 |
-
|
230 |
-
|
231 |
function wrapper_attributes($wrapper, $field){
|
232 |
|
233 |
$wrapper = apply_filters('acfe/flexible/wrapper_attributes', $wrapper, $field);
|
@@ -237,8 +237,8 @@ class acfe_field_flexible_content{
|
|
237 |
}
|
238 |
|
239 |
/*
|
240 |
-
|
241 |
-
|
242 |
function render_field($field){
|
243 |
|
244 |
// Vars
|
@@ -259,9 +259,9 @@ class acfe_field_flexible_content{
|
|
259 |
|
260 |
// vars
|
261 |
$div = array(
|
262 |
-
'class'
|
263 |
-
'data-min'
|
264 |
-
'data-max'
|
265 |
);
|
266 |
|
267 |
// empty
|
@@ -407,10 +407,10 @@ class acfe_field_flexible_content{
|
|
407 |
<?php foreach($layouts as $layout):
|
408 |
|
409 |
$atts = array(
|
410 |
-
'href'
|
411 |
-
'data-layout'
|
412 |
-
'data-min'
|
413 |
-
'data-max'
|
414 |
);
|
415 |
|
416 |
?><li><a <?php echo acf_esc_attrs($atts); ?>><?php echo $layout['label']; ?></a></li><?php
|
@@ -427,29 +427,29 @@ class acfe_field_flexible_content{
|
|
427 |
}
|
428 |
|
429 |
/*
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
$div = apply_filters("acfe/flexible/layouts/div", $div, $layout, $field, $i, $value, $prefix);
|
454 |
$div = apply_filters("acfe/flexible/layouts/div/name={$name}", $div, $layout, $field, $i, $value, $prefix);
|
455 |
$div = apply_filters("acfe/flexible/layouts/div/key={$key}", $div, $layout, $field, $i, $value, $prefix);
|
@@ -470,10 +470,10 @@ class acfe_field_flexible_content{
|
|
470 |
$handle = apply_filters("acfe/flexible/layouts/handle/layout={$l_name}", $handle, $layout, $field, $i, $value, $prefix);
|
471 |
$handle = apply_filters("acfe/flexible/layouts/handle/name={$name}&layout={$l_name}", $handle, $layout, $field, $i, $value, $prefix);
|
472 |
$handle = apply_filters("acfe/flexible/layouts/handle/key={$key}&layout={$l_name}", $handle, $layout, $field, $i, $value, $prefix);
|
473 |
-
|
474 |
-
|
475 |
// This makes Flexible Content in ACFE Form buggy in a Flexible Content Preview
|
476 |
-
|
477 |
|
478 |
?>
|
479 |
<div <?php echo acf_esc_attrs($div); ?>>
|
@@ -520,8 +520,8 @@ class acfe_field_flexible_content{
|
|
520 |
|
521 |
</div>
|
522 |
<?php
|
523 |
-
|
524 |
-
|
525 |
|
526 |
/*
|
527 |
* Render Layout Fields
|
@@ -628,8 +628,8 @@ class acfe_field_flexible_content{
|
|
628 |
}
|
629 |
|
630 |
/*
|
631 |
-
|
632 |
-
|
633 |
function prepare_layout_editor($field){
|
634 |
|
635 |
$field['delay'] = 1;
|
62 |
}
|
63 |
|
64 |
/*
|
65 |
+
* Layout Settings
|
66 |
+
*/
|
67 |
function render_field_layouts_settings($field){
|
68 |
|
69 |
if($field['_name'] !== 'max' || stripos($field['name'], '[layouts]') === false)
|
104 |
}
|
105 |
|
106 |
/*
|
107 |
+
* Validate Field
|
108 |
+
*/
|
109 |
function validate_field($field){
|
110 |
|
111 |
// Defaults
|
161 |
}
|
162 |
|
163 |
/*
|
164 |
+
* Prepare Field
|
165 |
+
*/
|
166 |
function prepare_field($field){
|
167 |
|
168 |
// Vars
|
202 |
}
|
203 |
|
204 |
/*
|
205 |
+
* Load Fields
|
206 |
+
*/
|
207 |
function load_fields($fields, $field){
|
208 |
|
209 |
if(acfe_is_admin_screen())
|
226 |
}
|
227 |
|
228 |
/*
|
229 |
+
* Wrapper Attributes
|
230 |
+
*/
|
231 |
function wrapper_attributes($wrapper, $field){
|
232 |
|
233 |
$wrapper = apply_filters('acfe/flexible/wrapper_attributes', $wrapper, $field);
|
237 |
}
|
238 |
|
239 |
/*
|
240 |
+
* Render Field
|
241 |
+
*/
|
242 |
function render_field($field){
|
243 |
|
244 |
// Vars
|
259 |
|
260 |
// vars
|
261 |
$div = array(
|
262 |
+
'class' => 'acf-flexible-content',
|
263 |
+
'data-min' => $field['min'],
|
264 |
+
'data-max' => $field['max']
|
265 |
);
|
266 |
|
267 |
// empty
|
407 |
<?php foreach($layouts as $layout):
|
408 |
|
409 |
$atts = array(
|
410 |
+
'href' => '#',
|
411 |
+
'data-layout' => $layout['name'],
|
412 |
+
'data-min' => $layout['min'],
|
413 |
+
'data-max' => $layout['max'],
|
414 |
);
|
415 |
|
416 |
?><li><a <?php echo acf_esc_attrs($atts); ?>><?php echo $layout['label']; ?></a></li><?php
|
427 |
}
|
428 |
|
429 |
/*
|
430 |
+
* Render Layout
|
431 |
+
*/
|
432 |
+
function render_layout($field, $layout, $i, $value){
|
433 |
+
|
434 |
+
// vars
|
435 |
+
$id = ($i === 'acfcloneindex') ? 'acfcloneindex' : "row-$i";
|
436 |
+
$prefix = $field['name'] . '[' . $id . ']';
|
437 |
+
$name = $field['_name'];
|
438 |
+
$key = $field['key'];
|
439 |
+
$l_name = $layout['name'];
|
440 |
+
|
441 |
+
// div
|
442 |
+
$div = array(
|
443 |
+
'class' => 'layout',
|
444 |
+
'data-id' => $id,
|
445 |
+
'data-layout' => $layout['name']
|
446 |
+
);
|
447 |
+
|
448 |
+
// is clone?
|
449 |
+
if(!is_numeric($i)){
|
450 |
+
$div['class'] .= ' acf-clone';
|
451 |
+
}
|
452 |
+
|
453 |
$div = apply_filters("acfe/flexible/layouts/div", $div, $layout, $field, $i, $value, $prefix);
|
454 |
$div = apply_filters("acfe/flexible/layouts/div/name={$name}", $div, $layout, $field, $i, $value, $prefix);
|
455 |
$div = apply_filters("acfe/flexible/layouts/div/key={$key}", $div, $layout, $field, $i, $value, $prefix);
|
470 |
$handle = apply_filters("acfe/flexible/layouts/handle/layout={$l_name}", $handle, $layout, $field, $i, $value, $prefix);
|
471 |
$handle = apply_filters("acfe/flexible/layouts/handle/name={$name}&layout={$l_name}", $handle, $layout, $field, $i, $value, $prefix);
|
472 |
$handle = apply_filters("acfe/flexible/layouts/handle/key={$key}&layout={$l_name}", $handle, $layout, $field, $i, $value, $prefix);
|
473 |
+
|
474 |
+
// remove row
|
475 |
// This makes Flexible Content in ACFE Form buggy in a Flexible Content Preview
|
476 |
+
//reset_rows();
|
477 |
|
478 |
?>
|
479 |
<div <?php echo acf_esc_attrs($div); ?>>
|
520 |
|
521 |
</div>
|
522 |
<?php
|
523 |
+
|
524 |
+
}
|
525 |
|
526 |
/*
|
527 |
* Render Layout Fields
|
628 |
}
|
629 |
|
630 |
/*
|
631 |
+
* Prepare Layout Editor
|
632 |
+
*/
|
633 |
function prepare_layout_editor($field){
|
634 |
|
635 |
$field['delay'] = 1;
|
@@ -15,17 +15,17 @@ class acfe_field_forms extends acf_field{
|
|
15 |
$this->defaults = array(
|
16 |
'post_type' => array(),
|
17 |
'field_type' => 'checkbox',
|
18 |
-
'multiple'
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
'layout' => '',
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
);
|
30 |
|
31 |
parent::__construct();
|
@@ -49,60 +49,60 @@ class acfe_field_forms extends acf_field{
|
|
49 |
$field['default_value'] = acf_encode_choices($field['default_value'], false);
|
50 |
|
51 |
// Allow Form
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
|
64 |
// field_type
|
65 |
acf_render_field_setting($field, array(
|
66 |
-
'label'
|
67 |
-
'instructions'
|
68 |
-
'type'
|
69 |
-
'name'
|
70 |
-
'optgroup'
|
71 |
-
'choices'
|
72 |
-
'checkbox'
|
73 |
-
'radio'
|
74 |
-
'select'
|
75 |
)
|
76 |
));
|
77 |
|
78 |
// default_value
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
|
86 |
// return_format
|
87 |
acf_render_field_setting($field, array(
|
88 |
-
'label'
|
89 |
-
'instructions'
|
90 |
-
'type'
|
91 |
-
'name'
|
92 |
-
'choices'
|
93 |
-
'id' =>
|
94 |
-
'name' =>
|
95 |
),
|
96 |
-
'layout'
|
97 |
));
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
'conditions' => array(
|
107 |
array(
|
108 |
array(
|
@@ -119,14 +119,14 @@ class acfe_field_forms extends acf_field{
|
|
119 |
),
|
120 |
),
|
121 |
)
|
122 |
-
|
123 |
|
124 |
// placeholder
|
125 |
acf_render_field_setting($field, array(
|
126 |
-
'label'
|
127 |
-
'instructions'
|
128 |
-
'type'
|
129 |
-
'name'
|
130 |
'placeholder' => _x('Select', 'verb', 'acf'),
|
131 |
'conditional_logic' => array(
|
132 |
array(
|
@@ -159,12 +159,12 @@ class acfe_field_forms extends acf_field{
|
|
159 |
));
|
160 |
|
161 |
// Select: multiple
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
'conditions' => array(
|
169 |
array(
|
170 |
array(
|
@@ -174,15 +174,15 @@ class acfe_field_forms extends acf_field{
|
|
174 |
),
|
175 |
),
|
176 |
)
|
177 |
-
|
178 |
|
179 |
// Select: ui
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
'conditions' => array(
|
187 |
array(
|
188 |
array(
|
@@ -192,16 +192,16 @@ class acfe_field_forms extends acf_field{
|
|
192 |
),
|
193 |
),
|
194 |
)
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
'conditions' => array(
|
206 |
array(
|
207 |
array(
|
@@ -216,16 +216,16 @@ class acfe_field_forms extends acf_field{
|
|
216 |
),
|
217 |
),
|
218 |
)
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
'conditions' => array(
|
230 |
array(
|
231 |
array(
|
@@ -235,17 +235,17 @@ class acfe_field_forms extends acf_field{
|
|
235 |
),
|
236 |
),
|
237 |
)
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
'conditions' => array(
|
250 |
array(
|
251 |
array(
|
@@ -260,20 +260,20 @@ class acfe_field_forms extends acf_field{
|
|
260 |
),
|
261 |
),
|
262 |
)
|
263 |
-
|
264 |
|
265 |
// Checkbox: layout
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
'conditions'
|
277 |
array(
|
278 |
array(
|
279 |
'field' => 'field_type',
|
@@ -289,16 +289,16 @@ class acfe_field_forms extends acf_field{
|
|
289 |
),
|
290 |
),
|
291 |
)
|
292 |
-
|
293 |
|
294 |
// Checkbox: toggle
|
295 |
acf_render_field_setting($field, array(
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
'conditions'
|
302 |
array(
|
303 |
array(
|
304 |
'field' => 'field_type',
|
@@ -307,17 +307,17 @@ class acfe_field_forms extends acf_field{
|
|
307 |
),
|
308 |
),
|
309 |
)
|
310 |
-
|
311 |
|
312 |
// Checkbox: other_choice
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
'conditions'
|
321 |
array(
|
322 |
array(
|
323 |
'field' => 'field_type',
|
@@ -326,18 +326,18 @@ class acfe_field_forms extends acf_field{
|
|
326 |
),
|
327 |
),
|
328 |
)
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
'conditions'
|
341 |
array(
|
342 |
array(
|
343 |
'field' => 'field_type',
|
@@ -351,7 +351,7 @@ class acfe_field_forms extends acf_field{
|
|
351 |
),
|
352 |
),
|
353 |
)
|
354 |
-
|
355 |
|
356 |
}
|
357 |
|
@@ -369,7 +369,7 @@ class acfe_field_forms extends acf_field{
|
|
369 |
function format_value($value, $post_id, $field){
|
370 |
|
371 |
// Return: name
|
372 |
-
|
373 |
|
374 |
// array
|
375 |
if(acf_is_array($value)){
|
@@ -391,8 +391,8 @@ class acfe_field_forms extends acf_field{
|
|
391 |
|
392 |
}
|
393 |
|
394 |
-
|
395 |
-
|
396 |
|
397 |
}
|
398 |
|
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 |
'layout' => '',
|
26 |
+
'toggle' => 0,
|
27 |
+
'allow_custom' => 0,
|
28 |
+
'return_format' => 'name',
|
29 |
);
|
30 |
|
31 |
parent::__construct();
|
49 |
$field['default_value'] = acf_encode_choices($field['default_value'], false);
|
50 |
|
51 |
// Allow Form
|
52 |
+
acf_render_field_setting($field, array(
|
53 |
+
'label' => __('Allow Forms','acf'),
|
54 |
+
'instructions' => '',
|
55 |
+
'type' => 'select',
|
56 |
+
'name' => 'forms',
|
57 |
+
'choices' => acfe_get_pretty_forms(),
|
58 |
+
'multiple' => 1,
|
59 |
+
'ui' => 1,
|
60 |
+
'allow_null' => 1,
|
61 |
+
'placeholder' => __("All forms",'acf'),
|
62 |
+
));
|
63 |
|
64 |
// field_type
|
65 |
acf_render_field_setting($field, array(
|
66 |
+
'label' => __('Appearance','acf'),
|
67 |
+
'instructions' => __('Select the appearance of this field', 'acf'),
|
68 |
+
'type' => 'select',
|
69 |
+
'name' => 'field_type',
|
70 |
+
'optgroup' => true,
|
71 |
+
'choices' => array(
|
72 |
+
'checkbox' => __('Checkbox', 'acf'),
|
73 |
+
'radio' => __('Radio Buttons', 'acf'),
|
74 |
+
'select' => _x('Select', 'noun', 'acf')
|
75 |
)
|
76 |
));
|
77 |
|
78 |
// default_value
|
79 |
+
acf_render_field_setting($field, array(
|
80 |
+
'label' => __('Default Value','acf'),
|
81 |
+
'instructions' => __('Enter each default value on a new line','acf'),
|
82 |
+
'name' => 'default_value',
|
83 |
+
'type' => 'textarea',
|
84 |
+
));
|
85 |
|
86 |
// return_format
|
87 |
acf_render_field_setting($field, array(
|
88 |
+
'label' => __('Return Value', 'acf'),
|
89 |
+
'instructions' => '',
|
90 |
+
'type' => 'radio',
|
91 |
+
'name' => 'return_format',
|
92 |
+
'choices' => array(
|
93 |
+
'id' => __('Form ID', 'acfe'),
|
94 |
+
'name' => __('Form name', 'acfe')
|
95 |
),
|
96 |
+
'layout' => 'horizontal',
|
97 |
));
|
98 |
|
99 |
+
// Select + Radio: allow_null
|
100 |
+
acf_render_field_setting($field, array(
|
101 |
+
'label' => __('Allow Null?','acf'),
|
102 |
+
'instructions' => '',
|
103 |
+
'name' => 'allow_null',
|
104 |
+
'type' => 'true_false',
|
105 |
+
'ui' => 1,
|
106 |
'conditions' => array(
|
107 |
array(
|
108 |
array(
|
119 |
),
|
120 |
),
|
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(
|
159 |
));
|
160 |
|
161 |
// Select: multiple
|
162 |
+
acf_render_field_setting($field, array(
|
163 |
+
'label' => __('Select multiple values?','acf'),
|
164 |
+
'instructions' => '',
|
165 |
+
'name' => 'multiple',
|
166 |
+
'type' => 'true_false',
|
167 |
+
'ui' => 1,
|
168 |
'conditions' => array(
|
169 |
array(
|
170 |
array(
|
174 |
),
|
175 |
),
|
176 |
)
|
177 |
+
));
|
178 |
|
179 |
// Select: ui
|
180 |
+
acf_render_field_setting($field, array(
|
181 |
+
'label' => __('Stylised UI','acf'),
|
182 |
+
'instructions' => '',
|
183 |
+
'name' => 'ui',
|
184 |
+
'type' => 'true_false',
|
185 |
+
'ui' => 1,
|
186 |
'conditions' => array(
|
187 |
array(
|
188 |
array(
|
192 |
),
|
193 |
),
|
194 |
)
|
195 |
+
));
|
196 |
+
|
197 |
+
|
198 |
+
// Select: ajax
|
199 |
+
acf_render_field_setting($field, array(
|
200 |
+
'label' => __('Use AJAX to lazy load choices?','acf'),
|
201 |
+
'instructions' => '',
|
202 |
+
'name' => 'ajax',
|
203 |
+
'type' => 'true_false',
|
204 |
+
'ui' => 1,
|
205 |
'conditions' => array(
|
206 |
array(
|
207 |
array(
|
216 |
),
|
217 |
),
|
218 |
)
|
219 |
+
));
|
220 |
+
|
221 |
+
// Radio: other_choice
|
222 |
+
acf_render_field_setting($field, array(
|
223 |
+
'label' => __('Other','acf'),
|
224 |
+
'instructions' => '',
|
225 |
+
'name' => 'other_choice',
|
226 |
+
'type' => 'true_false',
|
227 |
+
'ui' => 1,
|
228 |
+
'message' => __("Add 'other' choice to allow for custom values", 'acf'),
|
229 |
'conditions' => array(
|
230 |
array(
|
231 |
array(
|
235 |
),
|
236 |
),
|
237 |
)
|
238 |
+
));
|
239 |
+
|
240 |
+
|
241 |
+
// Radio: save_other_choice
|
242 |
+
acf_render_field_setting($field, array(
|
243 |
+
'label' => __('Save Other','acf'),
|
244 |
+
'instructions' => '',
|
245 |
+
'name' => 'save_other_choice',
|
246 |
+
'type' => 'true_false',
|
247 |
+
'ui' => 1,
|
248 |
+
'message' => __("Save 'other' values to the field's choices", 'acf'),
|
249 |
'conditions' => array(
|
250 |
array(
|
251 |
array(
|
260 |
),
|
261 |
),
|
262 |
)
|
263 |
+
));
|
264 |
|
265 |
// Checkbox: layout
|
266 |
+
acf_render_field_setting($field, array(
|
267 |
+
'label' => __('Layout','acf'),
|
268 |
+
'instructions' => '',
|
269 |
+
'type' => 'radio',
|
270 |
+
'name' => 'layout',
|
271 |
+
'layout' => 'horizontal',
|
272 |
+
'choices' => array(
|
273 |
+
'vertical' => __("Vertical",'acf'),
|
274 |
+
'horizontal' => __("Horizontal",'acf')
|
275 |
+
),
|
276 |
+
'conditions' => array(
|
277 |
array(
|
278 |
array(
|
279 |
'field' => 'field_type',
|
289 |
),
|
290 |
),
|
291 |
)
|
292 |
+
));
|
293 |
|
294 |
// Checkbox: toggle
|
295 |
acf_render_field_setting($field, array(
|
296 |
+
'label' => __('Toggle','acf'),
|
297 |
+
'instructions' => __('Prepend an extra checkbox to toggle all choices','acf'),
|
298 |
+
'name' => 'toggle',
|
299 |
+
'type' => 'true_false',
|
300 |
+
'ui' => 1,
|
301 |
+
'conditions' => array(
|
302 |
array(
|
303 |
array(
|
304 |
'field' => 'field_type',
|
307 |
),
|
308 |
),
|
309 |
)
|
310 |
+
));
|
311 |
|
312 |
// Checkbox: other_choice
|
313 |
+
acf_render_field_setting($field, array(
|
314 |
+
'label' => __('Allow Custom','acf'),
|
315 |
+
'instructions' => '',
|
316 |
+
'name' => 'allow_custom',
|
317 |
+
'type' => 'true_false',
|
318 |
+
'ui' => 1,
|
319 |
+
'message' => __("Allow 'custom' values to be added", 'acf'),
|
320 |
+
'conditions' => array(
|
321 |
array(
|
322 |
array(
|
323 |
'field' => 'field_type',
|
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',
|
351 |
),
|
352 |
),
|
353 |
)
|
354 |
+
));
|
355 |
|
356 |
}
|
357 |
|
369 |
function format_value($value, $post_id, $field){
|
370 |
|
371 |
// Return: name
|
372 |
+
if($field['return_format'] === 'name'){
|
373 |
|
374 |
// array
|
375 |
if(acf_is_array($value)){
|
391 |
|
392 |
}
|
393 |
|
394 |
+
// return
|
395 |
+
return $value;
|
396 |
|
397 |
}
|
398 |
|
@@ -3,147 +3,174 @@
|
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
array(
|
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 |
-
'conditional_logic' => array(
|
50 |
-
array(
|
51 |
array(
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
56 |
)
|
57 |
-
)
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
'conditional_logic' => array(
|
68 |
-
array(
|
69 |
array(
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
74 |
)
|
75 |
-
)
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
'conditional_logic' => array(
|
92 |
-
array(
|
93 |
array(
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
98 |
)
|
99 |
-
)
|
100 |
-
));
|
101 |
-
|
102 |
-
}
|
103 |
-
|
104 |
-
add_filter('acfe/field_wrapper_attributes/type=group', 'acfe_field_group_wrapper', 10, 2);
|
105 |
-
function acfe_field_group_wrapper($wrapper, $field){
|
106 |
-
|
107 |
-
if(isset($field['acfe_group_modal']) && !empty($field['acfe_group_modal'])){
|
108 |
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
111 |
|
112 |
-
if(isset($field['
|
113 |
|
114 |
-
$wrapper['data-acfe-group-modal
|
|
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
-
$
|
|
|
|
|
|
|
|
|
121 |
|
122 |
}
|
123 |
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
-
$wrapper['
|
127 |
|
128 |
}
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
return $wrapper;
|
133 |
-
|
134 |
-
}
|
135 |
-
|
136 |
-
add_filter('acf/prepare_field/type=group', 'acfe_field_group_type_class', 99);
|
137 |
-
function acfe_field_group_type_class($field){
|
138 |
-
|
139 |
-
if(acf_maybe_get($field, 'acfe_seamless_style')){
|
140 |
|
141 |
-
$field
|
142 |
|
143 |
}
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
+
if(!class_exists('acfe_field_group_field')):
|
7 |
+
|
8 |
+
class acfe_field_group_field{
|
9 |
+
|
10 |
+
/*
|
11 |
+
* Construct
|
12 |
+
*/
|
13 |
+
function __construct(){
|
14 |
+
|
15 |
+
add_action('acf/render_field_settings/type=group', array($this, 'render_field_settings'));
|
16 |
+
add_filter('acfe/field_wrapper_attributes/type=group', array($this, 'field_wrapper_attributes'), 10, 2);
|
17 |
+
add_filter('acf/prepare_field/type=group', array($this, 'prepare_field'), 99);
|
18 |
+
|
19 |
+
}
|
20 |
|
21 |
+
/*
|
22 |
+
* Render Field Settings
|
23 |
+
*/
|
24 |
+
function render_field_settings($field){
|
25 |
+
|
26 |
+
acf_render_field_setting($field, array(
|
27 |
+
'label' => __('Seamless Style', 'acfe'),
|
28 |
+
'name' => 'acfe_seamless_style',
|
29 |
+
'key' => 'acfe_seamless_style',
|
30 |
+
'instructions' => __('Enable better CSS integration: remove borders and padding'),
|
31 |
+
'type' => 'true_false',
|
32 |
+
'message' => '',
|
33 |
+
'default_value' => false,
|
34 |
+
'ui' => true,
|
35 |
+
'conditional_logic' => array(
|
36 |
array(
|
37 |
+
array(
|
38 |
+
'field' => 'acfe_group_modal',
|
39 |
+
'operator' => '!=',
|
40 |
+
'value' => '1',
|
41 |
+
)
|
42 |
)
|
43 |
)
|
44 |
+
));
|
45 |
+
|
46 |
+
acf_render_field_setting($field, array(
|
47 |
+
'label' => __('Edition modal'),
|
48 |
+
'name' => 'acfe_group_modal',
|
49 |
+
'key' => 'acfe_group_modal',
|
50 |
+
'instructions' => __('Edit fields in a modal'),
|
51 |
+
'type' => 'true_false',
|
52 |
+
'message' => '',
|
53 |
+
'default_value' => false,
|
54 |
+
'ui' => true,
|
55 |
+
));
|
56 |
+
|
57 |
+
acf_render_field_setting($field, array(
|
58 |
+
'label' => __('Edition modal: Close button'),
|
59 |
+
'name' => 'acfe_group_modal_close',
|
60 |
+
'key' => 'acfe_group_modal_close',
|
61 |
+
'instructions' => __('Display close button'),
|
62 |
+
'type' => 'true_false',
|
63 |
+
'message' => '',
|
64 |
+
'default_value' => false,
|
65 |
+
'ui' => true,
|
66 |
+
'conditional_logic' => array(
|
|
|
|
|
67 |
array(
|
68 |
+
array(
|
69 |
+
'field' => 'acfe_group_modal',
|
70 |
+
'operator' => '==',
|
71 |
+
'value' => '1',
|
72 |
+
),
|
73 |
+
)
|
74 |
)
|
75 |
+
));
|
76 |
+
|
77 |
+
acf_render_field_setting($field, array(
|
78 |
+
'label' => __('Edition modal: Text button'),
|
79 |
+
'name' => 'acfe_group_modal_button',
|
80 |
+
'key' => 'acfe_group_modal_button',
|
81 |
+
'instructions' => __('Text displayed in the edition modal button'),
|
82 |
+
'type' => 'text',
|
83 |
+
'placeholder' => __('Edit', 'acf'),
|
84 |
+
'conditional_logic' => array(
|
|
|
|
|
85 |
array(
|
86 |
+
array(
|
87 |
+
'field' => 'acfe_group_modal',
|
88 |
+
'operator' => '==',
|
89 |
+
'value' => '1',
|
90 |
+
),
|
91 |
+
)
|
92 |
)
|
93 |
+
));
|
94 |
+
|
95 |
+
acf_render_field_setting($field, array(
|
96 |
+
'label' => __('Edition modal: Size'),
|
97 |
+
'name' => 'acfe_group_modal_size',
|
98 |
+
'key' => 'acfe_group_modal_size',
|
99 |
+
'instructions' => __('Choose the modal size'),
|
100 |
+
'type' => 'select',
|
101 |
+
'choices' => array(
|
102 |
+
'small' => 'Small',
|
103 |
+
'medium' => 'Medium',
|
104 |
+
'large' => 'Large',
|
105 |
+
'full' => 'Full',
|
106 |
+
),
|
107 |
+
'default_value' => 'large',
|
108 |
+
'conditional_logic' => array(
|
|
|
|
|
109 |
array(
|
110 |
+
array(
|
111 |
+
'field' => 'acfe_group_modal',
|
112 |
+
'operator' => '==',
|
113 |
+
'value' => '1',
|
114 |
+
),
|
115 |
+
)
|
116 |
)
|
117 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
+
}
|
120 |
+
|
121 |
+
/*
|
122 |
+
* Field Wrapper Attributes
|
123 |
+
*/
|
124 |
+
function field_wrapper_attributes($wrapper, $field){
|
125 |
|
126 |
+
if(isset($field['acfe_group_modal']) && !empty($field['acfe_group_modal'])){
|
127 |
|
128 |
+
$wrapper['data-acfe-group-modal'] = 1;
|
129 |
+
$wrapper['data-acfe-group-modal-button'] = __('Edit', 'acf');
|
130 |
|
131 |
+
if(isset($field['acfe_group_modal_button']) && !empty($field['acfe_group_modal_button'])){
|
132 |
+
|
133 |
+
$wrapper['data-acfe-group-modal-button'] = $field['acfe_group_modal_button'];
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
if(acf_maybe_get($field, 'acfe_group_modal_close')){
|
138 |
+
|
139 |
+
$wrapper['data-acfe-group-modal-close'] = $field['acfe_group_modal_close'];
|
140 |
+
|
141 |
+
}
|
142 |
|
143 |
+
if(acf_maybe_get($field, 'acfe_group_modal_size')){
|
144 |
+
|
145 |
+
$wrapper['data-acfe-group-modal-size'] = $field['acfe_group_modal_size'];
|
146 |
+
|
147 |
+
}
|
148 |
|
149 |
}
|
150 |
|
151 |
+
return $wrapper;
|
152 |
+
|
153 |
+
}
|
154 |
+
|
155 |
+
/*
|
156 |
+
* Prepare Field
|
157 |
+
*/
|
158 |
+
function prepare_field($field){
|
159 |
+
|
160 |
+
if(acf_maybe_get($field, 'acfe_seamless_style')){
|
161 |
|
162 |
+
$field['wrapper']['class'] .= ' acfe-seamless-style';
|
163 |
|
164 |
}
|
165 |
|
166 |
+
$field['wrapper']['class'] .= ' acfe-field-group-layout-' . $field['layout'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
+
return $field;
|
169 |
|
170 |
}
|
171 |
|
172 |
+
}
|
173 |
+
|
174 |
+
new acfe_field_group_field();
|
175 |
+
|
176 |
+
endif;
|
@@ -13,8 +13,8 @@ class acfe_field_hidden extends acf_field{
|
|
13 |
$this->label = __('Hidden', 'acfe');
|
14 |
$this->category = 'basic';
|
15 |
$this->defaults = array(
|
16 |
-
|
17 |
-
|
18 |
|
19 |
parent::__construct();
|
20 |
|
@@ -39,12 +39,12 @@ class acfe_field_hidden extends acf_field{
|
|
39 |
function render_field_settings($field){
|
40 |
|
41 |
// default_value
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
}
|
50 |
|
13 |
$this->label = __('Hidden', 'acfe');
|
14 |
$this->category = 'basic';
|
15 |
$this->defaults = array(
|
16 |
+
'default_value' => ''
|
17 |
+
);
|
18 |
|
19 |
parent::__construct();
|
20 |
|
39 |
function render_field_settings($field){
|
40 |
|
41 |
// default_value
|
42 |
+
acf_render_field_setting( $field, array(
|
43 |
+
'label' => __('Value','acf'),
|
44 |
+
'instructions' => __('Default value in the hidden input','acf'),
|
45 |
+
'type' => 'text',
|
46 |
+
'name' => 'default_value',
|
47 |
+
));
|
48 |
|
49 |
}
|
50 |
|
@@ -116,12 +116,19 @@ class acfe_field_image{
|
|
116 |
|
117 |
function update_value($value, $post_id, $field){
|
118 |
|
|
|
119 |
if(!acf_maybe_get($field, 'acfe_thumbnail'))
|
120 |
return $value;
|
|
|
|
|
|
|
|
|
121 |
|
|
|
122 |
if(acf_maybe_get_POST('wp-preview') == 'dopreview')
|
123 |
return $value;
|
124 |
-
|
|
|
125 |
$data = acf_get_post_id_info($post_id);
|
126 |
|
127 |
if($data['type'] !== 'post')
|
116 |
|
117 |
function update_value($value, $post_id, $field){
|
118 |
|
119 |
+
// Bail early if no thumbnail setting
|
120 |
if(!acf_maybe_get($field, 'acfe_thumbnail'))
|
121 |
return $value;
|
122 |
+
|
123 |
+
// Bail early if local meta
|
124 |
+
if(acfe_is_local_post_id($post_id))
|
125 |
+
return $value;
|
126 |
|
127 |
+
// Bail early if wp preview
|
128 |
if(acf_maybe_get_POST('wp-preview') == 'dopreview')
|
129 |
return $value;
|
130 |
+
|
131 |
+
// Bail early if not post
|
132 |
$data = acf_get_post_id_info($post_id);
|
133 |
|
134 |
if($data['type'] !== 'post')
|
@@ -22,108 +22,41 @@ class acfe_field_post_object{
|
|
22 |
|
23 |
// save custom value
|
24 |
acf_render_field_setting($field, array(
|
25 |
-
'label'
|
26 |
-
'instructions'
|
27 |
-
'name'
|
28 |
-
'type'
|
29 |
-
'ui'
|
30 |
-
'message'
|
31 |
));
|
32 |
|
33 |
// save post_type
|
34 |
acf_render_field_setting($field, array(
|
35 |
-
'label'
|
36 |
-
'instructions'
|
37 |
-
'name'
|
38 |
-
'type'
|
39 |
-
'field_type'
|
40 |
-
'conditional_logic'
|
41 |
-
'field'
|
42 |
-
'operator'
|
43 |
-
'value'
|
44 |
)
|
45 |
));
|
46 |
|
47 |
// save post_status
|
48 |
acf_render_field_setting($field, array(
|
49 |
-
'label'
|
50 |
-
'instructions'
|
51 |
-
'name'
|
52 |
-
'type'
|
53 |
-
'field_type'
|
54 |
-
'conditional_logic' => array(
|
55 |
-
'field' => 'save_custom',
|
56 |
-
'operator' => '==',
|
57 |
-
'value' => 1
|
58 |
-
),
|
59 |
-
'_append' => 'save_post_type'
|
60 |
-
));
|
61 |
-
|
62 |
-
ob_start();
|
63 |
-
?>
|
64 |
-
You can change the New Post creation arguments using the following hook:<br /><br />
|
65 |
-
<pre>
|
66 |
-
add_filter('acfe/fields/post_object/custom_save_args/name=my_post_object', 'my_acf_post_object_new_post_args', 10, 4);
|
67 |
-
function my_acf_post_object_new_post_args($args, $title, $post_id, $field){
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @array $args New Post arguments
|
71 |
-
* @string $title Post title
|
72 |
-
* @bool/string $post_id Current Post ID
|
73 |
-
* @array $field Field array
|
74 |
-
*/
|
75 |
-
|
76 |
-
// Add custom Post Content
|
77 |
-
// See wp_insert_post(): https://developer.wordpress.org/reference/functions/wp_insert_post/
|
78 |
-
$args['post_content'] = 'My post content';
|
79 |
-
|
80 |
-
// Return false to stop post creation
|
81 |
-
// return false;
|
82 |
-
|
83 |
-
// Return
|
84 |
-
return $args;
|
85 |
-
|
86 |
-
}
|
87 |
-
</pre>
|
88 |
-
<br />
|
89 |
-
You can trigger a custom action after the New Post creation using the following hook:<br /><br />
|
90 |
-
<pre>
|
91 |
-
add_action('acfe/fields/post_object/custom_save/name=my_post_object', 'my_acf_post_object_new_post_action', 10, 4);
|
92 |
-
function my_acf_post_object_new_post_action($new_post_id, $title, $post_id, $field){
|
93 |
-
|
94 |
-
/**
|
95 |
-
* @bool $new_post_id Newly created Post ID
|
96 |
-
* @string $title Post title
|
97 |
-
* @bool/string $post_id Current Post ID
|
98 |
-
* @array $field Field array
|
99 |
-
*/
|
100 |
-
|
101 |
-
// Do something...
|
102 |
-
// wp_mail();
|
103 |
-
|
104 |
-
}
|
105 |
-
</pre>
|
106 |
-
<?php
|
107 |
-
|
108 |
-
$message = ob_get_clean();
|
109 |
-
|
110 |
-
// ajax instructions
|
111 |
-
acf_render_field_setting($field, array(
|
112 |
-
'label' => __('New Post Instructions','acf'),
|
113 |
-
'instructions' => '',
|
114 |
-
'type' => 'message',
|
115 |
-
'name' => 'instructions',
|
116 |
-
'message' => $message,
|
117 |
-
'new_lines' => false,
|
118 |
'conditional_logic' => array(
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
)
|
125 |
-
)
|
126 |
-
)
|
127 |
));
|
128 |
|
129 |
}
|
@@ -142,8 +75,16 @@ function my_acf_post_object_new_post_action($new_post_id, $title, $post_id, $fie
|
|
142 |
|
143 |
function update_value($value, $post_id, $field){
|
144 |
|
145 |
-
//
|
146 |
-
if(empty($value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
return $value;
|
148 |
|
149 |
// New Post Args
|
@@ -152,7 +93,7 @@ function my_acf_post_object_new_post_action($new_post_id, $title, $post_id, $fie
|
|
152 |
|
153 |
$is_array = is_array($value) ? true : false;
|
154 |
|
155 |
-
$value =
|
156 |
|
157 |
foreach($value as $k => $v){
|
158 |
|
@@ -199,8 +140,9 @@ function my_acf_post_object_new_post_action($new_post_id, $title, $post_id, $fie
|
|
199 |
|
200 |
}
|
201 |
|
202 |
-
if(!$is_array
|
203 |
-
|
|
|
204 |
|
205 |
return $value;
|
206 |
|
22 |
|
23 |
// save custom value
|
24 |
acf_render_field_setting($field, array(
|
25 |
+
'label' => __('Allow & Save Custom value','acf'),
|
26 |
+
'instructions' => '',
|
27 |
+
'name' => 'save_custom',
|
28 |
+
'type' => 'true_false',
|
29 |
+
'ui' => 1,
|
30 |
+
'message' => __("Save 'custom' values as new post", 'acf'),
|
31 |
));
|
32 |
|
33 |
// save post_type
|
34 |
acf_render_field_setting($field, array(
|
35 |
+
'label' => __('New Post Arguments','acf'),
|
36 |
+
'instructions' => 'See available hooks in the <a href="https://www.acf-extended.com/features/fields/post-object#custom-value-hooks" target="_blank">documentation</a>.',
|
37 |
+
'name' => 'save_post_type',
|
38 |
+
'type' => 'acfe_post_types',
|
39 |
+
'field_type' => 'select',
|
40 |
+
'conditional_logic' => array(
|
41 |
+
'field' => 'save_custom',
|
42 |
+
'operator' => '==',
|
43 |
+
'value' => 1
|
44 |
)
|
45 |
));
|
46 |
|
47 |
// save post_status
|
48 |
acf_render_field_setting($field, array(
|
49 |
+
'label' => '',
|
50 |
+
'instructions' => '',
|
51 |
+
'name' => 'save_post_status',
|
52 |
+
'type' => 'acfe_post_statuses',
|
53 |
+
'field_type' => 'select',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
'conditional_logic' => array(
|
55 |
+
'field' => 'save_custom',
|
56 |
+
'operator' => '==',
|
57 |
+
'value' => 1
|
58 |
+
),
|
59 |
+
'_append' => 'save_post_type'
|
|
|
|
|
|
|
60 |
));
|
61 |
|
62 |
}
|
75 |
|
76 |
function update_value($value, $post_id, $field){
|
77 |
|
78 |
+
// Bail early if empty value
|
79 |
+
if(empty($value))
|
80 |
+
return $value;
|
81 |
+
|
82 |
+
// Bail early if no save custom setting
|
83 |
+
if(!acf_maybe_get($field, 'save_custom'))
|
84 |
+
return $value;
|
85 |
+
|
86 |
+
// Bail early if local meta
|
87 |
+
if(acfe_is_local_post_id($post_id))
|
88 |
return $value;
|
89 |
|
90 |
// New Post Args
|
93 |
|
94 |
$is_array = is_array($value) ? true : false;
|
95 |
|
96 |
+
$value = acf_get_array($value);
|
97 |
|
98 |
foreach($value as $k => $v){
|
99 |
|
140 |
|
141 |
}
|
142 |
|
143 |
+
if(!$is_array){
|
144 |
+
$value = acfe_unarray($value);
|
145 |
+
}
|
146 |
|
147 |
return $value;
|
148 |
|
@@ -16,17 +16,17 @@ class acfe_field_post_statuses extends acf_field{
|
|
16 |
'post_status' => array(),
|
17 |
'field_type' => 'checkbox',
|
18 |
'multiple' => 0,
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
'layout' => '',
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
);
|
31 |
|
32 |
parent::__construct();
|
@@ -39,26 +39,26 @@ class acfe_field_post_statuses extends acf_field{
|
|
39 |
$field['default_value'] = acf_encode_choices($field['default_value'], false);
|
40 |
|
41 |
// Allow Post Status
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
// field_type
|
55 |
acf_render_field_setting($field, array(
|
56 |
-
'label'
|
57 |
-
'instructions'
|
58 |
-
'type'
|
59 |
-
'name'
|
60 |
-
'optgroup'
|
61 |
-
'choices'
|
62 |
'checkbox' => __('Checkbox', 'acf'),
|
63 |
'radio' => __('Radio Buttons', 'acf'),
|
64 |
'select' => _x('Select', 'noun', 'acf')
|
@@ -66,34 +66,34 @@ class acfe_field_post_statuses extends acf_field{
|
|
66 |
));
|
67 |
|
68 |
// default_value
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
// return_format
|
77 |
acf_render_field_setting($field, array(
|
78 |
-
'label'
|
79 |
-
'instructions'
|
80 |
-
'type'
|
81 |
-
'name'
|
82 |
-
'choices'
|
83 |
-
'object'
|
84 |
-
'name'
|
85 |
),
|
86 |
-
'layout'
|
87 |
));
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
'conditions'
|
97 |
array(
|
98 |
array(
|
99 |
'field' => 'field_type',
|
@@ -109,16 +109,16 @@ class acfe_field_post_statuses extends acf_field{
|
|
109 |
),
|
110 |
),
|
111 |
)
|
112 |
-
|
113 |
|
114 |
// Select: multiple
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
'conditions'
|
122 |
array(
|
123 |
array(
|
124 |
'field' => 'field_type',
|
@@ -127,16 +127,16 @@ class acfe_field_post_statuses extends acf_field{
|
|
127 |
),
|
128 |
),
|
129 |
)
|
130 |
-
|
131 |
|
132 |
// Select: ui
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
'conditions'
|
140 |
array(
|
141 |
array(
|
142 |
'field' => 'field_type',
|
@@ -145,17 +145,17 @@ class acfe_field_post_statuses extends acf_field{
|
|
145 |
),
|
146 |
),
|
147 |
)
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
'conditions'
|
159 |
array(
|
160 |
array(
|
161 |
'field' => 'field_type',
|
@@ -169,15 +169,15 @@ class acfe_field_post_statuses extends acf_field{
|
|
169 |
),
|
170 |
),
|
171 |
)
|
172 |
-
|
173 |
|
174 |
// placeholder
|
175 |
acf_render_field_setting($field, array(
|
176 |
-
'label'
|
177 |
-
'instructions'
|
178 |
-
'type'
|
179 |
-
'name'
|
180 |
-
'placeholder'
|
181 |
'conditional_logic' => array(
|
182 |
array(
|
183 |
array(
|
@@ -213,11 +213,11 @@ class acfe_field_post_statuses extends acf_field{
|
|
213 |
|
214 |
// search placeholder
|
215 |
acf_render_field_setting($field, array(
|
216 |
-
'label'
|
217 |
-
'instructions'
|
218 |
-
'type'
|
219 |
-
'name'
|
220 |
-
'placeholder'
|
221 |
'conditional_logic' => array(
|
222 |
array(
|
223 |
array(
|
@@ -233,16 +233,16 @@ class acfe_field_post_statuses extends acf_field{
|
|
233 |
),
|
234 |
)
|
235 |
));
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
'conditions'
|
246 |
array(
|
247 |
array(
|
248 |
'field' => 'field_type',
|
@@ -251,19 +251,19 @@ class acfe_field_post_statuses extends acf_field{
|
|
251 |
),
|
252 |
),
|
253 |
)
|
254 |
-
|
255 |
|
256 |
// Checkbox: layout
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
'conditions' => array(
|
268 |
array(
|
269 |
array(
|
@@ -280,16 +280,16 @@ class acfe_field_post_statuses extends acf_field{
|
|
280 |
),
|
281 |
),
|
282 |
)
|
283 |
-
|
284 |
|
285 |
// Checkbox: toggle
|
286 |
acf_render_field_setting( $field, array(
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
'conditions'
|
293 |
array(
|
294 |
array(
|
295 |
'field' => 'field_type',
|
@@ -298,17 +298,17 @@ class acfe_field_post_statuses extends acf_field{
|
|
298 |
),
|
299 |
),
|
300 |
)
|
301 |
-
|
302 |
|
303 |
// Checkbox: other_choice
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
'conditions'
|
312 |
array(
|
313 |
array(
|
314 |
'field' => 'field_type',
|
@@ -329,7 +329,7 @@ class acfe_field_post_statuses extends acf_field{
|
|
329 |
),
|
330 |
)
|
331 |
)
|
332 |
-
|
333 |
|
334 |
}
|
335 |
|
@@ -379,7 +379,7 @@ class acfe_field_post_statuses extends acf_field{
|
|
379 |
function format_value($value, $post_id, $field){
|
380 |
|
381 |
// Return: object
|
382 |
-
|
383 |
|
384 |
// array
|
385 |
if(acf_is_array($value)){
|
@@ -399,10 +399,10 @@ class acfe_field_post_statuses extends acf_field{
|
|
399 |
|
400 |
}
|
401 |
|
402 |
-
|
403 |
|
404 |
-
|
405 |
-
|
406 |
|
407 |
}
|
408 |
|
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' => 'object',
|
30 |
);
|
31 |
|
32 |
parent::__construct();
|
39 |
$field['default_value'] = acf_encode_choices($field['default_value'], false);
|
40 |
|
41 |
// Allow Post Status
|
42 |
+
acf_render_field_setting( $field, array(
|
43 |
+
'label' => __('Allow Post Status','acf'),
|
44 |
+
'instructions' => '',
|
45 |
+
'type' => 'select',
|
46 |
+
'name' => 'post_status',
|
47 |
+
'choices' => acfe_get_pretty_post_statuses(),
|
48 |
+
'multiple' => 1,
|
49 |
+
'ui' => 1,
|
50 |
+
'allow_null' => 1,
|
51 |
+
'placeholder' => __("All post statuses",'acf'),
|
52 |
+
));
|
53 |
|
54 |
// field_type
|
55 |
acf_render_field_setting($field, array(
|
56 |
+
'label' => __('Appearance','acf'),
|
57 |
+
'instructions' => __('Select the appearance of this field', 'acf'),
|
58 |
+
'type' => 'select',
|
59 |
+
'name' => 'field_type',
|
60 |
+
'optgroup' => true,
|
61 |
+
'choices' => array(
|
62 |
'checkbox' => __('Checkbox', 'acf'),
|
63 |
'radio' => __('Radio Buttons', 'acf'),
|
64 |
'select' => _x('Select', 'noun', 'acf')
|
66 |
));
|
67 |
|
68 |
// default_value
|
69 |
+
acf_render_field_setting( $field, array(
|
70 |
+
'label' => __('Default Value','acf'),
|
71 |
+
'instructions' => __('Enter each default value on a new line','acf'),
|
72 |
+
'name' => 'default_value',
|
73 |
+
'type' => 'textarea',
|
74 |
+
));
|
75 |
|
76 |
// return_format
|
77 |
acf_render_field_setting($field, array(
|
78 |
+
'label' => __('Return Value', 'acf'),
|
79 |
+
'instructions' => '',
|
80 |
+
'type' => 'radio',
|
81 |
+
'name' => 'return_format',
|
82 |
+
'choices' => array(
|
83 |
+
'object' => __('Post status object', 'acfe'),
|
84 |
+
'name' => __('Post status name', 'acfe')
|
85 |
),
|
86 |
+
'layout' => 'horizontal',
|
87 |
));
|
88 |
|
89 |
+
// Select + Radio: allow_null
|
90 |
+
acf_render_field_setting( $field, array(
|
91 |
+
'label' => __('Allow Null?','acf'),
|
92 |
+
'instructions' => '',
|
93 |
+
'name' => 'allow_null',
|
94 |
+
'type' => 'true_false',
|
95 |
+
'ui' => 1,
|
96 |
+
'conditions' => array(
|
97 |
array(
|
98 |
array(
|
99 |
'field' => 'field_type',
|
109 |
),
|
110 |
),
|
111 |
)
|
112 |
+
));
|
113 |
|
114 |
// Select: multiple
|
115 |
+
acf_render_field_setting( $field, array(
|
116 |
+
'label' => __('Select multiple values?','acf'),
|
117 |
+
'instructions' => '',
|
118 |
+
'name' => 'multiple',
|
119 |
+
'type' => 'true_false',
|
120 |
+
'ui' => 1,
|
121 |
+
'conditions' => array(
|
122 |
array(
|
123 |
array(
|
124 |
'field' => 'field_type',
|
127 |
),
|
128 |
),
|
129 |
)
|
130 |
+
));
|
131 |
|
132 |
// Select: ui
|
133 |
+
acf_render_field_setting( $field, array(
|
134 |
+
'label' => __('Stylised UI','acf'),
|
135 |
+
'instructions' => '',
|
136 |
+
'name' => 'ui',
|
137 |
+
'type' => 'true_false',
|
138 |
+
'ui' => 1,
|
139 |
+
'conditions' => array(
|
140 |
array(
|
141 |
array(
|
142 |
'field' => 'field_type',
|
145 |
),
|
146 |
),
|
147 |
)
|
148 |
+
));
|
149 |
+
|
150 |
+
|
151 |
+
// Select: ajax
|
152 |
+
acf_render_field_setting( $field, array(
|
153 |
+
'label' => __('Use AJAX to lazy load choices?','acf'),
|
154 |
+
'instructions' => '',
|
155 |
+
'name' => 'ajax',
|
156 |
+
'type' => 'true_false',
|
157 |
+
'ui' => 1,
|
158 |
+
'conditions' => array(
|
159 |
array(
|
160 |
array(
|
161 |
'field' => 'field_type',
|
169 |
),
|
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(
|
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(
|
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(
|
248 |
'field' => 'field_type',
|
251 |
),
|
252 |
),
|
253 |
)
|
254 |
+
));
|
255 |
|
256 |
// Checkbox: layout
|
257 |
+
acf_render_field_setting( $field, array(
|
258 |
+
'label' => __('Layout','acf'),
|
259 |
+
'instructions' => '',
|
260 |
+
'type' => 'radio',
|
261 |
+
'name' => 'layout',
|
262 |
+
'layout' => 'horizontal',
|
263 |
+
'choices' => array(
|
264 |
+
'vertical' => __("Vertical",'acf'),
|
265 |
+
'horizontal' => __("Horizontal",'acf')
|
266 |
+
),
|
267 |
'conditions' => array(
|
268 |
array(
|
269 |
array(
|
280 |
),
|
281 |
),
|
282 |
)
|
283 |
+
));
|
284 |
|
285 |
// Checkbox: toggle
|
286 |
acf_render_field_setting( $field, array(
|
287 |
+
'label' => __('Toggle','acf'),
|
288 |
+
'instructions' => __('Prepend an extra checkbox to toggle all choices','acf'),
|
289 |
+
'name' => 'toggle',
|
290 |
+
'type' => 'true_false',
|
291 |
+
'ui' => 1,
|
292 |
+
'conditions' => array(
|
293 |
array(
|
294 |
array(
|
295 |
'field' => 'field_type',
|
298 |
),
|
299 |
),
|
300 |
)
|
301 |
+
));
|
302 |
|
303 |
// Checkbox: other_choice
|
304 |
+
acf_render_field_setting( $field, array(
|
305 |
+
'label' => __('Allow Custom','acf'),
|
306 |
+
'instructions' => '',
|
307 |
+
'name' => 'allow_custom',
|
308 |
+
'type' => 'true_false',
|
309 |
+
'ui' => 1,
|
310 |
+
'message' => __("Allow 'custom' values to be added", 'acf'),
|
311 |
+
'conditions' => array(
|
312 |
array(
|
313 |
array(
|
314 |
'field' => 'field_type',
|
329 |
),
|
330 |
)
|
331 |
)
|
332 |
+
));
|
333 |
|
334 |
}
|
335 |
|
379 |
function format_value($value, $post_id, $field){
|
380 |
|
381 |
// Return: object
|
382 |
+
if($field['return_format'] === 'object'){
|
383 |
|
384 |
// array
|
385 |
if(acf_is_array($value)){
|
399 |
|
400 |
}
|
401 |
|
402 |
+
}
|
403 |
|
404 |
+
// return
|
405 |
+
return $value;
|
406 |
|
407 |
}
|
408 |
|
@@ -16,17 +16,17 @@ class acfe_field_post_types extends acf_field{
|
|
16 |
'post_type' => array(),
|
17 |
'field_type' => 'checkbox',
|
18 |
'multiple' => 0,
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
'layout' => '',
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
);
|
31 |
|
32 |
parent::__construct();
|
@@ -39,61 +39,61 @@ class acfe_field_post_types extends acf_field{
|
|
39 |
$field['default_value'] = acf_encode_choices($field['default_value'], false);
|
40 |
|
41 |
// Allow Post Type
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
// field_type
|
55 |
acf_render_field_setting($field, array(
|
56 |
-
'label'
|
57 |
-
'instructions'
|
58 |
-
'type'
|
59 |
-
'name'
|
60 |
-
'optgroup'
|
61 |
-
'choices'
|
62 |
-
'checkbox'
|
63 |
-
'radio'
|
64 |
-
'select'
|
65 |
)
|
66 |
));
|
67 |
|
68 |
// default_value
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
// return_format
|
77 |
acf_render_field_setting($field, array(
|
78 |
-
'label'
|
79 |
-
'instructions'
|
80 |
-
'type'
|
81 |
-
'name'
|
82 |
-
'choices'
|
83 |
-
'object'
|
84 |
-
'name'
|
85 |
),
|
86 |
-
'layout'
|
87 |
));
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
'conditions'
|
97 |
array(
|
98 |
array(
|
99 |
'field' => 'field_type',
|
@@ -109,16 +109,16 @@ class acfe_field_post_types extends acf_field{
|
|
109 |
),
|
110 |
),
|
111 |
)
|
112 |
-
|
113 |
|
114 |
// Select: multiple
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
'conditions'
|
122 |
array(
|
123 |
array(
|
124 |
'field' => 'field_type',
|
@@ -127,16 +127,16 @@ class acfe_field_post_types extends acf_field{
|
|
127 |
),
|
128 |
),
|
129 |
)
|
130 |
-
|
131 |
|
132 |
// Select: ui
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
'conditions'
|
140 |
array(
|
141 |
array(
|
142 |
'field' => 'field_type',
|
@@ -145,17 +145,17 @@ class acfe_field_post_types extends acf_field{
|
|
145 |
),
|
146 |
),
|
147 |
)
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
'conditions'
|
159 |
array(
|
160 |
array(
|
161 |
'field' => 'field_type',
|
@@ -169,15 +169,15 @@ class acfe_field_post_types extends acf_field{
|
|
169 |
),
|
170 |
),
|
171 |
)
|
172 |
-
|
173 |
|
174 |
// placeholder
|
175 |
acf_render_field_setting($field, array(
|
176 |
-
'label'
|
177 |
-
'instructions'
|
178 |
-
'type'
|
179 |
-
'name'
|
180 |
-
'placeholder'
|
181 |
'conditional_logic' => array(
|
182 |
array(
|
183 |
array(
|
@@ -213,11 +213,11 @@ class acfe_field_post_types extends acf_field{
|
|
213 |
|
214 |
// search placeholder
|
215 |
acf_render_field_setting($field, array(
|
216 |
-
'label'
|
217 |
-
'instructions'
|
218 |
-
'type'
|
219 |
-
'name'
|
220 |
-
'placeholder'
|
221 |
'conditional_logic' => array(
|
222 |
array(
|
223 |
array(
|
@@ -233,16 +233,16 @@ class acfe_field_post_types extends acf_field{
|
|
233 |
),
|
234 |
)
|
235 |
));
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
'conditions'
|
246 |
array(
|
247 |
array(
|
248 |
'field' => 'field_type',
|
@@ -251,20 +251,20 @@ class acfe_field_post_types extends acf_field{
|
|
251 |
),
|
252 |
),
|
253 |
)
|
254 |
-
|
255 |
|
256 |
// Checkbox: layout
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
'conditions'
|
268 |
array(
|
269 |
array(
|
270 |
'field' => 'field_type',
|
@@ -280,16 +280,16 @@ class acfe_field_post_types extends acf_field{
|
|
280 |
),
|
281 |
),
|
282 |
)
|
283 |
-
|
284 |
|
285 |
// Checkbox: toggle
|
286 |
acf_render_field_setting( $field, array(
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
'conditions'
|
293 |
array(
|
294 |
array(
|
295 |
'field' => 'field_type',
|
@@ -298,16 +298,16 @@ class acfe_field_post_types extends acf_field{
|
|
298 |
),
|
299 |
),
|
300 |
)
|
301 |
-
|
302 |
|
303 |
// Checkbox: other_choice
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
'conditions' => array(
|
312 |
array(
|
313 |
array(
|
@@ -329,7 +329,7 @@ class acfe_field_post_types extends acf_field{
|
|
329 |
),
|
330 |
)
|
331 |
)
|
332 |
-
|
333 |
|
334 |
}
|
335 |
|
@@ -380,7 +380,7 @@ class acfe_field_post_types extends acf_field{
|
|
380 |
function format_value($value, $post_id, $field){
|
381 |
|
382 |
// Return: object
|
383 |
-
|
384 |
|
385 |
// array
|
386 |
if(acf_is_array($value)){
|
@@ -400,10 +400,10 @@ class acfe_field_post_types extends acf_field{
|
|
400 |
|
401 |
}
|
402 |
|
403 |
-
|
404 |
|
405 |
-
|
406 |
-
|
407 |
|
408 |
}
|
409 |
|
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' => 'object',
|
30 |
);
|
31 |
|
32 |
parent::__construct();
|
39 |
$field['default_value'] = acf_encode_choices($field['default_value'], false);
|
40 |
|
41 |
// Allow Post Type
|
42 |
+
acf_render_field_setting( $field, array(
|
43 |
+
'label' => __('Allow Post Type','acf'),
|
44 |
+
'instructions' => '',
|
45 |
+
'type' => 'select',
|
46 |
+
'name' => 'post_type',
|
47 |
+
'choices' => acf_get_pretty_post_types(),
|
48 |
+
'multiple' => 1,
|
49 |
+
'ui' => 1,
|
50 |
+
'allow_null' => 1,
|
51 |
+
'placeholder' => __("All post types",'acf'),
|
52 |
+
));
|
53 |
|
54 |
// field_type
|
55 |
acf_render_field_setting($field, array(
|
56 |
+
'label' => __('Appearance','acf'),
|
57 |
+
'instructions' => __('Select the appearance of this field', 'acf'),
|
58 |
+
'type' => 'select',
|
59 |
+
'name' => 'field_type',
|
60 |
+
'optgroup' => true,
|
61 |
+
'choices' => array(
|
62 |
+
'checkbox' => __('Checkbox', 'acf'),
|
63 |
+
'radio' => __('Radio Buttons', 'acf'),
|
64 |
+
'select' => _x('Select', 'noun', 'acf')
|
65 |
)
|
66 |
));
|
67 |
|
68 |
// default_value
|
69 |
+
acf_render_field_setting( $field, array(
|
70 |
+
'label' => __('Default Value','acf'),
|
71 |
+
'instructions' => __('Enter each default value on a new line','acf'),
|
72 |
+
'name' => 'default_value',
|
73 |
+
'type' => 'textarea',
|
74 |
+
));
|
75 |
|
76 |
// return_format
|
77 |
acf_render_field_setting($field, array(
|
78 |
+
'label' => __('Return Value', 'acf'),
|
79 |
+
'instructions' => '',
|
80 |
+
'type' => 'radio',
|
81 |
+
'name' => 'return_format',
|
82 |
+
'choices' => array(
|
83 |
+
'object' => __('Post type object', 'acfe'),
|
84 |
+
'name' => __('Post type name', 'acfe')
|
85 |
),
|
86 |
+
'layout' => 'horizontal',
|
87 |
));
|
88 |
|
89 |
+
// Select + Radio: allow_null
|
90 |
+
acf_render_field_setting( $field, array(
|
91 |
+
'label' => __('Allow Null?','acf'),
|
92 |
+
'instructions' => '',
|
93 |
+
'name' => 'allow_null',
|
94 |
+
'type' => 'true_false',
|
95 |
+
'ui' => 1,
|
96 |
+
'conditions' => array(
|
97 |
array(
|
98 |
array(
|
99 |
'field' => 'field_type',
|
109 |
),
|
110 |
),
|
111 |
)
|
112 |
+
));
|
113 |
|
114 |
// Select: multiple
|
115 |
+
acf_render_field_setting( $field, array(
|
116 |
+
'label' => __('Select multiple values?','acf'),
|
117 |
+
'instructions' => '',
|
118 |
+
'name' => 'multiple',
|
119 |
+
'type' => 'true_false',
|
120 |
+
'ui' => 1,
|
121 |
+
'conditions' => array(
|
122 |
array(
|
123 |
array(
|
124 |
'field' => 'field_type',
|
127 |
),
|
128 |
),
|
129 |
)
|
130 |
+
));
|
131 |
|
132 |
// Select: ui
|
133 |
+
acf_render_field_setting( $field, array(
|
134 |
+
'label' => __('Stylised UI','acf'),
|
135 |
+
'instructions' => '',
|
136 |
+
'name' => 'ui',
|
137 |
+
'type' => 'true_false',
|
138 |
+
'ui' => 1,
|
139 |
+
'conditions' => array(
|
140 |
array(
|
141 |
array(
|
142 |
'field' => 'field_type',
|
145 |
),
|
146 |
),
|
147 |
)
|
148 |
+
));
|
149 |
+
|
150 |
+
|
151 |
+
// Select: ajax
|
152 |
+
acf_render_field_setting( $field, array(
|
153 |
+
'label' => __('Use AJAX to lazy load choices?','acf'),
|
154 |
+
'instructions' => '',
|
155 |
+
'name' => 'ajax',
|
156 |
+
'type' => 'true_false',
|
157 |
+
'ui' => 1,
|
158 |
+
'conditions' => array(
|
159 |
array(
|
160 |
array(
|
161 |
'field' => 'field_type',
|
169 |
),
|
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(
|
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(
|
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(
|
248 |
'field' => 'field_type',
|
251 |
),
|
252 |
),
|
253 |
)
|
254 |
+
));
|
255 |
|
256 |
// Checkbox: layout
|
257 |
+
acf_render_field_setting( $field, array(
|
258 |
+
'label' => __('Layout','acf'),
|
259 |
+
'instructions' => '',
|
260 |
+
'type' => 'radio',
|
261 |
+
'name' => 'layout',
|
262 |
+
'layout' => 'horizontal',
|
263 |
+
'choices' => array(
|
264 |
+
'vertical' => __("Vertical",'acf'),
|
265 |
+
'horizontal' => __("Horizontal",'acf')
|
266 |
+
),
|
267 |
+
'conditions' => array(
|
268 |
array(
|
269 |
array(
|
270 |
'field' => 'field_type',
|
280 |
),
|
281 |
),
|
282 |
)
|
283 |
+
));
|
284 |
|
285 |
// Checkbox: toggle
|
286 |
acf_render_field_setting( $field, array(
|
287 |
+
'label' => __('Toggle','acf'),
|
288 |
+
'instructions' => __('Prepend an extra checkbox to toggle all choices','acf'),
|
289 |
+
'name' => 'toggle',
|
290 |
+
'type' => 'true_false',
|
291 |
+
'ui' => 1,
|
292 |
+
'conditions' => array(
|
293 |
array(
|
294 |
array(
|
295 |
'field' => 'field_type',
|
298 |
),
|
299 |
),
|
300 |
)
|
301 |
+
));
|
302 |
|
303 |
// Checkbox: other_choice
|
304 |
+
acf_render_field_setting( $field, array(
|
305 |
+
'label' => __('Allow Custom','acf'),
|
306 |
+
'instructions' => '',
|
307 |
+
'name' => 'allow_custom',
|
308 |
+
'type' => 'true_false',
|
309 |
+
'ui' => 1,
|
310 |
+
'message' => __("Allow 'custom' values to be added", 'acf'),
|
311 |
'conditions' => array(
|
312 |
array(
|
313 |
array(
|
329 |
),
|
330 |
)
|
331 |
)
|
332 |
+
));
|
333 |
|
334 |
}
|
335 |
|
380 |
function format_value($value, $post_id, $field){
|
381 |
|
382 |
// Return: object
|
383 |
+
if($field['return_format'] === 'object'){
|
384 |
|
385 |
// array
|
386 |
if(acf_is_array($value)){
|
400 |
|
401 |
}
|
402 |
|
403 |
+
}
|
404 |
|
405 |
+
// return
|
406 |
+
return $value;
|
407 |
|
408 |
}
|
409 |
|
@@ -8,7 +8,7 @@ class acfe_field_recaptcha extends acf_field{
|
|
8 |
function __construct(){
|
9 |
|
10 |
$this->name = 'acfe_recaptcha';
|
11 |
-
$this->label = __('
|
12 |
$this->category = 'jquery';
|
13 |
$this->defaults = array(
|
14 |
'required' => 0,
|
@@ -30,23 +30,23 @@ class acfe_field_recaptcha extends acf_field{
|
|
30 |
|
31 |
// Version
|
32 |
acf_render_field_setting($field, array(
|
33 |
-
'label'
|
34 |
-
'instructions'
|
35 |
-
'type'
|
36 |
-
'name'
|
37 |
-
'choices'
|
38 |
-
'v2'
|
39 |
-
'v3'
|
40 |
)
|
41 |
));
|
42 |
|
43 |
// V2 Theme
|
44 |
acf_render_field_setting($field, array(
|
45 |
-
'label'
|
46 |
-
'instructions'
|
47 |
-
'type'
|
48 |
-
'name'
|
49 |
-
'choices'
|
50 |
'light' => __('Light', 'acf'),
|
51 |
'dark' => __('Dark', 'acf'),
|
52 |
),
|
@@ -63,13 +63,13 @@ class acfe_field_recaptcha extends acf_field{
|
|
63 |
|
64 |
// V2 Size
|
65 |
acf_render_field_setting($field, array(
|
66 |
-
'label'
|
67 |
-
'instructions'
|
68 |
-
'type'
|
69 |
-
'name'
|
70 |
-
'choices'
|
71 |
-
'normal'
|
72 |
-
'compact'
|
73 |
),
|
74 |
'conditional_logic' => array(
|
75 |
array(
|
@@ -84,11 +84,11 @@ class acfe_field_recaptcha extends acf_field{
|
|
84 |
|
85 |
// V3 Hide Logo
|
86 |
acf_render_field_setting($field, array(
|
87 |
-
'label'
|
88 |
-
'instructions'
|
89 |
-
'type'
|
90 |
-
'name'
|
91 |
-
'ui'
|
92 |
'conditional_logic' => array(
|
93 |
array(
|
94 |
array(
|
@@ -102,18 +102,18 @@ class acfe_field_recaptcha extends acf_field{
|
|
102 |
|
103 |
// Site Key
|
104 |
acf_render_field_setting($field, array(
|
105 |
-
'label'
|
106 |
-
'instructions'
|
107 |
-
'type'
|
108 |
-
'name'
|
109 |
));
|
110 |
|
111 |
// Site Secret
|
112 |
acf_render_field_setting($field, array(
|
113 |
-
'label'
|
114 |
-
'instructions'
|
115 |
-
'type'
|
116 |
-
'name'
|
117 |
));
|
118 |
|
119 |
}
|
8 |
function __construct(){
|
9 |
|
10 |
$this->name = 'acfe_recaptcha';
|
11 |
+
$this->label = __('Google reCaptcha', 'acf');
|
12 |
$this->category = 'jquery';
|
13 |
$this->defaults = array(
|
14 |
'required' => 0,
|
30 |
|
31 |
// Version
|
32 |
acf_render_field_setting($field, array(
|
33 |
+
'label' => __('Version', 'acf'),
|
34 |
+
'instructions' => __('Select the reCaptcha version', 'acf'),
|
35 |
+
'type' => 'select',
|
36 |
+
'name' => 'version',
|
37 |
+
'choices' => array(
|
38 |
+
'v2' => __('reCaptcha V2', 'acf'),
|
39 |
+
'v3' => __('reCaptcha V3', 'acf'),
|
40 |
)
|
41 |
));
|
42 |
|
43 |
// V2 Theme
|
44 |
acf_render_field_setting($field, array(
|
45 |
+
'label' => __('Theme', 'acf'),
|
46 |
+
'instructions' => __('Select the reCaptcha theme', 'acf'),
|
47 |
+
'type' => 'select',
|
48 |
+
'name' => 'v2_theme',
|
49 |
+
'choices' => array(
|
50 |
'light' => __('Light', 'acf'),
|
51 |
'dark' => __('Dark', 'acf'),
|
52 |
),
|
63 |
|
64 |
// V2 Size
|
65 |
acf_render_field_setting($field, array(
|
66 |
+
'label' => __('Size', 'acf'),
|
67 |
+
'instructions' => __('Select the reCaptcha size', 'acf'),
|
68 |
+
'type' => 'select',
|
69 |
+
'name' => 'v2_size',
|
70 |
+
'choices' => array(
|
71 |
+
'normal' => __('Normal', 'acf'),
|
72 |
+
'compact' => __('Compact', 'acf'),
|
73 |
),
|
74 |
'conditional_logic' => array(
|
75 |
array(
|
84 |
|
85 |
// V3 Hide Logo
|
86 |
acf_render_field_setting($field, array(
|
87 |
+
'label' => __('Hide logo', 'acf'),
|
88 |
+
'instructions' => __('Hide the reCaptcha logo', 'acf'),
|
89 |
+
'type' => 'true_false',
|
90 |
+
'name' => 'v3_hide_logo',
|
91 |
+
'ui' => true,
|
92 |
'conditional_logic' => array(
|
93 |
array(
|
94 |
array(
|
102 |
|
103 |
// Site Key
|
104 |
acf_render_field_setting($field, array(
|
105 |
+
'label' => __('Site key', 'acf'),
|
106 |
+
'instructions' => __('Enter the site key. <a href="https://www.google.com/recaptcha/admin" target="_blank">reCaptcha API Admin</a>', 'acf'),
|
107 |
+
'type' => 'text',
|
108 |
+
'name' => 'site_key',
|
109 |
));
|
110 |
|
111 |
// Site Secret
|
112 |
acf_render_field_setting($field, array(
|
113 |
+
'label' => __('Secret key', 'acf'),
|
114 |
+
'instructions' => __('Enter the secret key. <a href="https://www.google.com/recaptcha/admin" target="_blank">reCaptcha API Admin</a>', 'acf'),
|
115 |
+
'type' => 'text',
|
116 |
+
'name' => 'secret_key',
|
117 |
));
|
118 |
|
119 |
}
|
@@ -7,7 +7,7 @@ if(!class_exists('acfe_field_select')):
|
|
7 |
|
8 |
class acfe_field_select{
|
9 |
|
10 |
-
|
11 |
|
12 |
// Actions
|
13 |
add_action('acf/render_field_settings/type=select', array($this, 'field_settings'));
|
@@ -18,40 +18,40 @@ class acfe_field_select{
|
|
18 |
|
19 |
add_action('current_screen', array($this, 'current_screen'));
|
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 |
function field_settings($field){
|
46 |
|
47 |
// allow custom
|
48 |
acf_render_field_setting($field, array(
|
49 |
-
'label'
|
50 |
-
'instructions'
|
51 |
-
'name'
|
52 |
-
'type'
|
53 |
-
'ui'
|
54 |
-
'message'
|
55 |
'conditional_logic' => array(
|
56 |
array(
|
57 |
array(
|
@@ -65,11 +65,11 @@ class acfe_field_select{
|
|
65 |
|
66 |
// placeholder
|
67 |
acf_render_field_setting($field, array(
|
68 |
-
'label'
|
69 |
-
'instructions'
|
70 |
-
'type'
|
71 |
-
'name'
|
72 |
-
'placeholder'
|
73 |
'conditional_logic' => array(
|
74 |
array(
|
75 |
array(
|
@@ -107,11 +107,11 @@ class acfe_field_select{
|
|
107 |
|
108 |
// search placeholder
|
109 |
acf_render_field_setting($field, array(
|
110 |
-
'label'
|
111 |
-
'instructions'
|
112 |
-
'type'
|
113 |
-
'name'
|
114 |
-
'placeholder'
|
115 |
'conditional_logic' => array(
|
116 |
array(
|
117 |
array(
|
@@ -149,42 +149,42 @@ class acfe_field_select{
|
|
149 |
|
150 |
if(!acf_maybe_get($field, 'ajax')){
|
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 |
|
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'));
|
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(
|
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(
|
107 |
|
108 |
// search placeholder
|
109 |
acf_render_field_setting($field, array(
|
110 |
+
'label' => __('Search Input Placeholder','acf'),
|
111 |
+
'instructions' => __('Appears within the search input','acf'),
|
112 |
+
'type' => 'text',
|
113 |
+
'name' => 'search_placeholder',
|
114 |
+
'placeholder' => '',
|
115 |
'conditional_logic' => array(
|
116 |
array(
|
117 |
array(
|
149 |
|
150 |
if(!acf_maybe_get($field, 'ajax')){
|
151 |
|
152 |
+
if(is_array($field['choices'])){
|
153 |
|
154 |
+
$found = false;
|
155 |
+
$found_array = array();
|
156 |
|
157 |
+
foreach($field['choices'] as $k => $choice){
|
158 |
|
159 |
+
if(is_string($choice)){
|
160 |
+
|
161 |
+
$choice = trim($choice);
|
162 |
+
|
163 |
+
if(strpos($choice, '##') === 0){
|
164 |
+
|
165 |
+
$choice = substr($choice, 2);
|
166 |
+
$choice = trim($choice);
|
167 |
+
|
168 |
+
$found = $choice;
|
169 |
+
$found_array[$choice] = array();
|
170 |
+
|
171 |
+
}elseif(!empty($found)){
|
172 |
+
|
173 |
+
$found_array[$found][$k] = $choice;
|
174 |
+
|
175 |
+
}
|
176 |
+
|
177 |
+
}
|
178 |
|
179 |
+
}
|
180 |
|
181 |
+
if(!empty($found_array)){
|
182 |
|
183 |
+
$field['choices'] = $found_array;
|
184 |
|
185 |
+
}
|
186 |
|
187 |
+
}
|
188 |
|
189 |
}
|
190 |
|
@@ -13,11 +13,11 @@ class acfe_field_slug extends acf_field{
|
|
13 |
$this->label = __('Slug', 'acfe');
|
14 |
$this->category = 'basic';
|
15 |
$this->defaults = array(
|
16 |
-
'default_value'
|
17 |
-
'maxlength'
|
18 |
-
'placeholder'
|
19 |
-
'prepend'
|
20 |
-
'append'
|
21 |
);
|
22 |
|
23 |
parent::__construct();
|
@@ -36,46 +36,46 @@ class acfe_field_slug extends acf_field{
|
|
36 |
|
37 |
// default_value
|
38 |
acf_render_field_setting($field, array(
|
39 |
-
'label'
|
40 |
-
'instructions'
|
41 |
-
'type'
|
42 |
-
'name'
|
43 |
));
|
44 |
|
45 |
|
46 |
// placeholder
|
47 |
acf_render_field_setting($field, array(
|
48 |
-
'label'
|
49 |
-
'instructions'
|
50 |
-
'type'
|
51 |
-
'name'
|
52 |
));
|
53 |
|
54 |
|
55 |
// prepend
|
56 |
acf_render_field_setting($field, array(
|
57 |
-
'label'
|
58 |
-
'instructions'
|
59 |
-
'type'
|
60 |
-
'name'
|
61 |
));
|
62 |
|
63 |
|
64 |
// append
|
65 |
acf_render_field_setting($field, array(
|
66 |
-
'label'
|
67 |
-
'instructions'
|
68 |
-
'type'
|
69 |
-
'name'
|
70 |
));
|
71 |
|
72 |
|
73 |
// maxlength
|
74 |
acf_render_field_setting($field, array(
|
75 |
-
'label'
|
76 |
-
'instructions'
|
77 |
-
'type'
|
78 |
-
'name'
|
79 |
));
|
80 |
|
81 |
}
|
13 |
$this->label = __('Slug', 'acfe');
|
14 |
$this->category = 'basic';
|
15 |
$this->defaults = array(
|
16 |
+
'default_value' => '',
|
17 |
+
'maxlength' => '',
|
18 |
+
'placeholder' => '',
|
19 |
+
'prepend' => '',
|
20 |
+
'append' => ''
|
21 |
);
|
22 |
|
23 |
parent::__construct();
|
36 |
|
37 |
// default_value
|
38 |
acf_render_field_setting($field, array(
|
39 |
+
'label' => __('Default Value','acf'),
|
40 |
+
'instructions' => __('Appears when creating a new post','acf'),
|
41 |
+
'type' => 'text',
|
42 |
+
'name' => 'default_value',
|
43 |
));
|
44 |
|
45 |
|
46 |
// placeholder
|
47 |
acf_render_field_setting($field, array(
|
48 |
+
'label' => __('Placeholder Text','acf'),
|
49 |
+
'instructions' => __('Appears within the input','acf'),
|
50 |
+
'type' => 'text',
|
51 |
+
'name' => 'placeholder',
|
52 |
));
|
53 |
|
54 |
|
55 |
// prepend
|
56 |
acf_render_field_setting($field, array(
|
57 |
+
'label' => __('Prepend','acf'),
|
58 |
+
'instructions' => __('Appears before the input','acf'),
|
59 |
+
'type' => 'text',
|
60 |
+
'name' => 'prepend',
|
61 |
));
|
62 |
|
63 |
|
64 |
// append
|
65 |
acf_render_field_setting($field, array(
|
66 |
+
'label' => __('Append','acf'),
|
67 |
+
'instructions' => __('Appears after the input','acf'),
|
68 |
+
'type' => 'text',
|
69 |
+
'name' => 'append',
|
70 |
));
|
71 |
|
72 |
|
73 |
// maxlength
|
74 |
acf_render_field_setting($field, array(
|
75 |
+
'label' => __('Character Limit','acf'),
|
76 |
+
'instructions' => __('Leave blank for no limit','acf'),
|
77 |
+
'type' => 'number',
|
78 |
+
'name' => 'maxlength',
|
79 |
));
|
80 |
|
81 |
}
|
@@ -16,17 +16,17 @@ class acfe_field_taxonomies extends acf_field{
|
|
16 |
'taxonomy' => array(),
|
17 |
'field_type' => 'checkbox',
|
18 |
'multiple' => 0,
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
'layout' => '',
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
);
|
31 |
|
32 |
parent::__construct();
|
@@ -39,61 +39,61 @@ class acfe_field_taxonomies extends acf_field{
|
|
39 |
$field['default_value'] = acf_encode_choices($field['default_value'], false);
|
40 |
|
41 |
// Allow Taxonomy
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
// field_type
|
55 |
acf_render_field_setting($field, array(
|
56 |
-
'label'
|
57 |
-
'instructions'
|
58 |
-
'type'
|
59 |
-
'name'
|
60 |
-
'optgroup'
|
61 |
-
'choices'
|
62 |
-
'checkbox'
|
63 |
-
'radio'
|
64 |
-
'select'
|
65 |
)
|
66 |
));
|
67 |
|
68 |
// default_value
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
// return_format
|
77 |
acf_render_field_setting($field, array(
|
78 |
-
'label'
|
79 |
-
'instructions'
|
80 |
-
'type'
|
81 |
-
'name'
|
82 |
-
'choices'
|
83 |
-
'object'
|
84 |
-
'name'
|
85 |
),
|
86 |
-
'layout'
|
87 |
));
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
'conditions'
|
97 |
array(
|
98 |
array(
|
99 |
'field' => 'field_type',
|
@@ -109,16 +109,16 @@ class acfe_field_taxonomies extends acf_field{
|
|
109 |
),
|
110 |
),
|
111 |
)
|
112 |
-
|
113 |
|
114 |
// Select: multiple
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
'conditions'
|
122 |
array(
|
123 |
array(
|
124 |
'field' => 'field_type',
|
@@ -127,16 +127,16 @@ class acfe_field_taxonomies extends acf_field{
|
|
127 |
),
|
128 |
),
|
129 |
)
|
130 |
-
|
131 |
|
132 |
// Select: ui
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
'conditions'
|
140 |
array(
|
141 |
array(
|
142 |
'field' => 'field_type',
|
@@ -145,17 +145,17 @@ class acfe_field_taxonomies extends acf_field{
|
|
145 |
),
|
146 |
),
|
147 |
)
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
'conditions'
|
159 |
array(
|
160 |
array(
|
161 |
'field' => 'field_type',
|
@@ -169,15 +169,15 @@ class acfe_field_taxonomies extends acf_field{
|
|
169 |
),
|
170 |
),
|
171 |
)
|
172 |
-
|
173 |
|
174 |
// placeholder
|
175 |
acf_render_field_setting($field, array(
|
176 |
-
'label'
|
177 |
-
'instructions'
|
178 |
-
'type'
|
179 |
-
'name'
|
180 |
-
'placeholder'
|
181 |
'conditional_logic' => array(
|
182 |
array(
|
183 |
array(
|
@@ -213,11 +213,11 @@ class acfe_field_taxonomies extends acf_field{
|
|
213 |
|
214 |
// search placeholder
|
215 |
acf_render_field_setting($field, array(
|
216 |
-
'label'
|
217 |
-
'instructions'
|
218 |
-
'type'
|
219 |
-
'name'
|
220 |
-
'placeholder'
|
221 |
'conditional_logic' => array(
|
222 |
array(
|
223 |
array(
|
@@ -233,16 +233,16 @@ class acfe_field_taxonomies extends acf_field{
|
|
233 |
),
|
234 |
)
|
235 |
));
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
'conditions'
|
246 |
array(
|
247 |
array(
|
248 |
'field' => 'field_type',
|
@@ -251,20 +251,20 @@ class acfe_field_taxonomies extends acf_field{
|
|
251 |
),
|
252 |
),
|
253 |
)
|
254 |
-
|
255 |
|
256 |
// Checkbox: layout
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
'conditions'
|
268 |
array(
|
269 |
array(
|
270 |
'field' => 'field_type',
|
@@ -280,16 +280,16 @@ class acfe_field_taxonomies extends acf_field{
|
|
280 |
),
|
281 |
),
|
282 |
)
|
283 |
-
|
284 |
|
285 |
// Checkbox: toggle
|
286 |
acf_render_field_setting( $field, array(
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
'conditions'
|
293 |
array(
|
294 |
array(
|
295 |
'field' => 'field_type',
|
@@ -298,17 +298,17 @@ class acfe_field_taxonomies extends acf_field{
|
|
298 |
),
|
299 |
),
|
300 |
)
|
301 |
-
|
302 |
|
303 |
// Checkbox: other_choice
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
'conditions'
|
312 |
array(
|
313 |
array(
|
314 |
'field' => 'field_type',
|
@@ -329,7 +329,7 @@ class acfe_field_taxonomies extends acf_field{
|
|
329 |
),
|
330 |
)
|
331 |
)
|
332 |
-
|
333 |
|
334 |
}
|
335 |
|
@@ -379,7 +379,7 @@ class acfe_field_taxonomies extends acf_field{
|
|
379 |
function format_value($value, $post_id, $field){
|
380 |
|
381 |
// Return: object
|
382 |
-
|
383 |
|
384 |
// array
|
385 |
if(acf_is_array($value)){
|
@@ -399,10 +399,10 @@ class acfe_field_taxonomies extends acf_field{
|
|
399 |
|
400 |
}
|
401 |
|
402 |
-
|
403 |
|
404 |
-
|
405 |
-
|
406 |
|
407 |
}
|
408 |
|
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' => 'object',
|
30 |
);
|
31 |
|
32 |
parent::__construct();
|
39 |
$field['default_value'] = acf_encode_choices($field['default_value'], false);
|
40 |
|
41 |
// Allow Taxonomy
|
42 |
+
acf_render_field_setting( $field, array(
|
43 |
+
'label' => __('Allow Taxonomy','acf'),
|
44 |
+
'instructions' => '',
|
45 |
+
'type' => 'select',
|
46 |
+
'name' => 'taxonomy',
|
47 |
+
'choices' => acf_get_taxonomy_labels(),
|
48 |
+
'multiple' => 1,
|
49 |
+
'ui' => 1,
|
50 |
+
'allow_null' => 1,
|
51 |
+
'placeholder' => __("All taxonomies",'acf'),
|
52 |
+
));
|
53 |
|
54 |
// field_type
|
55 |
acf_render_field_setting($field, array(
|
56 |
+
'label' => __('Appearance','acf'),
|
57 |
+
'instructions' => __('Select the appearance of this field', 'acf'),
|
58 |
+
'type' => 'select',
|
59 |
+
'name' => 'field_type',
|
60 |
+
'optgroup' => true,
|
61 |
+
'choices' => array(
|
62 |
+
'checkbox' => __('Checkbox', 'acf'),
|
63 |
+
'radio' => __('Radio Buttons', 'acf'),
|
64 |
+
'select' => _x('Select', 'noun', 'acf')
|
65 |
)
|
66 |
));
|
67 |
|
68 |
// default_value
|
69 |
+
acf_render_field_setting( $field, array(
|
70 |
+
'label' => __('Default Value','acf'),
|
71 |
+
'instructions' => __('Enter each default value on a new line','acf'),
|
72 |
+
'name' => 'default_value',
|
73 |
+
'type' => 'textarea',
|
74 |
+
));
|
75 |
|
76 |
// return_format
|
77 |
acf_render_field_setting($field, array(
|
78 |
+
'label' => __('Return Value', 'acf'),
|
79 |
+
'instructions' => '',
|
80 |
+
'type' => 'radio',
|
81 |
+
'name' => 'return_format',
|
82 |
+
'choices' => array(
|
83 |
+
'object' => __('Taxonomy object', 'acfe'),
|
84 |
+
'name' => __('Taxonomy name', 'acfe')
|
85 |
),
|
86 |
+
'layout' => 'horizontal',
|
87 |
));
|
88 |
|
89 |
+
// Select + Radio: allow_null
|
90 |
+
acf_render_field_setting( $field, array(
|
91 |
+
'label' => __('Allow Null?','acf'),
|
92 |
+
'instructions' => '',
|
93 |
+
'name' => 'allow_null',
|
94 |
+
'type' => 'true_false',
|
95 |
+
'ui' => 1,
|
96 |
+
'conditions' => array(
|
97 |
array(
|
98 |
array(
|
99 |
'field' => 'field_type',
|
109 |
),
|
110 |
),
|
111 |
)
|
112 |
+
));
|
113 |
|
114 |
// Select: multiple
|
115 |
+
acf_render_field_setting( $field, array(
|
116 |
+
'label' => __('Select multiple values?','acf'),
|
117 |
+
'instructions' => '',
|
118 |
+
'name' => 'multiple',
|
119 |
+
'type' => 'true_false',
|
120 |
+
'ui' => 1,
|
121 |
+
'conditions' => array(
|
122 |
array(
|
123 |
array(
|
124 |
'field' => 'field_type',
|
127 |
),
|
128 |
),
|
129 |
)
|
130 |
+
));
|
131 |
|
132 |
// Select: ui
|
133 |
+
acf_render_field_setting( $field, array(
|
134 |
+
'label' => __('Stylised UI','acf'),
|
135 |
+
'instructions' => '',
|
136 |
+
'name' => 'ui',
|
137 |
+
'type' => 'true_false',
|
138 |
+
'ui' => 1,
|
139 |
+
'conditions' => array(
|
140 |
array(
|
141 |
array(
|
142 |
'field' => 'field_type',
|
145 |
),
|
146 |
),
|
147 |
)
|
148 |
+
));
|
149 |
+
|
150 |
+
|
151 |
+
// Select: ajax
|
152 |
+
acf_render_field_setting( $field, array(
|
153 |
+
'label' => __('Use AJAX to lazy load choices?','acf'),
|
154 |
+
'instructions' => '',
|
155 |
+
'name' => 'ajax',
|
156 |
+
'type' => 'true_false',
|
157 |
+
'ui' => 1,
|
158 |
+
'conditions' => array(
|
159 |
array(
|
160 |
array(
|
161 |
'field' => 'field_type',
|
169 |
),
|
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(
|
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(
|
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(
|
248 |
'field' => 'field_type',
|
251 |
),
|
252 |
),
|
253 |
)
|
254 |
+
));
|
255 |
|
256 |
// Checkbox: layout
|
257 |
+
acf_render_field_setting( $field, array(
|
258 |
+
'label' => __('Layout','acf'),
|
259 |
+
'instructions' => '',
|
260 |
+
'type' => 'radio',
|
261 |
+
'name' => 'layout',
|
262 |
+
'layout' => 'horizontal',
|
263 |
+
'choices' => array(
|
264 |
+
'vertical' => __("Vertical",'acf'),
|
265 |
+
'horizontal' => __("Horizontal",'acf')
|
266 |
+
),
|
267 |
+
'conditions' => array(
|
268 |
array(
|
269 |
array(
|
270 |
'field' => 'field_type',
|
280 |
),
|
281 |
),
|
282 |
)
|
283 |
+
));
|
284 |
|
285 |
// Checkbox: toggle
|
286 |
acf_render_field_setting( $field, array(
|
287 |
+
'label' => __('Toggle','acf'),
|
288 |
+
'instructions' => __('Prepend an extra checkbox to toggle all choices','acf'),
|
289 |
+
'name' => 'toggle',
|
290 |
+
'type' => 'true_false',
|
291 |
+
'ui' => 1,
|
292 |
+
'conditions' => array(
|
293 |
array(
|
294 |
array(
|
295 |
'field' => 'field_type',
|
298 |
),
|
299 |
),
|
300 |
)
|
301 |
+
));
|
302 |
|
303 |
// Checkbox: other_choice
|
304 |
+
acf_render_field_setting( $field, array(
|
305 |
+
'label' => __('Allow Custom','acf'),
|
306 |
+
'instructions' => '',
|
307 |
+
'name' => 'allow_custom',
|
308 |
+
'type' => 'true_false',
|
309 |
+
'ui' => 1,
|
310 |
+
'message' => __("Allow 'custom' values to be added", 'acf'),
|
311 |
+
'conditions' => array(
|
312 |
array(
|
313 |
array(
|
314 |
'field' => 'field_type',
|
329 |
),
|
330 |
)
|
331 |
)
|
332 |
+
));
|
333 |
|
334 |
}
|
335 |
|
379 |
function format_value($value, $post_id, $field){
|
380 |
|
381 |
// Return: object
|
382 |
+
if($field['return_format'] === 'object'){
|
383 |
|
384 |
// array
|
385 |
if(acf_is_array($value)){
|
399 |
|
400 |
}
|
401 |
|
402 |
+
}
|
403 |
|
404 |
+
// return
|
405 |
+
return $value;
|
406 |
|
407 |
}
|
408 |
|
@@ -19,14 +19,14 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
19 |
'taxonomy' => array(),
|
20 |
'allow_terms' => array(),
|
21 |
'field_type' => 'checkbox',
|
22 |
-
'choices'
|
23 |
-
'default_value'
|
24 |
'return_format' => 'id',
|
25 |
-
'ui'
|
26 |
-
'multiple'
|
27 |
-
'allow_null'
|
28 |
-
'ajax'
|
29 |
-
'placeholder'
|
30 |
'layout' => '',
|
31 |
'toggle' => 0,
|
32 |
'load_terms' => 0,
|
@@ -67,10 +67,10 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
67 |
|
68 |
// defaults
|
69 |
$options = acf_parse_args($options, array(
|
70 |
-
'post_id'
|
71 |
-
's'
|
72 |
-
'field_key'
|
73 |
-
'paged'
|
74 |
'taxonomies' => array(),
|
75 |
'level' => false,
|
76 |
));
|
@@ -116,8 +116,8 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
116 |
|
117 |
// data
|
118 |
$data = array(
|
119 |
-
'text'
|
120 |
-
'children'
|
121 |
);
|
122 |
|
123 |
$done = array();
|
@@ -143,8 +143,8 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
143 |
$text .= $taxonomy->label;
|
144 |
|
145 |
$data['children'][] = array(
|
146 |
-
'id'
|
147 |
-
'text'
|
148 |
);
|
149 |
|
150 |
}
|
@@ -195,7 +195,7 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
195 |
|
196 |
// vars
|
197 |
$response = array(
|
198 |
-
'results'
|
199 |
);
|
200 |
|
201 |
// return
|
@@ -455,10 +455,10 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
455 |
|
456 |
// defaults
|
457 |
$options = acf_parse_args($options, array(
|
458 |
-
'post_id'
|
459 |
-
's'
|
460 |
-
'field_key'
|
461 |
-
'paged'
|
462 |
));
|
463 |
|
464 |
// load field
|
@@ -502,15 +502,15 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
502 |
foreach($terms as $taxonomy => $term){
|
503 |
|
504 |
$data = array(
|
505 |
-
'text'
|
506 |
-
'children'
|
507 |
);
|
508 |
|
509 |
foreach($term as $term_id => $term_name){
|
510 |
|
511 |
$data['children'][] = array(
|
512 |
-
'id'
|
513 |
-
'text'
|
514 |
);
|
515 |
|
516 |
}
|
@@ -529,7 +529,7 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
529 |
|
530 |
// vars
|
531 |
$response = array(
|
532 |
-
'results'
|
533 |
);
|
534 |
|
535 |
// return
|
@@ -602,10 +602,10 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
602 |
}
|
603 |
|
604 |
}
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
foreach($value as $v){
|
610 |
|
611 |
$found = false;
|
@@ -625,8 +625,8 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
625 |
$field['choices'][$v] = $v;
|
626 |
|
627 |
}
|
628 |
-
|
629 |
-
|
630 |
|
631 |
return $field;
|
632 |
|
@@ -639,15 +639,15 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
639 |
|
640 |
// Allow Taxonomy
|
641 |
acf_render_field_setting($field, array(
|
642 |
-
'label'
|
643 |
-
'instructions'
|
644 |
-
'type'
|
645 |
-
'name'
|
646 |
-
'choices'
|
647 |
-
'multiple'
|
648 |
-
'ui'
|
649 |
-
'allow_null'
|
650 |
-
'placeholder'
|
651 |
));
|
652 |
|
653 |
// Allow Terms
|
@@ -732,25 +732,25 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
732 |
}
|
733 |
|
734 |
acf_render_field_setting($field, array(
|
735 |
-
'label'
|
736 |
-
'instructions'
|
737 |
-
'type'
|
738 |
-
'name'
|
739 |
-
'choices'
|
740 |
-
'multiple'
|
741 |
-
'ui'
|
742 |
-
'allow_null'
|
743 |
'ajax' => 1,
|
744 |
-
'placeholder'
|
745 |
-
'ajax_action'
|
746 |
));
|
747 |
|
748 |
// Select: Terms level
|
749 |
acf_render_field_setting($field, array(
|
750 |
-
'label'
|
751 |
-
'instructions'
|
752 |
-
'name'
|
753 |
-
'type'
|
754 |
'append' => 'levels',
|
755 |
'min' => 0,
|
756 |
'placeholder' => __('All','acf'),
|
@@ -760,48 +760,48 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
760 |
|
761 |
// field_type
|
762 |
acf_render_field_setting($field, array(
|
763 |
-
'label'
|
764 |
-
'instructions'
|
765 |
-
'type'
|
766 |
-
'name'
|
767 |
-
'optgroup'
|
768 |
-
'choices'
|
769 |
-
'checkbox'
|
770 |
-
'radio'
|
771 |
-
'select'
|
772 |
)
|
773 |
));
|
774 |
|
775 |
// default_value
|
776 |
acf_render_field_setting($field, array(
|
777 |
-
'label'
|
778 |
-
'instructions'
|
779 |
-
'name'
|
780 |
-
'type'
|
781 |
));
|
782 |
|
783 |
// return_format
|
784 |
acf_render_field_setting($field, array(
|
785 |
-
'label'
|
786 |
-
'instructions'
|
787 |
-
'type'
|
788 |
-
'name'
|
789 |
-
'choices'
|
790 |
-
'object'
|
791 |
-
'name'
|
792 |
-
'id'
|
793 |
),
|
794 |
-
'layout'
|
795 |
));
|
796 |
|
797 |
// Select: ui
|
798 |
acf_render_field_setting( $field, array(
|
799 |
-
'label'
|
800 |
-
'instructions'
|
801 |
-
'name'
|
802 |
-
'type'
|
803 |
-
'ui'
|
804 |
-
'conditions'
|
805 |
array(
|
806 |
array(
|
807 |
'field' => 'field_type',
|
@@ -814,12 +814,12 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
814 |
|
815 |
// Select: allow_null
|
816 |
acf_render_field_setting($field, array(
|
817 |
-
'label'
|
818 |
-
'instructions'
|
819 |
-
'name'
|
820 |
-
'type'
|
821 |
-
'ui'
|
822 |
-
'conditions'
|
823 |
array(
|
824 |
array(
|
825 |
'field' => 'field_type',
|
@@ -839,11 +839,11 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
839 |
|
840 |
// placeholder
|
841 |
acf_render_field_setting($field, array(
|
842 |
-
'label'
|
843 |
-
'instructions'
|
844 |
-
'type'
|
845 |
-
'name'
|
846 |
-
'placeholder'
|
847 |
'conditional_logic' => array(
|
848 |
array(
|
849 |
array(
|
@@ -876,12 +876,12 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
876 |
|
877 |
// Select: multiple
|
878 |
acf_render_field_setting( $field, array(
|
879 |
-
'label'
|
880 |
-
'instructions'
|
881 |
-
'name'
|
882 |
-
'type'
|
883 |
-
'ui'
|
884 |
-
'conditions'
|
885 |
array(
|
886 |
array(
|
887 |
'field' => 'field_type',
|
@@ -894,12 +894,12 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
894 |
|
895 |
// Select: ajax
|
896 |
acf_render_field_setting( $field, array(
|
897 |
-
'label'
|
898 |
-
'instructions'
|
899 |
-
'name'
|
900 |
-
'type'
|
901 |
-
'ui'
|
902 |
-
'conditions'
|
903 |
array(
|
904 |
array(
|
905 |
'field' => 'field_type',
|
@@ -917,16 +917,16 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
917 |
|
918 |
// Checkbox: layout
|
919 |
acf_render_field_setting( $field, array(
|
920 |
-
'label'
|
921 |
-
'instructions'
|
922 |
-
'type'
|
923 |
-
'name'
|
924 |
-
'layout'
|
925 |
-
'choices'
|
926 |
-
'vertical'
|
927 |
-
'horizontal'
|
928 |
),
|
929 |
-
'conditions'
|
930 |
array(
|
931 |
array(
|
932 |
'field' => 'field_type',
|
@@ -946,12 +946,12 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
946 |
|
947 |
// Checkbox: toggle
|
948 |
acf_render_field_setting( $field, array(
|
949 |
-
'label'
|
950 |
-
'instructions'
|
951 |
-
'name'
|
952 |
-
'type'
|
953 |
-
'ui'
|
954 |
-
'conditions'
|
955 |
array(
|
956 |
array(
|
957 |
'field' => 'field_type',
|
@@ -964,20 +964,20 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
964 |
|
965 |
// save_terms
|
966 |
acf_render_field_setting( $field, array(
|
967 |
-
'label'
|
968 |
-
'instructions'
|
969 |
-
'name'
|
970 |
-
'type'
|
971 |
-
'ui'
|
972 |
));
|
973 |
|
974 |
// load_terms
|
975 |
acf_render_field_setting( $field, array(
|
976 |
-
'label'
|
977 |
-
'instructions'
|
978 |
-
'name'
|
979 |
-
'type'
|
980 |
-
'ui'
|
981 |
));
|
982 |
|
983 |
}
|
19 |
'taxonomy' => array(),
|
20 |
'allow_terms' => array(),
|
21 |
'field_type' => 'checkbox',
|
22 |
+
'choices' => array(),
|
23 |
+
'default_value' => '',
|
24 |
'return_format' => 'id',
|
25 |
+
'ui' => 0,
|
26 |
+
'multiple' => 0,
|
27 |
+
'allow_null' => 0,
|
28 |
+
'ajax' => 0,
|
29 |
+
'placeholder' => '',
|
30 |
'layout' => '',
|
31 |
'toggle' => 0,
|
32 |
'load_terms' => 0,
|
67 |
|
68 |
// defaults
|
69 |
$options = acf_parse_args($options, array(
|
70 |
+
'post_id' => 0,
|
71 |
+
's' => '',
|
72 |
+
'field_key' => '',
|
73 |
+
'paged' => 1,
|
74 |
'taxonomies' => array(),
|
75 |
'level' => false,
|
76 |
));
|
116 |
|
117 |
// data
|
118 |
$data = array(
|
119 |
+
'text' => $group_title,
|
120 |
+
'children' => array()
|
121 |
);
|
122 |
|
123 |
$done = array();
|
143 |
$text .= $taxonomy->label;
|
144 |
|
145 |
$data['children'][] = array(
|
146 |
+
'id' => $id,
|
147 |
+
'text' => '(' . $text . ')'
|
148 |
);
|
149 |
|
150 |
}
|
195 |
|
196 |
// vars
|
197 |
$response = array(
|
198 |
+
'results' => $results
|
199 |
);
|
200 |
|
201 |
// return
|
455 |
|
456 |
// defaults
|
457 |
$options = acf_parse_args($options, array(
|
458 |
+
'post_id' => 0,
|
459 |
+
's' => '',
|
460 |
+
'field_key' => '',
|
461 |
+
'paged' => 0
|
462 |
));
|
463 |
|
464 |
// load field
|
502 |
foreach($terms as $taxonomy => $term){
|
503 |
|
504 |
$data = array(
|
505 |
+
'text' => $taxonomy,
|
506 |
+
'children' => array()
|
507 |
);
|
508 |
|
509 |
foreach($term as $term_id => $term_name){
|
510 |
|
511 |
$data['children'][] = array(
|
512 |
+
'id' => $term_id,
|
513 |
+
'text' => $term_name
|
514 |
);
|
515 |
|
516 |
}
|
529 |
|
530 |
// vars
|
531 |
$response = array(
|
532 |
+
'results' => $results
|
533 |
);
|
534 |
|
535 |
// return
|
602 |
}
|
603 |
|
604 |
}
|
605 |
+
|
606 |
+
// Allow Custom
|
607 |
+
if($allow_custom){
|
608 |
+
|
609 |
foreach($value as $v){
|
610 |
|
611 |
$found = false;
|
625 |
$field['choices'][$v] = $v;
|
626 |
|
627 |
}
|
628 |
+
|
629 |
+
}
|
630 |
|
631 |
return $field;
|
632 |
|
639 |
|
640 |
// Allow Taxonomy
|
641 |
acf_render_field_setting($field, array(
|
642 |
+
'label' => __('Allow Taxonomy','acf'),
|
643 |
+
'instructions' => '',
|
644 |
+
'type' => 'select',
|
645 |
+
'name' => 'taxonomy',
|
646 |
+
'choices' => acf_get_taxonomy_labels(),
|
647 |
+
'multiple' => 1,
|
648 |
+
'ui' => 1,
|
649 |
+
'allow_null' => 1,
|
650 |
+
'placeholder' => __("All taxonomies",'acf'),
|
651 |
));
|
652 |
|
653 |
// Allow Terms
|
732 |
}
|
733 |
|
734 |
acf_render_field_setting($field, array(
|
735 |
+
'label' => __('Allow Terms','acf'),
|
736 |
+
'instructions' => '',
|
737 |
+
'type' => 'select',
|
738 |
+
'name' => 'allow_terms',
|
739 |
+
'choices' => $choices,
|
740 |
+
'multiple' => 1,
|
741 |
+
'ui' => 1,
|
742 |
+
'allow_null' => 1,
|
743 |
'ajax' => 1,
|
744 |
+
'placeholder' => __("All terms",'acf'),
|
745 |
+
'ajax_action' => 'acfe/fields/taxonomy_terms/allow_query',
|
746 |
));
|
747 |
|
748 |
// Select: Terms level
|
749 |
acf_render_field_setting($field, array(
|
750 |
+
'label' => __('Terms_level','acf'),
|
751 |
+
'instructions' => '',
|
752 |
+
'name' => 'allow_level',
|
753 |
+
'type' => 'number',
|
754 |
'append' => 'levels',
|
755 |
'min' => 0,
|
756 |
'placeholder' => __('All','acf'),
|
760 |
|
761 |
// field_type
|
762 |
acf_render_field_setting($field, array(
|
763 |
+
'label' => __('Appearance','acf'),
|
764 |
+
'instructions' => __('Select the appearance of this field', 'acf'),
|
765 |
+
'type' => 'select',
|
766 |
+
'name' => 'field_type',
|
767 |
+
'optgroup' => true,
|
768 |
+
'choices' => array(
|
769 |
+
'checkbox' => __('Checkbox', 'acf'),
|
770 |
+
'radio' => __('Radio Buttons', 'acf'),
|
771 |
+
'select' => _x('Select', 'noun', 'acf')
|
772 |
)
|
773 |
));
|
774 |
|
775 |
// default_value
|
776 |
acf_render_field_setting($field, array(
|
777 |
+
'label' => __('Default Value','acf'),
|
778 |
+
'instructions' => __('Enter each default value on a new line','acf'),
|
779 |
+
'name' => 'default_value',
|
780 |
+
'type' => 'textarea',
|
781 |
));
|
782 |
|
783 |
// return_format
|
784 |
acf_render_field_setting($field, array(
|
785 |
+
'label' => __('Return Value', 'acf'),
|
786 |
+
'instructions' => '',
|
787 |
+
'type' => 'radio',
|
788 |
+
'name' => 'return_format',
|
789 |
+
'choices' => array(
|
790 |
+
'object' => __('Term object', 'acfe'),
|
791 |
+
'name' => __('Term name', 'acfe'),
|
792 |
+
'id' => __('Term ID', 'acfe'),
|
793 |
),
|
794 |
+
'layout' => 'horizontal',
|
795 |
));
|
796 |
|
797 |
// Select: ui
|
798 |
acf_render_field_setting( $field, array(
|
799 |
+
'label' => __('Stylised UI','acf'),
|
800 |
+
'instructions' => '',
|
801 |
+
'name' => 'ui',
|
802 |
+
'type' => 'true_false',
|
803 |
+
'ui' => 1,
|
804 |
+
'conditions' => array(
|
805 |
array(
|
806 |
array(
|
807 |
'field' => 'field_type',
|
814 |
|
815 |
// Select: allow_null
|
816 |
acf_render_field_setting($field, array(
|
817 |
+
'label' => __('Allow Null?','acf'),
|
818 |
+
'instructions' => '',
|
819 |
+
'name' => 'allow_null',
|
820 |
+
'type' => 'true_false',
|
821 |
+
'ui' => 1,
|
822 |
+
'conditions' => array(
|
823 |
array(
|
824 |
array(
|
825 |
'field' => 'field_type',
|
839 |
|
840 |
// placeholder
|
841 |
acf_render_field_setting($field, array(
|
842 |
+
'label' => __('Placeholder Text','acf'),
|
843 |
+
'instructions' => __('Appears within the input','acf'),
|
844 |
+
'type' => 'text',
|
845 |
+
'name' => 'placeholder',
|
846 |
+
'placeholder' => _x('Select', 'verb', 'acf'),
|
847 |
'conditional_logic' => array(
|
848 |
array(
|
849 |
array(
|
876 |
|
877 |
// Select: multiple
|
878 |
acf_render_field_setting( $field, array(
|
879 |
+
'label' => __('Select multiple values?','acf'),
|
880 |
+
'instructions' => '',
|
881 |
+
'name' => 'multiple',
|
882 |
+
'type' => 'true_false',
|
883 |
+
'ui' => 1,
|
884 |
+
'conditions' => array(
|
885 |
array(
|
886 |
array(
|
887 |
'field' => 'field_type',
|
894 |
|
895 |
// Select: ajax
|
896 |
acf_render_field_setting( $field, array(
|
897 |
+
'label' => __('Use AJAX to lazy load choices?','acf'),
|
898 |
+
'instructions' => '',
|
899 |
+
'name' => 'ajax',
|
900 |
+
'type' => 'true_false',
|
901 |
+
'ui' => 1,
|
902 |
+
'conditions' => array(
|
903 |
array(
|
904 |
array(
|
905 |
'field' => 'field_type',
|
917 |
|
918 |
// Checkbox: layout
|
919 |
acf_render_field_setting( $field, array(
|
920 |
+
'label' => __('Layout','acf'),
|
921 |
+
'instructions' => '',
|
922 |
+
'type' => 'radio',
|
923 |
+
'name' => 'layout',
|
924 |
+
'layout' => 'horizontal',
|
925 |
+
'choices' => array(
|
926 |
+
'vertical' => __("Vertical",'acf'),
|
927 |
+
'horizontal' => __("Horizontal",'acf')
|
928 |
),
|
929 |
+
'conditions' => array(
|
930 |
array(
|
931 |
array(
|
932 |
'field' => 'field_type',
|
946 |
|
947 |
// Checkbox: toggle
|
948 |
acf_render_field_setting( $field, array(
|
949 |
+
'label' => __('Toggle','acf'),
|
950 |
+
'instructions' => __('Prepend an extra checkbox to toggle all choices','acf'),
|
951 |
+
'name' => 'toggle',
|
952 |
+
'type' => 'true_false',
|
953 |
+
'ui' => 1,
|
954 |
+
'conditions' => array(
|
955 |
array(
|
956 |
array(
|
957 |
'field' => 'field_type',
|
964 |
|
965 |
// save_terms
|
966 |
acf_render_field_setting( $field, array(
|
967 |
+
'label' => __('Save Terms','acf'),
|
968 |
+
'instructions' => __('Connect selected terms to the post','acf'),
|
969 |
+
'name' => 'save_terms',
|
970 |
+
'type' => 'true_false',
|
971 |
+
'ui' => 1,
|
972 |
));
|
973 |
|
974 |
// load_terms
|
975 |
acf_render_field_setting( $field, array(
|
976 |
+
'label' => __('Load Terms','acf'),
|
977 |
+
'instructions' => __('Load value from posts terms','acf'),
|
978 |
+
'name' => 'load_terms',
|
979 |
+
'type' => 'true_false',
|
980 |
+
'ui' => 1,
|
981 |
));
|
982 |
|
983 |
}
|
@@ -12,8 +12,8 @@ function acfe_field_textarea_settings($field){
|
|
12 |
'name' => 'acfe_textarea_code',
|
13 |
'key' => 'acfe_textarea_code',
|
14 |
'instructions' => __('Switch font family to monospace and allow tab indent. For a more advanced code editor, please use the <code>Code Editor</code> field type'),
|
15 |
-
'type'
|
16 |
-
'ui'
|
17 |
));
|
18 |
|
19 |
}
|
12 |
'name' => 'acfe_textarea_code',
|
13 |
'key' => 'acfe_textarea_code',
|
14 |
'instructions' => __('Switch font family to monospace and allow tab indent. For a more advanced code editor, please use the <code>Code Editor</code> field type'),
|
15 |
+
'type' => 'true_false',
|
16 |
+
'ui' => 1,
|
17 |
));
|
18 |
|
19 |
}
|
@@ -16,16 +16,16 @@ class acfe_field_user_roles extends acf_field{
|
|
16 |
'user_role' => array(),
|
17 |
'field_type' => 'checkbox',
|
18 |
'multiple' => 0,
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
'layout' => '',
|
27 |
-
|
28 |
-
|
29 |
);
|
30 |
|
31 |
parent::__construct();
|
@@ -38,48 +38,48 @@ class acfe_field_user_roles extends acf_field{
|
|
38 |
$field['default_value'] = acf_encode_choices($field['default_value'], false);
|
39 |
|
40 |
// Allow User Role
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
// field_type
|
54 |
acf_render_field_setting($field, array(
|
55 |
-
'label'
|
56 |
-
'instructions'
|
57 |
-
'type'
|
58 |
-
'name'
|
59 |
-
'optgroup'
|
60 |
-
'choices'
|
61 |
-
'checkbox'
|
62 |
-
'radio'
|
63 |
-
'select'
|
64 |
)
|
65 |
));
|
66 |
|
67 |
// default_value
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
'conditions'
|
83 |
array(
|
84 |
array(
|
85 |
'field' => 'field_type',
|
@@ -95,16 +95,16 @@ class acfe_field_user_roles extends acf_field{
|
|
95 |
),
|
96 |
),
|
97 |
)
|
98 |
-
|
99 |
|
100 |
// Select: multiple
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
'conditions'
|
108 |
array(
|
109 |
array(
|
110 |
'field' => 'field_type',
|
@@ -113,16 +113,16 @@ class acfe_field_user_roles extends acf_field{
|
|
113 |
),
|
114 |
),
|
115 |
)
|
116 |
-
|
117 |
|
118 |
// Select: ui
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
'conditions'
|
126 |
array(
|
127 |
array(
|
128 |
'field' => 'field_type',
|
@@ -131,17 +131,17 @@ class acfe_field_user_roles extends acf_field{
|
|
131 |
),
|
132 |
),
|
133 |
)
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
'conditions'
|
145 |
array(
|
146 |
array(
|
147 |
'field' => 'field_type',
|
@@ -155,15 +155,15 @@ class acfe_field_user_roles extends acf_field{
|
|
155 |
),
|
156 |
),
|
157 |
)
|
158 |
-
|
159 |
|
160 |
// placeholder
|
161 |
acf_render_field_setting($field, array(
|
162 |
-
'label'
|
163 |
-
'instructions'
|
164 |
-
'type'
|
165 |
-
'name'
|
166 |
-
'placeholder'
|
167 |
'conditional_logic' => array(
|
168 |
array(
|
169 |
array(
|
@@ -199,11 +199,11 @@ class acfe_field_user_roles extends acf_field{
|
|
199 |
|
200 |
// search placeholder
|
201 |
acf_render_field_setting($field, array(
|
202 |
-
'label'
|
203 |
-
'instructions'
|
204 |
-
'type'
|
205 |
-
'name'
|
206 |
-
'placeholder'
|
207 |
'conditional_logic' => array(
|
208 |
array(
|
209 |
array(
|
@@ -219,16 +219,16 @@ class acfe_field_user_roles extends acf_field{
|
|
219 |
),
|
220 |
)
|
221 |
));
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
'conditions'
|
232 |
array(
|
233 |
array(
|
234 |
'field' => 'field_type',
|
@@ -237,20 +237,20 @@ class acfe_field_user_roles extends acf_field{
|
|
237 |
),
|
238 |
),
|
239 |
)
|
240 |
-
|
241 |
|
242 |
// Checkbox: layout
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
'conditions'
|
254 |
array(
|
255 |
array(
|
256 |
'field' => 'field_type',
|
@@ -266,16 +266,16 @@ class acfe_field_user_roles extends acf_field{
|
|
266 |
),
|
267 |
),
|
268 |
)
|
269 |
-
|
270 |
|
271 |
// Checkbox: toggle
|
272 |
acf_render_field_setting( $field, array(
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
'conditions'
|
279 |
array(
|
280 |
array(
|
281 |
'field' => 'field_type',
|
@@ -284,17 +284,17 @@ class acfe_field_user_roles extends acf_field{
|
|
284 |
),
|
285 |
),
|
286 |
)
|
287 |
-
|
288 |
|
289 |
// Checkbox: other_choice
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
'conditions'
|
298 |
array(
|
299 |
array(
|
300 |
'field' => 'field_type',
|
@@ -315,7 +315,7 @@ class acfe_field_user_roles extends acf_field{
|
|
315 |
),
|
316 |
)
|
317 |
)
|
318 |
-
|
319 |
|
320 |
}
|
321 |
|
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();
|
38 |
$field['default_value'] = acf_encode_choices($field['default_value'], false);
|
39 |
|
40 |
// Allow User Role
|
41 |
+
acf_render_field_setting( $field, array(
|
42 |
+
'label' => __('Allow User Role','acf'),
|
43 |
+
'instructions' => '',
|
44 |
+
'type' => 'select',
|
45 |
+
'name' => 'user_role',
|
46 |
+
'choices' => acfe_get_roles(),
|
47 |
+
'multiple' => 1,
|
48 |
+
'ui' => 1,
|
49 |
+
'allow_null' => 1,
|
50 |
+
'placeholder' => __("All user roles",'acf'),
|
51 |
+
));
|
52 |
|
53 |
// field_type
|
54 |
acf_render_field_setting($field, array(
|
55 |
+
'label' => __('Appearance','acf'),
|
56 |
+
'instructions' => __('Select the appearance of this field', 'acf'),
|
57 |
+
'type' => 'select',
|
58 |
+
'name' => 'field_type',
|
59 |
+
'optgroup' => true,
|
60 |
+
'choices' => array(
|
61 |
+
'checkbox' => __('Checkbox', 'acf'),
|
62 |
+
'radio' => __('Radio Buttons', 'acf'),
|
63 |
+
'select' => _x('Select', 'noun', 'acf')
|
64 |
)
|
65 |
));
|
66 |
|
67 |
// default_value
|
68 |
+
acf_render_field_setting( $field, array(
|
69 |
+
'label' => __('Default Value','acf'),
|
70 |
+
'instructions' => __('Enter each default value on a new line','acf'),
|
71 |
+
'name' => 'default_value',
|
72 |
+
'type' => 'textarea',
|
73 |
+
));
|
74 |
|
75 |
+
// Select + Radio: allow_null
|
76 |
+
acf_render_field_setting( $field, array(
|
77 |
+
'label' => __('Allow Null?','acf'),
|
78 |
+
'instructions' => '',
|
79 |
+
'name' => 'allow_null',
|
80 |
+
'type' => 'true_false',
|
81 |
+
'ui' => 1,
|
82 |
+
'conditions' => array(
|
83 |
array(
|
84 |
array(
|
85 |
'field' => 'field_type',
|
95 |
),
|
96 |
),
|
97 |
)
|
98 |
+
));
|
99 |
|
100 |
// Select: multiple
|
101 |
+
acf_render_field_setting( $field, array(
|
102 |
+
'label' => __('Select multiple values?','acf'),
|
103 |
+
'instructions' => '',
|
104 |
+
'name' => 'multiple',
|
105 |
+
'type' => 'true_false',
|
106 |
+
'ui' => 1,
|
107 |
+
'conditions' => array(
|
108 |
array(
|
109 |
array(
|
110 |
'field' => 'field_type',
|
113 |
),
|
114 |
),
|
115 |
)
|
116 |
+
));
|
117 |
|
118 |
// Select: ui
|
119 |
+
acf_render_field_setting( $field, array(
|
120 |
+
'label' => __('Stylised UI','acf'),
|
121 |
+
'instructions' => '',
|
122 |
+
'name' => 'ui',
|
123 |
+
'type' => 'true_false',
|
124 |
+
'ui' => 1,
|
125 |
+
'conditions' => array(
|
126 |
array(
|
127 |
array(
|
128 |
'field' => 'field_type',
|
131 |
),
|
132 |
),
|
133 |
)
|
134 |
+
));
|
135 |
+
|
136 |
+
|
137 |
+
// Select: ajax
|
138 |
+
acf_render_field_setting( $field, array(
|
139 |
+
'label' => __('Use AJAX to lazy load choices?','acf'),
|
140 |
+
'instructions' => '',
|
141 |
+
'name' => 'ajax',
|
142 |
+
'type' => 'true_false',
|
143 |
+
'ui' => 1,
|
144 |
+
'conditions' => array(
|
145 |
array(
|
146 |
array(
|
147 |
'field' => 'field_type',
|
155 |
),
|
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(
|
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(
|
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(
|
234 |
'field' => 'field_type',
|
237 |
),
|
238 |
),
|
239 |
)
|
240 |
+
));
|
241 |
|
242 |
// Checkbox: layout
|
243 |
+
acf_render_field_setting( $field, array(
|
244 |
+
'label' => __('Layout','acf'),
|
245 |
+
'instructions' => '',
|
246 |
+
'type' => 'radio',
|
247 |
+
'name' => 'layout',
|
248 |
+
'layout' => 'horizontal',
|
249 |
+
'choices' => array(
|
250 |
+
'vertical' => __("Vertical",'acf'),
|
251 |
+
'horizontal' => __("Horizontal",'acf')
|
252 |
+
),
|
253 |
+
'conditions' => array(
|
254 |
array(
|
255 |
array(
|
256 |
'field' => 'field_type',
|
266 |
),
|
267 |
),
|
268 |
)
|
269 |
+
));
|
270 |
|
271 |
// Checkbox: toggle
|
272 |
acf_render_field_setting( $field, array(
|
273 |
+
'label' => __('Toggle','acf'),
|
274 |
+
'instructions' => __('Prepend an extra checkbox to toggle all choices','acf'),
|
275 |
+
'name' => 'toggle',
|
276 |
+
'type' => 'true_false',
|
277 |
+
'ui' => 1,
|
278 |
+
'conditions' => array(
|
279 |
array(
|
280 |
array(
|
281 |
'field' => 'field_type',
|
284 |
),
|
285 |
),
|
286 |
)
|
287 |
+
));
|
288 |
|
289 |
// Checkbox: other_choice
|
290 |
+
acf_render_field_setting( $field, array(
|
291 |
+
'label' => __('Allow Custom','acf'),
|
292 |
+
'instructions' => '',
|
293 |
+
'name' => 'allow_custom',
|
294 |
+
'type' => 'true_false',
|
295 |
+
'ui' => 1,
|
296 |
+
'message' => __("Allow 'custom' values to be added", 'acf'),
|
297 |
+
'conditions' => array(
|
298 |
array(
|
299 |
array(
|
300 |
'field' => 'field_type',
|
315 |
),
|
316 |
)
|
317 |
)
|
318 |
+
));
|
319 |
|
320 |
}
|
321 |
|
@@ -9,7 +9,7 @@ if(!defined('ABSPATH'))
|
|
9 |
add_filter('acf/location/rule_values/post_type', 'acfe_location_post_type_all_choices');
|
10 |
function acfe_location_post_type_all_choices($choices){
|
11 |
|
12 |
-
|
13 |
|
14 |
return $choices;
|
15 |
|
9 |
add_filter('acf/location/rule_values/post_type', 'acfe_location_post_type_all_choices');
|
10 |
function acfe_location_post_type_all_choices($choices){
|
11 |
|
12 |
+
$choices = array_merge(array('all' => __('All', 'acf')), $choices);
|
13 |
|
14 |
return $choices;
|
15 |
|
@@ -10,7 +10,7 @@ class acfe_location_post_type_archive{
|
|
10 |
public $post_type = false;
|
11 |
public $post_types = array();
|
12 |
|
13 |
-
|
14 |
|
15 |
add_action('init', array($this, 'init'), 99);
|
16 |
add_action('current_screen', array($this, 'current_screen'));
|
@@ -23,7 +23,7 @@ class acfe_location_post_type_archive{
|
|
23 |
add_filter('acf/location/rule_values/post_type_archive', array($this, 'location_values'));
|
24 |
add_filter('acf/location/rule_match/post_type_archive', array($this, 'location_match'), 10, 3);
|
25 |
|
26 |
-
|
27 |
|
28 |
function init(){
|
29 |
|
@@ -53,12 +53,12 @@ class acfe_location_post_type_archive{
|
|
53 |
|
54 |
// Register
|
55 |
acf_add_options_page(array(
|
56 |
-
'page_title'
|
57 |
-
'menu_title'
|
58 |
-
'menu_slug'
|
59 |
'post_id' => $name . '_archive',
|
60 |
-
'capability'
|
61 |
-
'redirect'
|
62 |
'parent_slug' => $parent_slug,
|
63 |
'updated_message' => $object->label . ' Archive Saved.',
|
64 |
'acfe_post_type_archive' => true
|
@@ -102,15 +102,15 @@ class acfe_location_post_type_archive{
|
|
102 |
}
|
103 |
|
104 |
function location_screen($screen){
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
}
|
111 |
|
112 |
function admin_footer(){
|
113 |
-
|
114 |
?>
|
115 |
<div id="tmpl-acf-after-title">
|
116 |
<div style="margin-top:7px;">
|
@@ -130,18 +130,18 @@ class acfe_location_post_type_archive{
|
|
130 |
}
|
131 |
|
132 |
function admin_bar($wp_admin_bar){
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
$object = get_post_type_object($post_type);
|
146 |
|
147 |
// Check has archive
|
@@ -161,11 +161,11 @@ class acfe_location_post_type_archive{
|
|
161 |
|
162 |
// Add menu item
|
163 |
$wp_admin_bar->add_node(array(
|
164 |
-
'id'
|
165 |
-
'title'
|
166 |
-
'parent'
|
167 |
-
'href'
|
168 |
-
'meta'
|
169 |
));
|
170 |
|
171 |
}
|
@@ -215,7 +215,7 @@ class acfe_location_post_type_archive{
|
|
215 |
}
|
216 |
|
217 |
$choices = array('all' => __('All', 'acf'));
|
218 |
-
|
219 |
|
220 |
return $choices;
|
221 |
|
10 |
public $post_type = false;
|
11 |
public $post_types = array();
|
12 |
|
13 |
+
function __construct(){
|
14 |
|
15 |
add_action('init', array($this, 'init'), 99);
|
16 |
add_action('current_screen', array($this, 'current_screen'));
|
23 |
add_filter('acf/location/rule_values/post_type_archive', array($this, 'location_values'));
|
24 |
add_filter('acf/location/rule_match/post_type_archive', array($this, 'location_match'), 10, 3);
|
25 |
|
26 |
+
}
|
27 |
|
28 |
function init(){
|
29 |
|
53 |
|
54 |
// Register
|
55 |
acf_add_options_page(array(
|
56 |
+
'page_title' => $object->label . ' ' . $label,
|
57 |
+
'menu_title' => $label,
|
58 |
+
'menu_slug' => $name . '-archive',
|
59 |
'post_id' => $name . '_archive',
|
60 |
+
'capability' => $capability,
|
61 |
+
'redirect' => false,
|
62 |
'parent_slug' => $parent_slug,
|
63 |
'updated_message' => $object->label . ' Archive Saved.',
|
64 |
'acfe_post_type_archive' => true
|
102 |
}
|
103 |
|
104 |
function location_screen($screen){
|
105 |
+
|
106 |
+
$screen['acfe_dpt_admin_page'] = true;
|
107 |
+
|
108 |
+
return $screen;
|
109 |
+
|
110 |
}
|
111 |
|
112 |
function admin_footer(){
|
113 |
+
|
114 |
?>
|
115 |
<div id="tmpl-acf-after-title">
|
116 |
<div style="margin-top:7px;">
|
130 |
}
|
131 |
|
132 |
function admin_bar($wp_admin_bar){
|
133 |
+
|
134 |
+
// Bail early
|
135 |
+
if(is_admin() || !is_post_type_archive())
|
136 |
+
return;
|
137 |
+
|
138 |
+
// Get Post Type
|
139 |
+
$post_type = get_query_var('post_type');
|
140 |
+
|
141 |
+
if(!$post_type)
|
142 |
+
return;
|
143 |
+
|
144 |
+
// Object
|
145 |
$object = get_post_type_object($post_type);
|
146 |
|
147 |
// Check has archive
|
161 |
|
162 |
// Add menu item
|
163 |
$wp_admin_bar->add_node(array(
|
164 |
+
'id' => 'edit',
|
165 |
+
'title' => 'Edit ' . $object->label . ' ' . __('Archive'),
|
166 |
+
'parent' => false,
|
167 |
+
'href' => add_query_arg(array('post_type' => $object->name, 'page' => $object->name . '-archive'), admin_url('edit.php')),
|
168 |
+
'meta' => array('class' => 'ab-item')
|
169 |
));
|
170 |
|
171 |
}
|
215 |
}
|
216 |
|
217 |
$choices = array('all' => __('All', 'acf'));
|
218 |
+
$choices = array_merge($choices, $pretty_post_types);
|
219 |
|
220 |
return $choices;
|
221 |
|
@@ -11,7 +11,7 @@ class acfe_location_post_type_list{
|
|
11 |
|
12 |
public $field_groups;
|
13 |
|
14 |
-
|
15 |
|
16 |
add_action('load-edit.php', array($this, 'load'));
|
17 |
|
@@ -19,7 +19,7 @@ class acfe_location_post_type_list{
|
|
19 |
add_filter('acf/location/rule_values/post_type_list', array($this, 'location_values'));
|
20 |
add_filter('acf/location/rule_match/post_type_list', array($this, 'location_match'), 10, 3);
|
21 |
|
22 |
-
|
23 |
|
24 |
function load(){
|
25 |
|
@@ -27,8 +27,8 @@ class acfe_location_post_type_list{
|
|
27 |
global $typenow;
|
28 |
|
29 |
$get_post_types = acf_get_post_types(array(
|
30 |
-
'show_ui'
|
31 |
-
'exclude'
|
32 |
));
|
33 |
|
34 |
// Check post type
|
@@ -126,7 +126,7 @@ class acfe_location_post_type_list{
|
|
126 |
// Args
|
127 |
array(
|
128 |
'total' => $total,
|
129 |
-
'current' => $current,
|
130 |
'field_group' => $field_group
|
131 |
)
|
132 |
|
@@ -347,18 +347,18 @@ class acfe_location_post_type_list{
|
|
347 |
|
348 |
// Create metabox localized data.
|
349 |
$data = array(
|
350 |
-
'id'
|
351 |
-
'key'
|
352 |
-
'style'
|
353 |
-
'label'
|
354 |
-
'edit'
|
355 |
);
|
356 |
|
357 |
?>
|
358 |
<script type="text/javascript">
|
359 |
if( typeof acf !== 'undefined' ) {
|
360 |
acf.newPostbox(<?php echo wp_json_encode($data); ?>);
|
361 |
-
}
|
362 |
</script>
|
363 |
|
364 |
<?php
|
@@ -385,8 +385,8 @@ class acfe_location_post_type_list{
|
|
385 |
function location_values($choices){
|
386 |
|
387 |
$post_types = acf_get_post_types(array(
|
388 |
-
'show_ui'
|
389 |
-
'exclude'
|
390 |
));
|
391 |
|
392 |
$pretty_post_types = array();
|
@@ -398,7 +398,7 @@ class acfe_location_post_type_list{
|
|
398 |
}
|
399 |
|
400 |
$choices = array('all' => __('All', 'acf'));
|
401 |
-
|
402 |
|
403 |
return $choices;
|
404 |
|
@@ -409,8 +409,8 @@ class acfe_location_post_type_list{
|
|
409 |
if(!acf_maybe_get($screen, 'post_type_list') || !acf_maybe_get($rule, 'value'))
|
410 |
return $match;
|
411 |
|
412 |
-
|
413 |
-
|
414 |
if($rule['value'] === 'all')
|
415 |
$match = true;
|
416 |
|
11 |
|
12 |
public $field_groups;
|
13 |
|
14 |
+
function __construct(){
|
15 |
|
16 |
add_action('load-edit.php', array($this, 'load'));
|
17 |
|
19 |
add_filter('acf/location/rule_values/post_type_list', array($this, 'location_values'));
|
20 |
add_filter('acf/location/rule_match/post_type_list', array($this, 'location_match'), 10, 3);
|
21 |
|
22 |
+
}
|
23 |
|
24 |
function load(){
|
25 |
|
27 |
global $typenow;
|
28 |
|
29 |
$get_post_types = acf_get_post_types(array(
|
30 |
+
'show_ui' => 1,
|
31 |
+
'exclude' => array('attachment')
|
32 |
));
|
33 |
|
34 |
// Check post type
|
126 |
// Args
|
127 |
array(
|
128 |
'total' => $total,
|
129 |
+
'current' => $current,
|
130 |
'field_group' => $field_group
|
131 |
)
|
132 |
|
347 |
|
348 |
// Create metabox localized data.
|
349 |
$data = array(
|
350 |
+
'id' => 'acf-' . $field_group['ID'],
|
351 |
+
'key' => $field_group['key'],
|
352 |
+
'style' => $field_group['style'],
|
353 |
+
'label' => $field_group['label_placement'],
|
354 |
+
'edit' => acf_get_field_group_edit_link($field_group['ID'])
|
355 |
);
|
356 |
|
357 |
?>
|
358 |
<script type="text/javascript">
|
359 |
if( typeof acf !== 'undefined' ) {
|
360 |
acf.newPostbox(<?php echo wp_json_encode($data); ?>);
|
361 |
+
}
|
362 |
</script>
|
363 |
|
364 |
<?php
|
385 |
function location_values($choices){
|
386 |
|
387 |
$post_types = acf_get_post_types(array(
|
388 |
+
'show_ui' => 1,
|
389 |
+
'exclude' => array('attachment')
|
390 |
));
|
391 |
|
392 |
$pretty_post_types = array();
|
398 |
}
|
399 |
|
400 |
$choices = array('all' => __('All', 'acf'));
|
401 |
+
$choices = array_merge($choices, $pretty_post_types);
|
402 |
|
403 |
return $choices;
|
404 |
|
409 |
if(!acf_maybe_get($screen, 'post_type_list') || !acf_maybe_get($rule, 'value'))
|
410 |
return $match;
|
411 |
|
412 |
+
$match = ($screen['post_type_list'] === $rule['value']);
|
413 |
+
|
414 |
if($rule['value'] === 'all')
|
415 |
$match = true;
|
416 |
|
@@ -11,7 +11,7 @@ class acfe_location_taxonomy_list{
|
|
11 |
|
12 |
public $field_groups;
|
13 |
|
14 |
-
|
15 |
|
16 |
add_action('load-edit-tags.php', array($this, 'load'));
|
17 |
|
@@ -19,7 +19,7 @@ class acfe_location_taxonomy_list{
|
|
19 |
add_filter('acf/location/rule_values/taxonomy_list', array($this, 'location_values'));
|
20 |
add_filter('acf/location/rule_match/taxonomy_list', array($this, 'location_match'), 10, 3);
|
21 |
|
22 |
-
|
23 |
|
24 |
function load(){
|
25 |
|
@@ -338,18 +338,18 @@ class acfe_location_taxonomy_list{
|
|
338 |
|
339 |
// Create metabox localized data.
|
340 |
$data = array(
|
341 |
-
'id'
|
342 |
-
'key'
|
343 |
-
'style'
|
344 |
-
'label'
|
345 |
-
'edit'
|
346 |
);
|
347 |
|
348 |
?>
|
349 |
<script type="text/javascript">
|
350 |
if( typeof acf !== 'undefined' ) {
|
351 |
acf.newPostbox(<?php echo wp_json_encode($data); ?>);
|
352 |
-
}
|
353 |
</script>
|
354 |
|
355 |
<?php
|
@@ -374,8 +374,8 @@ class acfe_location_taxonomy_list{
|
|
374 |
|
375 |
function location_values($choices){
|
376 |
|
377 |
-
|
378 |
-
|
379 |
|
380 |
return $choices;
|
381 |
|
@@ -386,8 +386,8 @@ class acfe_location_taxonomy_list{
|
|
386 |
if(!acf_maybe_get($screen, 'taxonomy_list') || !acf_maybe_get($rule, 'value'))
|
387 |
return $match;
|
388 |
|
389 |
-
|
390 |
-
|
391 |
if($rule['value'] === 'all')
|
392 |
$match = true;
|
393 |
|
11 |
|
12 |
public $field_groups;
|
13 |
|
14 |
+
function __construct(){
|
15 |
|
16 |
add_action('load-edit-tags.php', array($this, 'load'));
|
17 |
|
19 |
add_filter('acf/location/rule_values/taxonomy_list', array($this, 'location_values'));
|
20 |
add_filter('acf/location/rule_match/taxonomy_list', array($this, 'location_match'), 10, 3);
|
21 |
|
22 |
+
}
|
23 |
|
24 |
function load(){
|
25 |
|
338 |
|
339 |
// Create metabox localized data.
|
340 |
$data = array(
|
341 |
+
'id' => 'acf-' . $field_group['ID'],
|
342 |
+
'key' => $field_group['key'],
|
343 |
+
'style' => $field_group['style'],
|
344 |
+
'label' => $field_group['label_placement'],
|
345 |
+
'edit' => acf_get_field_group_edit_link($field_group['ID'])
|
346 |
);
|
347 |
|
348 |
?>
|
349 |
<script type="text/javascript">
|
350 |
if( typeof acf !== 'undefined' ) {
|
351 |
acf.newPostbox(<?php echo wp_json_encode($data); ?>);
|
352 |
+
}
|
353 |
</script>
|
354 |
|
355 |
<?php
|
374 |
|
375 |
function location_values($choices){
|
376 |
|
377 |
+
$choices = array('all' => __('All', 'acf'));
|
378 |
+
$choices = array_merge($choices, acf_get_taxonomy_labels());
|
379 |
|
380 |
return $choices;
|
381 |
|
386 |
if(!acf_maybe_get($screen, 'taxonomy_list') || !acf_maybe_get($rule, 'value'))
|
387 |
return $match;
|
388 |
|
389 |
+
$match = ($screen['taxonomy_list'] === $rule['value']);
|
390 |
+
|
391 |
if($rule['value'] === 'all')
|
392 |
$match = true;
|
393 |
|
@@ -348,16 +348,16 @@ class ACFE_AutoSync{
|
|
348 |
|
349 |
// Prepare
|
350 |
$str_replace = array(
|
351 |
-
" "
|
352 |
-
"'!!__(!!\'"
|
353 |
-
"!!\', !!\'"
|
354 |
-
"!!\')!!'"
|
355 |
-
"array ("
|
356 |
);
|
357 |
|
358 |
$preg_replace = array(
|
359 |
-
'/([\t\r\n]+?)array/'
|
360 |
-
'/[0-9]+ => array/'
|
361 |
);
|
362 |
|
363 |
ob_start();
|
@@ -588,130 +588,4 @@ function acfe_get_local_json_file($field_group){
|
|
588 |
|
589 |
return false;
|
590 |
|
591 |
-
}
|
592 |
-
|
593 |
-
/*
|
594 |
-
function acfe_is_local_json($field_group){
|
595 |
-
|
596 |
-
$key = $field_group;
|
597 |
-
|
598 |
-
if(is_array($field_group) && isset($field_group['key']))
|
599 |
-
$key = $field_group['key'];
|
600 |
-
|
601 |
-
if(!acf_is_local_field_group($key))
|
602 |
-
return false;
|
603 |
-
|
604 |
-
$field_group = acf_get_local_field_group($key);
|
605 |
-
|
606 |
-
if(acf_maybe_get($field_group, 'local') === 'json')
|
607 |
-
return true;
|
608 |
-
|
609 |
-
return false;
|
610 |
-
|
611 |
-
}
|
612 |
-
|
613 |
-
function acfe_is_local_php($field_group){
|
614 |
-
|
615 |
-
$key = $field_group;
|
616 |
-
|
617 |
-
if(is_array($field_group) && isset($field_group['key']))
|
618 |
-
$key = $field_group['key'];
|
619 |
-
|
620 |
-
if(!acf_is_local_field_group($key))
|
621 |
-
return false;
|
622 |
-
|
623 |
-
$field_group = acf_get_local_field_group($key);
|
624 |
-
|
625 |
-
if(acf_maybe_get($field_group, 'local') === 'php')
|
626 |
-
return true;
|
627 |
-
|
628 |
-
return false;
|
629 |
-
|
630 |
-
}
|
631 |
-
|
632 |
-
function acfe_has_field_group_autosync($field_group, $type = false){
|
633 |
-
|
634 |
-
$acfe_autosync = (array) acf_maybe_get($field_group, 'acfe_autosync', array());
|
635 |
-
|
636 |
-
// Has something
|
637 |
-
if(!$type){
|
638 |
-
|
639 |
-
return !empty($acfe_autosync);
|
640 |
-
|
641 |
-
}
|
642 |
-
|
643 |
-
// Has Json
|
644 |
-
elseif($type === 'json'){
|
645 |
-
|
646 |
-
return in_array('json', $acfe_autosync);
|
647 |
-
|
648 |
-
}
|
649 |
-
|
650 |
-
// Has PHP
|
651 |
-
elseif($type === 'php'){
|
652 |
-
|
653 |
-
return in_array('php', $acfe_autosync);
|
654 |
-
|
655 |
-
}
|
656 |
-
|
657 |
-
return false;
|
658 |
-
|
659 |
-
}
|
660 |
-
|
661 |
-
function acfe_has_field_group_autosync_file($field_group, $type = 'json'){
|
662 |
-
|
663 |
-
if($type === 'json'){
|
664 |
-
|
665 |
-
$found = false;
|
666 |
-
$paths = (array) acf_get_setting('load_json', array());
|
667 |
-
|
668 |
-
// True if json file found
|
669 |
-
if(acf_is_local_field_group($field_group['key'])){
|
670 |
-
|
671 |
-
$local_field_group = acf_get_local_field_group($field_group['key']);
|
672 |
-
$get_local = acf_maybe_get($local_field_group, 'local', false);
|
673 |
-
|
674 |
-
if($get_local === 'json')
|
675 |
-
$found = true;
|
676 |
-
|
677 |
-
}
|
678 |
-
|
679 |
-
if(!$found){
|
680 |
-
|
681 |
-
foreach($paths as $path){
|
682 |
-
|
683 |
-
$path = untrailingslashit($path);
|
684 |
-
$file = $field_group['key'] . '.json';
|
685 |
-
|
686 |
-
if(!is_readable("{$path}/{$file}"))
|
687 |
-
continue;
|
688 |
-
|
689 |
-
$found = true;
|
690 |
-
break;
|
691 |
-
|
692 |
-
}
|
693 |
-
|
694 |
-
}
|
695 |
-
|
696 |
-
return $found;
|
697 |
-
|
698 |
-
}
|
699 |
-
|
700 |
-
elseif($type === 'php'){
|
701 |
-
|
702 |
-
$php_files = acfe_get_local_php_files();
|
703 |
-
|
704 |
-
if(isset($php_files[$field_group['key']])){
|
705 |
-
|
706 |
-
return $php_files[$field_group['key']];
|
707 |
-
|
708 |
-
}
|
709 |
-
|
710 |
-
return false;
|
711 |
-
|
712 |
-
}
|
713 |
-
|
714 |
-
return false;
|
715 |
-
|
716 |
-
}
|
717 |
-
*/
|
348 |
|
349 |
// Prepare
|
350 |
$str_replace = array(
|
351 |
+
" " => "\t",
|
352 |
+
"'!!__(!!\'" => "__('",
|
353 |
+
"!!\', !!\'" => "', '",
|
354 |
+
"!!\')!!'" => "')",
|
355 |
+
"array (" => "array("
|
356 |
);
|
357 |
|
358 |
$preg_replace = array(
|
359 |
+
'/([\t\r\n]+?)array/' => 'array',
|
360 |
+
'/[0-9]+ => array/' => 'array'
|
361 |
);
|
362 |
|
363 |
ob_start();
|
588 |
|
589 |
return false;
|
590 |
|
591 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -273,11 +273,11 @@ class acfe_dynamic_block_types extends acfe_dynamic_module{
|
|
273 |
return;
|
274 |
|
275 |
acf.newPostbox(<?php echo wp_json_encode(array(
|
276 |
-
'id'
|
277 |
-
'key'
|
278 |
-
'style'
|
279 |
-
'label'
|
280 |
-
'edit'
|
281 |
)); ?>);
|
282 |
|
283 |
})(jQuery);
|
@@ -829,16 +829,16 @@ class acfe_dynamic_block_types extends acfe_dynamic_module{
|
|
829 |
acf_update_setting('l10n_var_export', true);
|
830 |
|
831 |
$str_replace = array(
|
832 |
-
" "
|
833 |
-
"'!!__(!!\'"
|
834 |
-
"!!\', !!\'"
|
835 |
-
"!!\')!!'"
|
836 |
-
"array ("
|
837 |
);
|
838 |
|
839 |
$preg_replace = array(
|
840 |
-
'/([\t\r\n]+?)array/'
|
841 |
-
'/[0-9]+ => array/'
|
842 |
);
|
843 |
|
844 |
// Get settings.
|
@@ -1164,7 +1164,7 @@ cite',
|
|
1164 |
'label' => 'Mode',
|
1165 |
'name' => 'mode',
|
1166 |
'type' => 'select',
|
1167 |
-
'instructions' => '(String) (Optional) The display mode for your block. Available settings are “auto”, “preview” and “edit”. Defaults to “
|
1168 |
auto: Preview is shown by default but changes to edit form when block is selected.<br />
|
1169 |
preview: Preview is always shown. Edit form appears in sidebar when block is selected.<br />
|
1170 |
edit: Edit form is always shown.<br /><br />
|
@@ -1181,12 +1181,12 @@ Note. When in “preview” or “edit” modes, an icon will appear in the bloc
|
|
1181 |
'acfe_update' => '',
|
1182 |
'acfe_permissions' => '',
|
1183 |
'choices' => array(
|
1184 |
-
'auto' => 'Auto',
|
1185 |
'preview' => 'Preview',
|
|
|
1186 |
'edit' => 'Edit',
|
1187 |
),
|
1188 |
'default_value' => array(
|
1189 |
-
0 => '
|
1190 |
),
|
1191 |
'allow_null' => 0,
|
1192 |
'multiple' => 0,
|
273 |
return;
|
274 |
|
275 |
acf.newPostbox(<?php echo wp_json_encode(array(
|
276 |
+
'id' => 'acfe-dbt-field-groups',
|
277 |
+
'key' => '',
|
278 |
+
'style' => 'default',
|
279 |
+
'label' => 'left',
|
280 |
+
'edit' => false
|
281 |
)); ?>);
|
282 |
|
283 |
})(jQuery);
|
829 |
acf_update_setting('l10n_var_export', true);
|
830 |
|
831 |
$str_replace = array(
|
832 |
+
" " => "\t",
|
833 |
+
"'!!__(!!\'" => "__('",
|
834 |
+
"!!\', !!\'" => "', '",
|
835 |
+
"!!\')!!'" => "')",
|
836 |
+
"array (" => "array("
|
837 |
);
|
838 |
|
839 |
$preg_replace = array(
|
840 |
+
'/([\t\r\n]+?)array/' => 'array',
|
841 |
+
'/[0-9]+ => array/' => 'array'
|
842 |
);
|
843 |
|
844 |
// Get settings.
|
1164 |
'label' => 'Mode',
|
1165 |
'name' => 'mode',
|
1166 |
'type' => 'select',
|
1167 |
+
'instructions' => '(String) (Optional) The display mode for your block. Available settings are “auto”, “preview” and “edit”. Defaults to “preview”.<br /><br />
|
1168 |
auto: Preview is shown by default but changes to edit form when block is selected.<br />
|
1169 |
preview: Preview is always shown. Edit form appears in sidebar when block is selected.<br />
|
1170 |
edit: Edit form is always shown.<br /><br />
|
1181 |
'acfe_update' => '',
|
1182 |
'acfe_permissions' => '',
|
1183 |
'choices' => array(
|
|
|
1184 |
'preview' => 'Preview',
|
1185 |
+
'auto' => 'Auto',
|
1186 |
'edit' => 'Edit',
|
1187 |
),
|
1188 |
'default_value' => array(
|
1189 |
+
0 => 'preview',
|
1190 |
),
|
1191 |
'allow_null' => 0,
|
1192 |
'multiple' => 0,
|
@@ -14,7 +14,7 @@ class acfe_dev{
|
|
14 |
public $wp_meta = array();
|
15 |
public $acf_meta = array();
|
16 |
|
17 |
-
|
18 |
|
19 |
// Script debug
|
20 |
if(!defined('SCRIPT_DEBUG'))
|
@@ -24,15 +24,15 @@ class acfe_dev{
|
|
24 |
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
|
25 |
|
26 |
// Post
|
27 |
-
add_action('load-post.php',
|
28 |
-
|
29 |
|
30 |
// Term
|
31 |
add_action('load-term.php', array($this, 'load_term'));
|
32 |
|
33 |
// User
|
34 |
add_action('show_user_profile', array($this, 'load_user'), 20);
|
35 |
-
|
36 |
|
37 |
// Options
|
38 |
add_action('acf/options_page/submitbox_before_major_actions', array($this, 'load_options'));
|
@@ -40,11 +40,11 @@ class acfe_dev{
|
|
40 |
add_action('wp_ajax_acfe/delete_meta', array($this, 'ajax_delete_meta'));
|
41 |
add_action('wp_ajax_acfe/bulk_delete_meta', array($this, 'ajax_bulk_delete_meta'));
|
42 |
|
43 |
-
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
function admin_enqueue_scripts(){
|
49 |
|
50 |
// bail early if not valid screen
|
@@ -93,7 +93,7 @@ class acfe_dev{
|
|
93 |
function load_term(){
|
94 |
|
95 |
$screen = get_current_screen();
|
96 |
-
|
97 |
|
98 |
// actions
|
99 |
add_action("{$taxonomy}_edit_form", array($this, 'edit_term'), 10, 2);
|
14 |
public $wp_meta = array();
|
15 |
public $acf_meta = array();
|
16 |
|
17 |
+
function __construct(){
|
18 |
|
19 |
// Script debug
|
20 |
if(!defined('SCRIPT_DEBUG'))
|
24 |
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
|
25 |
|
26 |
// Post
|
27 |
+
add_action('load-post.php', array($this, 'load_post'));
|
28 |
+
add_action('load-post-new.php', array($this, 'load_post'));
|
29 |
|
30 |
// Term
|
31 |
add_action('load-term.php', array($this, 'load_term'));
|
32 |
|
33 |
// User
|
34 |
add_action('show_user_profile', array($this, 'load_user'), 20);
|
35 |
+
add_action('edit_user_profile', array($this, 'load_user'), 20);
|
36 |
|
37 |
// Options
|
38 |
add_action('acf/options_page/submitbox_before_major_actions', array($this, 'load_options'));
|
40 |
add_action('wp_ajax_acfe/delete_meta', array($this, 'ajax_delete_meta'));
|
41 |
add_action('wp_ajax_acfe/bulk_delete_meta', array($this, 'ajax_bulk_delete_meta'));
|
42 |
|
43 |
+
}
|
44 |
|
45 |
+
/*
|
46 |
+
* Enqueue Scripts
|
47 |
+
*/
|
48 |
function admin_enqueue_scripts(){
|
49 |
|
50 |
// bail early if not valid screen
|
93 |
function load_term(){
|
94 |
|
95 |
$screen = get_current_screen();
|
96 |
+
$taxonomy = $screen->taxonomy;
|
97 |
|
98 |
// actions
|
99 |
add_action("{$taxonomy}_edit_form", array($this, 'edit_term'), 10, 2);
|
@@ -48,9 +48,9 @@ class acfe_form_email{
|
|
48 |
// Fields
|
49 |
$from = get_sub_field('acfe_form_email_from');
|
50 |
$from = acfe_form_map_field_value($from, $current_post_id, $form);
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
$to = get_sub_field('acfe_form_email_to');
|
56 |
$to = acfe_form_map_field_value($to, $current_post_id, $form);
|
@@ -123,27 +123,27 @@ class acfe_form_email{
|
|
123 |
endif;
|
124 |
|
125 |
$headers[] = 'From: ' . $from;
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
|
133 |
if(!empty($cc)){
|
134 |
-
|
135 |
-
|
136 |
|
137 |
}
|
138 |
|
139 |
if(!empty($bcc)){
|
140 |
-
|
141 |
-
|
142 |
|
143 |
}
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
|
148 |
$args = array(
|
149 |
'from' => $from,
|
@@ -166,8 +166,8 @@ class acfe_form_email{
|
|
166 |
$args = apply_filters('acfe/form/submit/email_args/form=' . $form_name, $args, $form, $action);
|
167 |
|
168 |
if(!empty($action)){
|
169 |
-
|
170 |
-
|
171 |
$args = apply_filters_deprecated('acfe/form/submit/email/args/action=' . $action, array($args, $form, $action), '0.8.1', 'acfe/form/submit/email_args/action=' . $action);
|
172 |
|
173 |
// Filter
|
@@ -178,51 +178,51 @@ class acfe_form_email{
|
|
178 |
// Bail early if no args
|
179 |
if($args === false)
|
180 |
return;
|
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 |
wp_mail($args['to'], $args['subject'], $args['content'], $args['headers'], $args['attachments']);
|
227 |
|
228 |
do_action('acfe/form/submit/email', $args, $form, $action);
|
@@ -235,8 +235,8 @@ class acfe_form_email{
|
|
235 |
if(!empty($delete_files)){
|
236 |
|
237 |
foreach($delete_files as $file_id){
|
238 |
-
|
239 |
-
|
240 |
|
241 |
}
|
242 |
|
48 |
// Fields
|
49 |
$from = get_sub_field('acfe_form_email_from');
|
50 |
$from = acfe_form_map_field_value($from, $current_post_id, $form);
|
51 |
+
|
52 |
+
$reply_to = get_sub_field('acfe_form_email_reply_to');
|
53 |
+
$reply_to = acfe_form_map_field_value($reply_to, $current_post_id, $form);
|
54 |
|
55 |
$to = get_sub_field('acfe_form_email_to');
|
56 |
$to = acfe_form_map_field_value($to, $current_post_id, $form);
|
123 |
endif;
|
124 |
|
125 |
$headers[] = 'From: ' . $from;
|
126 |
+
|
127 |
+
if(!empty($reply_to)){
|
128 |
+
|
129 |
+
$headers[] = 'Reply-To: ' . $reply_to;
|
130 |
+
|
131 |
+
}
|
132 |
|
133 |
if(!empty($cc)){
|
134 |
+
|
135 |
+
$headers[] = 'Cc: ' . $cc;
|
136 |
|
137 |
}
|
138 |
|
139 |
if(!empty($bcc)){
|
140 |
+
|
141 |
+
$headers[] = 'Bcc: ' . $bcc;
|
142 |
|
143 |
}
|
144 |
+
|
145 |
+
$headers[] = 'Content-Type: text/html';
|
146 |
+
$headers[] = 'charset=UTF-8';
|
147 |
|
148 |
$args = array(
|
149 |
'from' => $from,
|
166 |
$args = apply_filters('acfe/form/submit/email_args/form=' . $form_name, $args, $form, $action);
|
167 |
|
168 |
if(!empty($action)){
|
169 |
+
|
170 |
+
// Deprecated filter
|
171 |
$args = apply_filters_deprecated('acfe/form/submit/email/args/action=' . $action, array($args, $form, $action), '0.8.1', 'acfe/form/submit/email_args/action=' . $action);
|
172 |
|
173 |
// Filter
|
178 |
// Bail early if no args
|
179 |
if($args === false)
|
180 |
return;
|
181 |
+
|
182 |
+
// Check if Headers changed
|
183 |
+
$rules = array(
|
184 |
+
array(
|
185 |
+
'args_key' => 'from',
|
186 |
+
'value_old' => $from,
|
187 |
+
'header_key' => 'From:',
|
188 |
+
),
|
189 |
+
array(
|
190 |
+
'args_key' => 'reply_to',
|
191 |
+
'value_old' => $reply_to,
|
192 |
+
'header_key' => 'Reply-To:',
|
193 |
+
),
|
194 |
+
array(
|
195 |
+
'args_key' => 'cc',
|
196 |
+
'value_old' => $cc,
|
197 |
+
'header_key' => 'Cc:',
|
198 |
+
),
|
199 |
+
array(
|
200 |
+
'args_key' => 'bcc',
|
201 |
+
'value_old' => $bcc,
|
202 |
+
'header_key' => 'Bcc:',
|
203 |
+
),
|
204 |
+
);
|
205 |
+
|
206 |
+
foreach($rules as $rule){
|
207 |
+
|
208 |
+
$new_check = acf_maybe_get($args, $rule['args_key']);
|
209 |
+
|
210 |
+
if(!empty($new_check) && $new_check !== $rule['value_old']){
|
211 |
+
|
212 |
+
foreach($args['headers'] as &$header){
|
213 |
+
|
214 |
+
if(stripos($header, $rule['header_key']) !== 0)
|
215 |
+
continue;
|
216 |
+
|
217 |
+
$header = $rule['header_key'] . ' ' . $new_check;
|
218 |
+
break;
|
219 |
+
|
220 |
+
}
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
wp_mail($args['to'], $args['subject'], $args['content'], $args['headers'], $args['attachments']);
|
227 |
|
228 |
do_action('acfe/form/submit/email', $args, $form, $action);
|
235 |
if(!empty($delete_files)){
|
236 |
|
237 |
foreach($delete_files as $file_id){
|
238 |
+
|
239 |
+
wp_delete_attachment($file_id, true);
|
240 |
|
241 |
}
|
242 |
|
@@ -72,8 +72,8 @@ class acfe_form_post{
|
|
72 |
// Load values
|
73 |
if(!$load_values)
|
74 |
return $form;
|
75 |
-
|
76 |
-
|
77 |
$_post_type = get_sub_field('acfe_form_post_map_post_type');
|
78 |
$_post_status = get_sub_field('acfe_form_post_map_post_status');
|
79 |
$_post_title = get_sub_field('acfe_form_post_map_post_title');
|
@@ -85,14 +85,14 @@ class acfe_form_post{
|
|
85 |
|
86 |
// Map {field:name} {get_field:name} {query_var:name}
|
87 |
$_post_id = acfe_form_map_field_value_load($_post_id, $current_post_id, $form);
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
|
97 |
// Filters
|
98 |
$_post_id = apply_filters('acfe/form/load/post_id', $_post_id, $form, $action);
|
@@ -112,8 +112,8 @@ class acfe_form_post{
|
|
112 |
|
113 |
if($key !== false)
|
114 |
unset($load_meta[$key]);
|
115 |
-
|
116 |
-
|
117 |
|
118 |
}
|
119 |
|
@@ -124,8 +124,8 @@ class acfe_form_post{
|
|
124 |
|
125 |
if($key !== false)
|
126 |
unset($load_meta[$key]);
|
127 |
-
|
128 |
-
|
129 |
|
130 |
}
|
131 |
|
@@ -136,8 +136,8 @@ class acfe_form_post{
|
|
136 |
|
137 |
if($key !== false)
|
138 |
unset($load_meta[$key]);
|
139 |
-
|
140 |
-
|
141 |
|
142 |
}
|
143 |
|
@@ -148,8 +148,8 @@ class acfe_form_post{
|
|
148 |
|
149 |
if($key !== false)
|
150 |
unset($load_meta[$key]);
|
151 |
-
|
152 |
-
|
153 |
|
154 |
}
|
155 |
|
@@ -160,8 +160,8 @@ class acfe_form_post{
|
|
160 |
|
161 |
if($key !== false)
|
162 |
unset($load_meta[$key]);
|
163 |
-
|
164 |
-
|
165 |
|
166 |
}
|
167 |
|
@@ -172,8 +172,8 @@ class acfe_form_post{
|
|
172 |
|
173 |
if($key !== false)
|
174 |
unset($load_meta[$key]);
|
175 |
-
|
176 |
-
|
177 |
|
178 |
}
|
179 |
|
@@ -184,8 +184,8 @@ class acfe_form_post{
|
|
184 |
|
185 |
if($key !== false)
|
186 |
unset($load_meta[$key]);
|
187 |
-
|
188 |
-
|
189 |
|
190 |
}
|
191 |
|
@@ -195,31 +195,31 @@ class acfe_form_post{
|
|
195 |
$key = array_search($_post_terms, $load_meta);
|
196 |
|
197 |
if($key !== false)
|
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 |
|
@@ -278,7 +278,7 @@ class acfe_form_post{
|
|
278 |
$post_action = get_sub_field('acfe_form_post_action');
|
279 |
|
280 |
// Load values
|
281 |
-
|
282 |
|
283 |
// Pre-process
|
284 |
$_post_content_group = get_sub_field('acfe_form_post_save_post_content_group');
|
@@ -291,19 +291,19 @@ class acfe_form_post{
|
|
291 |
$map = array();
|
292 |
|
293 |
if($load_values){
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
}
|
308 |
|
309 |
// Fields
|
@@ -352,7 +352,7 @@ class acfe_form_post{
|
|
352 |
if(!empty($data['post_type'])){
|
353 |
|
354 |
if(is_array($data['post_type']))
|
355 |
-
|
356 |
|
357 |
$args['post_type'] = $data['post_type'];
|
358 |
|
@@ -360,9 +360,9 @@ class acfe_form_post{
|
|
360 |
|
361 |
// Post status
|
362 |
if(!empty($data['post_status'])){
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
|
367 |
$args['post_status'] = $data['post_status'];
|
368 |
|
@@ -370,9 +370,9 @@ class acfe_form_post{
|
|
370 |
|
371 |
// Post title
|
372 |
if(!empty($data['post_title'])){
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
|
377 |
$args['post_title'] = $data['post_title'];
|
378 |
|
@@ -383,9 +383,9 @@ class acfe_form_post{
|
|
383 |
|
384 |
// Post name
|
385 |
if(!empty($data['post_name'])){
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
|
390 |
$args['post_name'] = $data['post_name'];
|
391 |
|
@@ -396,9 +396,9 @@ class acfe_form_post{
|
|
396 |
|
397 |
// Post content
|
398 |
if(!empty($data['post_content'])){
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
|
403 |
$args['post_content'] = $data['post_content'];
|
404 |
|
@@ -406,9 +406,9 @@ class acfe_form_post{
|
|
406 |
|
407 |
// Post author
|
408 |
if(!empty($data['post_author'])){
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
|
413 |
$args['post_author'] = $data['post_author'];
|
414 |
|
@@ -416,9 +416,9 @@ class acfe_form_post{
|
|
416 |
|
417 |
// Post parent
|
418 |
if(!empty($data['post_parent'])){
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
|
423 |
$args['post_parent'] = $data['post_parent'];
|
424 |
|
@@ -435,49 +435,49 @@ class acfe_form_post{
|
|
435 |
foreach($terms as $term){
|
436 |
|
437 |
if(is_string($term) || is_numeric($term)){
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
}elseif(is_array($term)){
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
}elseif(is_object($term) && is_a($term, 'WP_Term')){
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
|
478 |
}
|
479 |
-
|
480 |
-
|
481 |
|
482 |
}
|
483 |
|
@@ -506,91 +506,91 @@ class acfe_form_post{
|
|
506 |
|
507 |
}
|
508 |
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
|
518 |
// Update Post
|
519 |
$_post_id = wp_update_post($args);
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
|
595 |
// Submit
|
596 |
do_action('acfe/form/submit/post', $_post_id, $post_action, $args, $form, $action);
|
@@ -726,7 +726,7 @@ class acfe_form_post{
|
|
726 |
|
727 |
}
|
728 |
|
729 |
-
|
730 |
|
731 |
return $field;
|
732 |
|
72 |
// Load values
|
73 |
if(!$load_values)
|
74 |
return $form;
|
75 |
+
|
76 |
+
$_post_id = get_sub_field('acfe_form_post_load_source');
|
77 |
$_post_type = get_sub_field('acfe_form_post_map_post_type');
|
78 |
$_post_status = get_sub_field('acfe_form_post_map_post_status');
|
79 |
$_post_title = get_sub_field('acfe_form_post_map_post_title');
|
85 |
|
86 |
// Map {field:name} {get_field:name} {query_var:name}
|
87 |
$_post_id = acfe_form_map_field_value_load($_post_id, $current_post_id, $form);
|
88 |
+
$_post_type = acfe_form_map_field_value_load($_post_type, $current_post_id, $form);
|
89 |
+
$_post_status = acfe_form_map_field_value_load($_post_status, $current_post_id, $form);
|
90 |
+
$_post_title = acfe_form_map_field_value_load($_post_title, $current_post_id, $form);
|
91 |
+
$_post_name = acfe_form_map_field_value_load($_post_name, $current_post_id, $form);
|
92 |
+
$_post_content = acfe_form_map_field_value_load($_post_content, $current_post_id, $form);
|
93 |
+
$_post_author = acfe_form_map_field_value_load($_post_author, $current_post_id, $form);
|
94 |
+
$_post_parent = acfe_form_map_field_value_load($_post_parent, $current_post_id, $form);
|
95 |
+
$_post_terms = acfe_form_map_field_value_load($_post_terms, $current_post_id, $form);
|
96 |
|
97 |
// Filters
|
98 |
$_post_id = apply_filters('acfe/form/load/post_id', $_post_id, $form, $action);
|
112 |
|
113 |
if($key !== false)
|
114 |
unset($load_meta[$key]);
|
115 |
+
|
116 |
+
$form['map'][$_post_type]['value'] = get_post_field('post_type', $_post_id);
|
117 |
|
118 |
}
|
119 |
|
124 |
|
125 |
if($key !== false)
|
126 |
unset($load_meta[$key]);
|
127 |
+
|
128 |
+
$form['map'][$_post_status]['value'] = get_post_field('post_status', $_post_id);
|
129 |
|
130 |
}
|
131 |
|
136 |
|
137 |
if($key !== false)
|
138 |
unset($load_meta[$key]);
|
139 |
+
|
140 |
+
$form['map'][$_post_title]['value'] = get_post_field('post_title', $_post_id);
|
141 |
|
142 |
}
|
143 |
|
148 |
|
149 |
if($key !== false)
|
150 |
unset($load_meta[$key]);
|
151 |
+
|
152 |
+
$form['map'][$_post_name]['value'] = get_post_field('post_name', $_post_id);
|
153 |
|
154 |
}
|
155 |
|
160 |
|
161 |
if($key !== false)
|
162 |
unset($load_meta[$key]);
|
163 |
+
|
164 |
+
$form['map'][$_post_content]['value'] = get_post_field('post_content', $_post_id);
|
165 |
|
166 |
}
|
167 |
|
172 |
|
173 |
if($key !== false)
|
174 |
unset($load_meta[$key]);
|
175 |
+
|
176 |
+
$form['map'][$_post_author]['value'] = get_post_field('post_author', $_post_id);
|
177 |
|
178 |
}
|
179 |
|
184 |
|
185 |
if($key !== false)
|
186 |
unset($load_meta[$key]);
|
187 |
+
|
188 |
+
$form['map'][$_post_parent]['value'] = get_post_field('post_parent', $_post_id);
|
189 |
|
190 |
}
|
191 |
|
195 |
$key = array_search($_post_terms, $load_meta);
|
196 |
|
197 |
if($key !== false)
|
198 |
+
unset($load_meta[$key]);
|
199 |
+
|
200 |
+
$taxonomies = acf_get_taxonomies(array(
|
201 |
+
'post_type' => get_post_type($_post_id)
|
202 |
+
));
|
203 |
+
|
204 |
+
if(!empty($taxonomies)){
|
205 |
+
|
206 |
+
$terms = array();
|
207 |
+
|
208 |
+
foreach($taxonomies as $taxonomy){
|
209 |
+
|
210 |
+
$get_the_terms = get_the_terms($_post_id, $taxonomy);
|
211 |
+
if(!$get_the_terms || is_wp_error($get_the_terms))
|
212 |
+
continue;
|
213 |
+
|
214 |
+
$terms = array_merge($terms, $get_the_terms);
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
$return = wp_list_pluck($terms, 'term_id');
|
219 |
+
|
220 |
+
$form['map'][$_post_terms]['value'] = $return;
|
221 |
+
|
222 |
+
}
|
223 |
|
224 |
}
|
225 |
|
278 |
$post_action = get_sub_field('acfe_form_post_action');
|
279 |
|
280 |
// Load values
|
281 |
+
$load_values = get_sub_field('acfe_form_post_load_values');
|
282 |
|
283 |
// Pre-process
|
284 |
$_post_content_group = get_sub_field('acfe_form_post_save_post_content_group');
|
291 |
$map = array();
|
292 |
|
293 |
if($load_values){
|
294 |
+
|
295 |
+
// Mapping
|
296 |
+
$map = array(
|
297 |
+
'post_type' => get_sub_field('acfe_form_post_map_post_type'),
|
298 |
+
'post_status' => get_sub_field('acfe_form_post_map_post_status'),
|
299 |
+
'post_title' => get_sub_field('acfe_form_post_map_post_title'),
|
300 |
+
'post_name' => get_sub_field('acfe_form_post_map_post_name'),
|
301 |
+
'post_content' => get_sub_field('acfe_form_post_map_post_content'),
|
302 |
+
'post_author' => get_sub_field('acfe_form_post_map_post_author'),
|
303 |
+
'post_parent' => get_sub_field('acfe_form_post_map_post_parent'),
|
304 |
+
'post_terms' => get_sub_field('acfe_form_post_map_post_terms'),
|
305 |
+
);
|
306 |
+
|
307 |
}
|
308 |
|
309 |
// Fields
|
352 |
if(!empty($data['post_type'])){
|
353 |
|
354 |
if(is_array($data['post_type']))
|
355 |
+
$data['post_type'] = acfe_array_to_string($data['post_type']);
|
356 |
|
357 |
$args['post_type'] = $data['post_type'];
|
358 |
|
360 |
|
361 |
// Post status
|
362 |
if(!empty($data['post_status'])){
|
363 |
+
|
364 |
+
if(is_array($data['post_status']))
|
365 |
+
$data['post_status'] = acfe_array_to_string($data['post_status']);
|
366 |
|
367 |
$args['post_status'] = $data['post_status'];
|
368 |
|
370 |
|
371 |
// Post title
|
372 |
if(!empty($data['post_title'])){
|
373 |
+
|
374 |
+
if(is_array($data['post_title']))
|
375 |
+
$data['post_title'] = acfe_array_to_string($data['post_title']);
|
376 |
|
377 |
$args['post_title'] = $data['post_title'];
|
378 |
|
383 |
|
384 |
// Post name
|
385 |
if(!empty($data['post_name'])){
|
386 |
+
|
387 |
+
if(is_array($data['post_name']))
|
388 |
+
$data['post_name'] = acfe_array_to_string($data['post_name']);
|
389 |
|
390 |
$args['post_name'] = $data['post_name'];
|
391 |
|
396 |
|
397 |
// Post content
|
398 |
if(!empty($data['post_content'])){
|
399 |
+
|
400 |
+
if(is_array($data['post_content']))
|
401 |
+
$data['post_content'] = acfe_array_to_string($data['post_content']);
|
402 |
|
403 |
$args['post_content'] = $data['post_content'];
|
404 |
|
406 |
|
407 |
// Post author
|
408 |
if(!empty($data['post_author'])){
|
409 |
+
|
410 |
+
if(is_array($data['post_author']))
|
411 |
+
$data['post_author'] = acfe_array_to_string($data['post_author']);
|
412 |
|
413 |
$args['post_author'] = $data['post_author'];
|
414 |
|
416 |
|
417 |
// Post parent
|
418 |
if(!empty($data['post_parent'])){
|
419 |
+
|
420 |
+
if(is_array($data['post_author']))
|
421 |
+
$data['post_author'] = acfe_array_to_string($data['post_author']);
|
422 |
|
423 |
$args['post_parent'] = $data['post_parent'];
|
424 |
|
435 |
foreach($terms as $term){
|
436 |
|
437 |
if(is_string($term) || is_numeric($term)){
|
438 |
+
|
439 |
+
$args['acfe_form_terms'][] = $term;
|
440 |
+
|
441 |
}elseif(is_array($term)){
|
442 |
+
|
443 |
+
foreach($term as $sub_term){
|
444 |
+
|
445 |
+
// String || Numeric
|
446 |
+
if(is_string($sub_term) || is_numeric($sub_term)){
|
447 |
+
|
448 |
+
$args['acfe_form_terms'][] = $sub_term;
|
449 |
+
|
450 |
+
// Array
|
451 |
+
}elseif(is_array($sub_term)){
|
452 |
+
|
453 |
+
if(!acf_maybe_get($sub_term, 'term_id'))
|
454 |
+
continue;
|
455 |
+
|
456 |
+
$args['acfe_form_terms'][] = $sub_term['term_id'];
|
457 |
+
|
458 |
+
// Object
|
459 |
+
}elseif(is_object($sub_term) && is_a($sub_term, 'WP_Term')){
|
460 |
+
|
461 |
+
if(!isset($sub_term->term_id) || empty($sub_term->term_id))
|
462 |
+
continue;
|
463 |
+
|
464 |
+
$args['acfe_form_terms'][] = $sub_term->term_id;
|
465 |
+
|
466 |
+
}
|
467 |
+
|
468 |
+
|
469 |
+
}
|
470 |
+
|
471 |
}elseif(is_object($term) && is_a($term, 'WP_Term')){
|
472 |
+
|
473 |
+
if(!isset($term->term_id) || empty($term->term_id))
|
474 |
+
continue;
|
475 |
+
|
476 |
+
$args['acfe_form_terms'][] = $term->term_id;
|
477 |
|
478 |
}
|
479 |
+
|
480 |
+
|
481 |
|
482 |
}
|
483 |
|
506 |
|
507 |
}
|
508 |
|
509 |
+
// Post terms pre-process (let post update first, for post type)
|
510 |
+
$terms = array();
|
511 |
+
|
512 |
+
if(acf_maybe_get($args, 'acfe_form_terms')){
|
513 |
+
|
514 |
+
$terms = acf_extract_var($args, 'acfe_form_terms');
|
515 |
+
|
516 |
+
}
|
517 |
|
518 |
// Update Post
|
519 |
$_post_id = wp_update_post($args);
|
520 |
+
|
521 |
+
// Post terms process
|
522 |
+
if(!empty($terms)){
|
523 |
+
|
524 |
+
$term_objects = array();
|
525 |
+
$term_create = array();
|
526 |
+
|
527 |
+
foreach($terms as $term){
|
528 |
+
|
529 |
+
if(is_numeric($term)){
|
530 |
+
|
531 |
+
$get_term = get_term($term);
|
532 |
+
|
533 |
+
if(empty($get_term) || is_wp_error($get_term))
|
534 |
+
continue;
|
535 |
+
|
536 |
+
$term_objects[$get_term->taxonomy][] = $get_term->term_id;
|
537 |
+
|
538 |
+
}elseif(is_string($term)){
|
539 |
+
|
540 |
+
$explode = explode('|', $term);
|
541 |
+
|
542 |
+
// No taxonomy found in input
|
543 |
+
if(isset($explode[1])){
|
544 |
+
|
545 |
+
$term_create[$explode[1]][] = $explode[0];
|
546 |
+
|
547 |
+
}else{
|
548 |
+
|
549 |
+
// Get post type
|
550 |
+
$post_type = 'post';
|
551 |
+
|
552 |
+
if(isset($args['post_type']))
|
553 |
+
$post_type = $args['post_type'];
|
554 |
+
|
555 |
+
$taxonomies = get_object_taxonomies($post_type);
|
556 |
+
|
557 |
+
if(!empty($taxonomies)){
|
558 |
+
|
559 |
+
$taxonomy = $taxonomies[0];
|
560 |
+
|
561 |
+
$term_create[$taxonomy] = $explode[0];
|
562 |
+
|
563 |
+
}
|
564 |
+
|
565 |
+
}
|
566 |
+
|
567 |
+
}
|
568 |
+
|
569 |
+
}
|
570 |
+
|
571 |
+
// Term Objects
|
572 |
+
if(!empty($term_objects)){
|
573 |
+
|
574 |
+
foreach($term_objects as $term_taxonomy => $term_ids){
|
575 |
+
|
576 |
+
wp_set_object_terms($args['ID'], $term_ids, $term_taxonomy, true);
|
577 |
+
|
578 |
+
}
|
579 |
+
|
580 |
+
}
|
581 |
+
|
582 |
+
// Create Terms (with slugs)
|
583 |
+
if(!empty($term_create)){
|
584 |
+
|
585 |
+
foreach($term_create as $term_taxonomy => $term_slugs){
|
586 |
+
|
587 |
+
wp_set_object_terms($args['ID'], $term_slugs, $term_taxonomy, true);
|
588 |
+
|
589 |
+
}
|
590 |
+
|
591 |
+
}
|
592 |
+
|
593 |
+
}
|
594 |
|
595 |
// Submit
|
596 |
do_action('acfe/form/submit/post', $_post_id, $post_action, $args, $form, $action);
|
726 |
|
727 |
}
|
728 |
|
729 |
+
}
|
730 |
|
731 |
return $field;
|
732 |
|
@@ -91,7 +91,7 @@ class acfe_form_redirect{
|
|
91 |
array(
|
92 |
'key' => 'field_acfe_form_redirect_custom_alias',
|
93 |
'label' => 'Action name',
|
94 |
-
'name' => '
|
95 |
'type' => 'acfe_slug',
|
96 |
'instructions' => '(Optional) Target this action using hooks.',
|
97 |
'required' => 0,
|
91 |
array(
|
92 |
'key' => 'field_acfe_form_redirect_custom_alias',
|
93 |
'label' => 'Action name',
|
94 |
+
'name' => 'acfe_form_custom_alias',
|
95 |
'type' => 'acfe_slug',
|
96 |
'instructions' => '(Optional) Target this action using hooks.',
|
97 |
'required' => 0,
|
@@ -65,8 +65,8 @@ class acfe_form_term{
|
|
65 |
// Load values
|
66 |
if(!$load_values)
|
67 |
return $form;
|
68 |
-
|
69 |
-
|
70 |
$_name = get_sub_field('acfe_form_term_map_name');
|
71 |
$_slug = get_sub_field('acfe_form_term_map_slug');
|
72 |
$_taxonomy = get_sub_field('acfe_form_term_map_taxonomy');
|
@@ -75,11 +75,11 @@ class acfe_form_term{
|
|
75 |
|
76 |
// Map {field:name} {get_field:name} {query_var:name}
|
77 |
$_term_id = acfe_form_map_field_value_load($_term_id, $current_post_id, $form);
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
|
84 |
$_term_id = apply_filters('acfe/form/load/term_id', $_term_id, $form, $action);
|
85 |
$_term_id = apply_filters('acfe/form/load/term_id/form=' . $form_name, $_term_id, $form, $action);
|
@@ -98,8 +98,8 @@ class acfe_form_term{
|
|
98 |
|
99 |
if($key !== false)
|
100 |
unset($load_meta[$key]);
|
101 |
-
|
102 |
-
|
103 |
|
104 |
}
|
105 |
|
@@ -110,8 +110,8 @@ class acfe_form_term{
|
|
110 |
|
111 |
if($key !== false)
|
112 |
unset($load_meta[$key]);
|
113 |
-
|
114 |
-
|
115 |
|
116 |
}
|
117 |
|
@@ -122,8 +122,8 @@ class acfe_form_term{
|
|
122 |
|
123 |
if($key !== false)
|
124 |
unset($load_meta[$key]);
|
125 |
-
|
126 |
-
|
127 |
|
128 |
}
|
129 |
|
@@ -146,8 +146,8 @@ class acfe_form_term{
|
|
146 |
|
147 |
if($key !== false)
|
148 |
unset($load_meta[$key]);
|
149 |
-
|
150 |
-
|
151 |
|
152 |
}
|
153 |
|
@@ -204,9 +204,9 @@ class acfe_form_term{
|
|
204 |
|
205 |
// Action
|
206 |
$term_action = get_sub_field('acfe_form_term_action');
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
|
211 |
// Pre-process
|
212 |
$_description_group = get_sub_field('acfe_form_term_save_description_group');
|
@@ -215,21 +215,21 @@ class acfe_form_term{
|
|
215 |
|
216 |
if($_description === 'custom')
|
217 |
$_description = $_description_custom;
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
|
234 |
// Fields
|
235 |
$fields = array(
|
@@ -264,9 +264,9 @@ class acfe_form_term{
|
|
264 |
|
265 |
// Name
|
266 |
if(!empty($data['name'])){
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
|
271 |
$args['name'] = $data['name'];
|
272 |
|
@@ -274,9 +274,9 @@ class acfe_form_term{
|
|
274 |
|
275 |
// Slug
|
276 |
if(!empty($data['slug'])){
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
|
281 |
$args['slug'] = $data['slug'];
|
282 |
|
@@ -284,9 +284,9 @@ class acfe_form_term{
|
|
284 |
|
285 |
// Taxonomy
|
286 |
if(!empty($data['taxonomy'])){
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
|
291 |
$args['taxonomy'] = $data['taxonomy'];
|
292 |
|
@@ -294,9 +294,9 @@ class acfe_form_term{
|
|
294 |
|
295 |
// Parent
|
296 |
if(!empty($data['parent'])){
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
|
301 |
$args['parent'] = $data['parent'];
|
302 |
|
@@ -304,9 +304,9 @@ class acfe_form_term{
|
|
304 |
|
305 |
// Description
|
306 |
if(!empty($data['description'])){
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
|
311 |
$args['description'] = $data['description'];
|
312 |
|
65 |
// Load values
|
66 |
if(!$load_values)
|
67 |
return $form;
|
68 |
+
|
69 |
+
$_term_id = get_sub_field('acfe_form_term_load_source');
|
70 |
$_name = get_sub_field('acfe_form_term_map_name');
|
71 |
$_slug = get_sub_field('acfe_form_term_map_slug');
|
72 |
$_taxonomy = get_sub_field('acfe_form_term_map_taxonomy');
|
75 |
|
76 |
// Map {field:name} {get_field:name} {query_var:name}
|
77 |
$_term_id = acfe_form_map_field_value_load($_term_id, $current_post_id, $form);
|
78 |
+
$_name = acfe_form_map_field_value_load($_name, $current_post_id, $form);
|
79 |
+
$_slug = acfe_form_map_field_value_load($_slug, $current_post_id, $form);
|
80 |
+
$_taxonomy = acfe_form_map_field_value_load($_taxonomy, $current_post_id, $form);
|
81 |
+
$_parent = acfe_form_map_field_value_load($_parent, $current_post_id, $form);
|
82 |
+
$_description = acfe_form_map_field_value_load($_description, $current_post_id, $form);
|
83 |
|
84 |
$_term_id = apply_filters('acfe/form/load/term_id', $_term_id, $form, $action);
|
85 |
$_term_id = apply_filters('acfe/form/load/term_id/form=' . $form_name, $_term_id, $form, $action);
|
98 |
|
99 |
if($key !== false)
|
100 |
unset($load_meta[$key]);
|
101 |
+
|
102 |
+
$form['map'][$_name]['value'] = get_term_field('name', $_term_id);
|
103 |
|
104 |
}
|
105 |
|
110 |
|
111 |
if($key !== false)
|
112 |
unset($load_meta[$key]);
|
113 |
+
|
114 |
+
$form['map'][$_slug]['value'] = get_term_field('slug', $_term_id);
|
115 |
|
116 |
}
|
117 |
|
122 |
|
123 |
if($key !== false)
|
124 |
unset($load_meta[$key]);
|
125 |
+
|
126 |
+
$form['map'][$_taxonomy]['value'] = get_term_field('taxonomy', $_term_id);
|
127 |
|
128 |
}
|
129 |
|
146 |
|
147 |
if($key !== false)
|
148 |
unset($load_meta[$key]);
|
149 |
+
|
150 |
+
$form['map'][$_description]['value'] = get_term_field('description', $_term_id);
|
151 |
|
152 |
}
|
153 |
|
204 |
|
205 |
// Action
|
206 |
$term_action = get_sub_field('acfe_form_term_action');
|
207 |
+
|
208 |
+
// Load values
|
209 |
+
$load_values = get_sub_field('acfe_form_term_load_values');
|
210 |
|
211 |
// Pre-process
|
212 |
$_description_group = get_sub_field('acfe_form_term_save_description_group');
|
215 |
|
216 |
if($_description === 'custom')
|
217 |
$_description = $_description_custom;
|
218 |
+
|
219 |
+
$map = array();
|
220 |
+
|
221 |
+
if($load_values){
|
222 |
+
|
223 |
+
// Mapping
|
224 |
+
$map = array(
|
225 |
+
'name' => get_sub_field( 'acfe_form_term_map_name' ),
|
226 |
+
'slug' => get_sub_field( 'acfe_form_term_map_slug' ),
|
227 |
+
'taxonomy' => get_sub_field( 'acfe_form_term_map_taxonomy' ),
|
228 |
+
'parent' => get_sub_field( 'acfe_form_term_map_parent' ),
|
229 |
+
'description' => get_sub_field( 'acfe_form_term_map_description' ),
|
230 |
+
);
|
231 |
+
|
232 |
+
}
|
233 |
|
234 |
// Fields
|
235 |
$fields = array(
|
264 |
|
265 |
// Name
|
266 |
if(!empty($data['name'])){
|
267 |
+
|
268 |
+
if(is_array($data['name']))
|
269 |
+
$data['name'] = acfe_array_to_string($data['name']);
|
270 |
|
271 |
$args['name'] = $data['name'];
|
272 |
|
274 |
|
275 |
// Slug
|
276 |
if(!empty($data['slug'])){
|
277 |
+
|
278 |
+
if(is_array($data['name']))
|
279 |
+
$data['name'] = acfe_array_to_string($data['name']);
|
280 |
|
281 |
$args['slug'] = $data['slug'];
|
282 |
|
284 |
|
285 |
// Taxonomy
|
286 |
if(!empty($data['taxonomy'])){
|
287 |
+
|
288 |
+
if(is_array($data['name']))
|
289 |
+
$data['name'] = acfe_array_to_string($data['name']);
|
290 |
|
291 |
$args['taxonomy'] = $data['taxonomy'];
|
292 |
|
294 |
|
295 |
// Parent
|
296 |
if(!empty($data['parent'])){
|
297 |
+
|
298 |
+
if(is_array($data['name']))
|
299 |
+
$data['name'] = acfe_array_to_string($data['name']);
|
300 |
|
301 |
$args['parent'] = $data['parent'];
|
302 |
|
304 |
|
305 |
// Description
|
306 |
if(!empty($data['description'])){
|
307 |
+
|
308 |
+
if(is_array($data['name']))
|
309 |
+
$data['name'] = acfe_array_to_string($data['name']);
|
310 |
|
311 |
$args['description'] = $data['description'];
|
312 |
|
@@ -71,10 +71,10 @@ class acfe_form_user{
|
|
71 |
|
72 |
// Action
|
73 |
$user_action = get_sub_field('acfe_form_user_action');
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
|
79 |
// Load values
|
80 |
$load_values = get_sub_field('acfe_form_user_load_values');
|
@@ -83,8 +83,8 @@ class acfe_form_user{
|
|
83 |
// Load values
|
84 |
if(!$load_values)
|
85 |
return $form;
|
86 |
-
|
87 |
-
|
88 |
$_email = get_sub_field('acfe_form_user_map_email');
|
89 |
$_username = get_sub_field('acfe_form_user_map_username');
|
90 |
$_password = get_sub_field('acfe_form_user_map_password');
|
@@ -98,16 +98,16 @@ class acfe_form_user{
|
|
98 |
|
99 |
// Map {field:name} {get_field:name} {query_var:name}
|
100 |
$_user_id = acfe_form_map_field_value_load($_user_id, $current_post_id, $form);
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
|
112 |
$_user_id = apply_filters('acfe/form/load/user_id', $_user_id, $form, $action);
|
113 |
$_user_id = apply_filters('acfe/form/load/user_id/form=' . $form_name, $_user_id, $form, $action);
|
@@ -132,8 +132,8 @@ class acfe_form_user{
|
|
132 |
|
133 |
if($key !== false)
|
134 |
unset($load_meta[$key]);
|
135 |
-
|
136 |
-
|
137 |
|
138 |
}
|
139 |
|
@@ -144,9 +144,9 @@ class acfe_form_user{
|
|
144 |
|
145 |
if($key !== false)
|
146 |
unset($load_meta[$key]);
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
|
151 |
}
|
152 |
|
@@ -157,8 +157,8 @@ class acfe_form_user{
|
|
157 |
|
158 |
if($key !== false)
|
159 |
unset($load_meta[$key]);
|
160 |
-
|
161 |
-
|
162 |
|
163 |
}
|
164 |
|
@@ -169,8 +169,8 @@ class acfe_form_user{
|
|
169 |
|
170 |
if($key !== false)
|
171 |
unset($load_meta[$key]);
|
172 |
-
|
173 |
-
|
174 |
|
175 |
}
|
176 |
|
@@ -181,8 +181,8 @@ class acfe_form_user{
|
|
181 |
|
182 |
if($key !== false)
|
183 |
unset($load_meta[$key]);
|
184 |
-
|
185 |
-
|
186 |
|
187 |
}
|
188 |
|
@@ -193,8 +193,8 @@ class acfe_form_user{
|
|
193 |
|
194 |
if($key !== false)
|
195 |
unset($load_meta[$key]);
|
196 |
-
|
197 |
-
|
198 |
|
199 |
}
|
200 |
|
@@ -205,8 +205,8 @@ class acfe_form_user{
|
|
205 |
|
206 |
if($key !== false)
|
207 |
unset($load_meta[$key]);
|
208 |
-
|
209 |
-
|
210 |
|
211 |
}
|
212 |
|
@@ -217,8 +217,8 @@ class acfe_form_user{
|
|
217 |
|
218 |
if($key !== false)
|
219 |
unset($load_meta[$key]);
|
220 |
-
|
221 |
-
|
222 |
|
223 |
}
|
224 |
|
@@ -229,8 +229,8 @@ class acfe_form_user{
|
|
229 |
|
230 |
if($key !== false)
|
231 |
unset($load_meta[$key]);
|
232 |
-
|
233 |
-
|
234 |
|
235 |
}
|
236 |
|
@@ -241,8 +241,8 @@ class acfe_form_user{
|
|
241 |
|
242 |
if($key !== false)
|
243 |
unset($load_meta[$key]);
|
244 |
-
|
245 |
-
|
246 |
|
247 |
}
|
248 |
|
@@ -293,16 +293,16 @@ class acfe_form_user{
|
|
293 |
$form_id = acf_maybe_get($form, 'ID');
|
294 |
|
295 |
// Fields
|
296 |
-
|
297 |
'type' => get_sub_field('acfe_form_user_log_type'),
|
298 |
'login' => get_sub_field('acfe_form_user_save_login_user'),
|
299 |
'pass' => get_sub_field('acfe_form_user_save_login_pass'),
|
300 |
);
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
'empty_user_pass' => 'An error has occured. Please try again',
|
307 |
'invalid_email' => 'Invalid e-mail',
|
308 |
'invalid_email_password' => 'Invalid e-mail or password',
|
@@ -311,9 +311,9 @@ class acfe_form_user{
|
|
311 |
);
|
312 |
|
313 |
$errors = apply_filters('acfe/form/validation/user/login_errors', $errors);
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
|
318 |
// Email
|
319 |
if(!empty($data['login'])){
|
@@ -436,9 +436,9 @@ class acfe_form_user{
|
|
436 |
|
437 |
// Action
|
438 |
$user_action = get_sub_field('acfe_form_user_action');
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
|
443 |
// Pre-process
|
444 |
$_description_group = get_sub_field('acfe_form_user_save_description_group');
|
@@ -447,26 +447,26 @@ class acfe_form_user{
|
|
447 |
|
448 |
if($_description === 'custom')
|
449 |
$_description = $_description_custom;
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
|
471 |
// Fields
|
472 |
$fields = array(
|
@@ -516,9 +516,9 @@ class acfe_form_user{
|
|
516 |
|
517 |
// Email
|
518 |
if(!empty($data['user_email'])){
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
|
523 |
$args['user_email'] = $data['user_email'];
|
524 |
|
@@ -526,9 +526,9 @@ class acfe_form_user{
|
|
526 |
|
527 |
// Username
|
528 |
if(!empty($data['user_login'])){
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
|
533 |
$args['user_login'] = $data['user_login'];
|
534 |
|
@@ -536,9 +536,9 @@ class acfe_form_user{
|
|
536 |
|
537 |
// Password
|
538 |
if(!empty($data['user_pass'])){
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
|
543 |
$args['user_pass'] = $data['user_pass'];
|
544 |
|
@@ -546,9 +546,9 @@ class acfe_form_user{
|
|
546 |
|
547 |
// First name
|
548 |
if(!empty($data['first_name'])){
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
|
553 |
$args['first_name'] = $data['first_name'];
|
554 |
|
@@ -556,9 +556,9 @@ class acfe_form_user{
|
|
556 |
|
557 |
// Last name
|
558 |
if(!empty($data['last_name'])){
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
|
563 |
$args['last_name'] = $data['last_name'];
|
564 |
|
@@ -566,9 +566,9 @@ class acfe_form_user{
|
|
566 |
|
567 |
// Nickname
|
568 |
if(!empty($data['nickname'])){
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
|
573 |
$args['nickname'] = $data['nickname'];
|
574 |
|
@@ -576,9 +576,9 @@ class acfe_form_user{
|
|
576 |
|
577 |
// Display name
|
578 |
if(!empty($data['display_name'])){
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
|
583 |
$args['display_name'] = $data['display_name'];
|
584 |
|
@@ -586,9 +586,9 @@ class acfe_form_user{
|
|
586 |
|
587 |
// Website
|
588 |
if(!empty($data['user_url'])){
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
|
593 |
$args['user_url'] = $data['user_url'];
|
594 |
|
@@ -596,9 +596,9 @@ class acfe_form_user{
|
|
596 |
|
597 |
// Description
|
598 |
if(!empty($data['description'])){
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
|
603 |
$args['description'] = $data['description'];
|
604 |
|
@@ -606,9 +606,9 @@ class acfe_form_user{
|
|
606 |
|
607 |
// Role
|
608 |
if(!empty($data['role'])){
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
|
613 |
$args['role'] = $data['role'];
|
614 |
|
@@ -619,9 +619,9 @@ class acfe_form_user{
|
|
619 |
|
620 |
if(!empty($action))
|
621 |
$args = apply_filters('acfe/form/submit/user_args/action=' . $action, $args, $user_action, $form, $action);
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
|
626 |
// Insert User
|
627 |
if($user_action === 'insert_user'){
|
@@ -631,12 +631,12 @@ class acfe_form_user{
|
|
631 |
return false;
|
632 |
|
633 |
// No login? Fallback to e-mail
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
|
641 |
}
|
642 |
|
@@ -726,9 +726,9 @@ class acfe_form_user{
|
|
726 |
elseif($user_action === 'log_user'){
|
727 |
|
728 |
$_insert_user = false;
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
$_login_remember = false;
|
733 |
|
734 |
// Email
|
@@ -747,8 +747,8 @@ class acfe_form_user{
|
|
747 |
|
748 |
// Remember me
|
749 |
if(!empty($data['login_remember'])){
|
750 |
-
|
751 |
-
|
752 |
|
753 |
}
|
754 |
|
@@ -786,8 +786,8 @@ class acfe_form_user{
|
|
786 |
}
|
787 |
|
788 |
}
|
789 |
-
|
790 |
-
|
791 |
|
792 |
// Login
|
793 |
$_insert_user = wp_signon(array(
|
71 |
|
72 |
// Action
|
73 |
$user_action = get_sub_field('acfe_form_user_action');
|
74 |
+
|
75 |
+
// Bail early if Log user
|
76 |
+
if($user_action === 'log_user')
|
77 |
+
return $form;
|
78 |
|
79 |
// Load values
|
80 |
$load_values = get_sub_field('acfe_form_user_load_values');
|
83 |
// Load values
|
84 |
if(!$load_values)
|
85 |
return $form;
|
86 |
+
|
87 |
+
$_user_id = get_sub_field('acfe_form_user_load_source');
|
88 |
$_email = get_sub_field('acfe_form_user_map_email');
|
89 |
$_username = get_sub_field('acfe_form_user_map_username');
|
90 |
$_password = get_sub_field('acfe_form_user_map_password');
|
98 |
|
99 |
// Map {field:name} {get_field:name} {query_var:name}
|
100 |
$_user_id = acfe_form_map_field_value_load($_user_id, $current_post_id, $form);
|
101 |
+
$_email = acfe_form_map_field_value_load($_email, $current_post_id, $form);
|
102 |
+
$_username = acfe_form_map_field_value_load($_username, $current_post_id, $form);
|
103 |
+
$_password = acfe_form_map_field_value_load($_password, $current_post_id, $form);
|
104 |
+
$_first_name = acfe_form_map_field_value_load($_first_name, $current_post_id, $form);
|
105 |
+
$_last_name = acfe_form_map_field_value_load($_last_name, $current_post_id, $form);
|
106 |
+
$_nickname = acfe_form_map_field_value_load($_nickname, $current_post_id, $form);
|
107 |
+
$_display_name = acfe_form_map_field_value_load($_display_name, $current_post_id, $form);
|
108 |
+
$_website = acfe_form_map_field_value_load($_website, $current_post_id, $form);
|
109 |
+
$_description = acfe_form_map_field_value_load($_description, $current_post_id, $form);
|
110 |
+
$_role = acfe_form_map_field_value_load($_role, $current_post_id, $form);
|
111 |
|
112 |
$_user_id = apply_filters('acfe/form/load/user_id', $_user_id, $form, $action);
|
113 |
$_user_id = apply_filters('acfe/form/load/user_id/form=' . $form_name, $_user_id, $form, $action);
|
132 |
|
133 |
if($key !== false)
|
134 |
unset($load_meta[$key]);
|
135 |
+
|
136 |
+
$form['map'][$_email]['value'] = $user_data->user_email;
|
137 |
|
138 |
}
|
139 |
|
144 |
|
145 |
if($key !== false)
|
146 |
unset($load_meta[$key]);
|
147 |
+
|
148 |
+
$form['map'][$_username]['value'] = $user_data->user_login;
|
149 |
+
$form['map'][$_username]['maxlength'] = 60;
|
150 |
|
151 |
}
|
152 |
|
157 |
|
158 |
if($key !== false)
|
159 |
unset($load_meta[$key]);
|
160 |
+
|
161 |
+
//$form['map'][$_password]['value'] = $user_data->user_pass;
|
162 |
|
163 |
}
|
164 |
|
169 |
|
170 |
if($key !== false)
|
171 |
unset($load_meta[$key]);
|
172 |
+
|
173 |
+
$form['map'][$_first_name]['value'] = $user_data->first_name;
|
174 |
|
175 |
}
|
176 |
|
181 |
|
182 |
if($key !== false)
|
183 |
unset($load_meta[$key]);
|
184 |
+
|
185 |
+
$form['map'][$_last_name]['value'] = $user_data->last_name;
|
186 |
|
187 |
}
|
188 |
|
193 |
|
194 |
if($key !== false)
|
195 |
unset($load_meta[$key]);
|
196 |
+
|
197 |
+
$form['map'][$_nickname]['value'] = $user_data->nickname;
|
198 |
|
199 |
}
|
200 |
|
205 |
|
206 |
if($key !== false)
|
207 |
unset($load_meta[$key]);
|
208 |
+
|
209 |
+
$form['map'][$_display_name]['value'] = $user_data->display_name;
|
210 |
|
211 |
}
|
212 |
|
217 |
|
218 |
if($key !== false)
|
219 |
unset($load_meta[$key]);
|
220 |
+
|
221 |
+
$form['map'][$_website]['value'] = $user_data->website;
|
222 |
|
223 |
}
|
224 |
|
229 |
|
230 |
if($key !== false)
|
231 |
unset($load_meta[$key]);
|
232 |
+
|
233 |
+
$form['map'][$_description]['value'] = $user_data->description;
|
234 |
|
235 |
}
|
236 |
|
241 |
|
242 |
if($key !== false)
|
243 |
unset($load_meta[$key]);
|
244 |
+
|
245 |
+
$form['map'][$_role]['value'] = implode(', ', $user_data->roles);
|
246 |
|
247 |
}
|
248 |
|
293 |
$form_id = acf_maybe_get($form, 'ID');
|
294 |
|
295 |
// Fields
|
296 |
+
$data = array(
|
297 |
'type' => get_sub_field('acfe_form_user_log_type'),
|
298 |
'login' => get_sub_field('acfe_form_user_save_login_user'),
|
299 |
'pass' => get_sub_field('acfe_form_user_save_login_pass'),
|
300 |
);
|
301 |
+
|
302 |
+
$data['login'] = acfe_form_map_field_value($data['login'], $current_post_id, $form);
|
303 |
+
$data['pass'] = acfe_form_map_field_value($data['pass'], $current_post_id, $form);
|
304 |
+
|
305 |
+
$errors = array(
|
306 |
'empty_user_pass' => 'An error has occured. Please try again',
|
307 |
'invalid_email' => 'Invalid e-mail',
|
308 |
'invalid_email_password' => 'Invalid e-mail or password',
|
311 |
);
|
312 |
|
313 |
$errors = apply_filters('acfe/form/validation/user/login_errors', $errors);
|
314 |
+
|
315 |
+
$login = false;
|
316 |
+
$pass = false;
|
317 |
|
318 |
// Email
|
319 |
if(!empty($data['login'])){
|
436 |
|
437 |
// Action
|
438 |
$user_action = get_sub_field('acfe_form_user_action');
|
439 |
+
|
440 |
+
// Load values
|
441 |
+
$load_values = get_sub_field('acfe_form_user_load_values');
|
442 |
|
443 |
// Pre-process
|
444 |
$_description_group = get_sub_field('acfe_form_user_save_description_group');
|
447 |
|
448 |
if($_description === 'custom')
|
449 |
$_description = $_description_custom;
|
450 |
+
|
451 |
+
$map = array();
|
452 |
+
|
453 |
+
if($load_values){
|
454 |
+
|
455 |
+
// Mapping
|
456 |
+
$map = array(
|
457 |
+
'user_email' => get_sub_field( 'acfe_form_user_map_email' ),
|
458 |
+
'user_login' => get_sub_field( 'acfe_form_user_map_username' ),
|
459 |
+
'user_pass' => get_sub_field( 'acfe_form_user_map_password' ),
|
460 |
+
'first_name' => get_sub_field( 'acfe_form_user_map_first_name' ),
|
461 |
+
'last_name' => get_sub_field( 'acfe_form_user_map_last_name' ),
|
462 |
+
'nickname' => get_sub_field( 'acfe_form_user_map_nickname' ),
|
463 |
+
'display_name' => get_sub_field( 'acfe_form_user_map_display_name' ),
|
464 |
+
'user_url' => get_sub_field( 'acfe_form_user_map_website' ),
|
465 |
+
'description' => get_sub_field( 'acfe_form_user_map_description' ),
|
466 |
+
'role' => get_sub_field( 'acfe_form_user_map_role' ),
|
467 |
+
);
|
468 |
+
|
469 |
+
}
|
470 |
|
471 |
// Fields
|
472 |
$fields = array(
|
516 |
|
517 |
// Email
|
518 |
if(!empty($data['user_email'])){
|
519 |
+
|
520 |
+
if(is_array($data['user_email']))
|
521 |
+
$data['user_email'] = acfe_array_to_string($data['user_email']);
|
522 |
|
523 |
$args['user_email'] = $data['user_email'];
|
524 |
|
526 |
|
527 |
// Username
|
528 |
if(!empty($data['user_login'])){
|
529 |
+
|
530 |
+
if(is_array($data['user_login']))
|
531 |
+
$data['user_login'] = acfe_array_to_string($data['user_login']);
|
532 |
|
533 |
$args['user_login'] = $data['user_login'];
|
534 |
|
536 |
|
537 |
// Password
|
538 |
if(!empty($data['user_pass'])){
|
539 |
+
|
540 |
+
if(is_array($data['user_pass']))
|
541 |
+
$data['user_pass'] = acfe_array_to_string($data['user_pass']);
|
542 |
|
543 |
$args['user_pass'] = $data['user_pass'];
|
544 |
|
546 |
|
547 |
// First name
|
548 |
if(!empty($data['first_name'])){
|
549 |
+
|
550 |
+
if(is_array($data['first_name']))
|
551 |
+
$data['first_name'] = acfe_array_to_string($data['first_name']);
|
552 |
|
553 |
$args['first_name'] = $data['first_name'];
|
554 |
|
556 |
|
557 |
// Last name
|
558 |
if(!empty($data['last_name'])){
|
559 |
+
|
560 |
+
if(is_array($data['last_name']))
|
561 |
+
$data['last_name'] = acfe_array_to_string($data['last_name']);
|
562 |
|
563 |
$args['last_name'] = $data['last_name'];
|
564 |
|
566 |
|
567 |
// Nickname
|
568 |
if(!empty($data['nickname'])){
|
569 |
+
|
570 |
+
if(is_array($data['nickname']))
|
571 |
+
$data['nickname'] = acfe_array_to_string($data['nickname']);
|
572 |
|
573 |
$args['nickname'] = $data['nickname'];
|
574 |
|
576 |
|
577 |
// Display name
|
578 |
if(!empty($data['display_name'])){
|
579 |
+
|
580 |
+
if(is_array($data['display_name']))
|
581 |
+
$data['display_name'] = acfe_array_to_string($data['display_name']);
|
582 |
|
583 |
$args['display_name'] = $data['display_name'];
|
584 |
|
586 |
|
587 |
// Website
|
588 |
if(!empty($data['user_url'])){
|
589 |
+
|
590 |
+
if(is_array($data['user_url']))
|
591 |
+
$data['user_url'] = acfe_array_to_string($data['user_url']);
|
592 |
|
593 |
$args['user_url'] = $data['user_url'];
|
594 |
|
596 |
|
597 |
// Description
|
598 |
if(!empty($data['description'])){
|
599 |
+
|
600 |
+
if(is_array($data['description']))
|
601 |
+
$data['description'] = acfe_array_to_string($data['description']);
|
602 |
|
603 |
$args['description'] = $data['description'];
|
604 |
|
606 |
|
607 |
// Role
|
608 |
if(!empty($data['role'])){
|
609 |
+
|
610 |
+
if(is_array($data['role']))
|
611 |
+
$data['role'] = acfe_array_to_string($data['role']);
|
612 |
|
613 |
$args['role'] = $data['role'];
|
614 |
|
619 |
|
620 |
if(!empty($action))
|
621 |
$args = apply_filters('acfe/form/submit/user_args/action=' . $action, $args, $user_action, $form, $action);
|
622 |
+
|
623 |
+
if($args === false)
|
624 |
+
return false;
|
625 |
|
626 |
// Insert User
|
627 |
if($user_action === 'insert_user'){
|
631 |
return false;
|
632 |
|
633 |
// No login? Fallback to e-mail
|
634 |
+
if(!isset($args['user_login']))
|
635 |
+
$args['user_login'] = $args['user_email'];
|
636 |
+
|
637 |
+
// No password? Fallback to generated password
|
638 |
+
if(!isset($args['user_pass']))
|
639 |
+
$args['user_pass'] = wp_generate_password(8, false);
|
640 |
|
641 |
}
|
642 |
|
726 |
elseif($user_action === 'log_user'){
|
727 |
|
728 |
$_insert_user = false;
|
729 |
+
|
730 |
+
$_login_user = false;
|
731 |
+
$_login_pass = false;
|
732 |
$_login_remember = false;
|
733 |
|
734 |
// Email
|
747 |
|
748 |
// Remember me
|
749 |
if(!empty($data['login_remember'])){
|
750 |
+
|
751 |
+
$_login_remember = $data['login_remember'];
|
752 |
|
753 |
}
|
754 |
|
786 |
}
|
787 |
|
788 |
}
|
789 |
+
|
790 |
+
$_login_remember = boolval($_login_remember);
|
791 |
|
792 |
// Login
|
793 |
$_insert_user = wp_signon(array(
|
@@ -12,13 +12,13 @@ class acfe_form_front{
|
|
12 |
// vars
|
13 |
$this->fields = array(
|
14 |
'_validate_email' => array(
|
15 |
-
'prefix'
|
16 |
-
'name'
|
17 |
-
'key'
|
18 |
-
'label'
|
19 |
-
'type'
|
20 |
-
'value'
|
21 |
-
'wrapper'
|
22 |
)
|
23 |
);
|
24 |
|
@@ -26,7 +26,7 @@ class acfe_form_front{
|
|
26 |
add_action('wp', array($this, 'check_submit_form'));
|
27 |
|
28 |
// Shortcode
|
29 |
-
add_shortcode('acfe_form',
|
30 |
|
31 |
// Validation
|
32 |
add_action('acf/validate_save_post', array($this, 'validate_save_post'), 1);
|
@@ -54,27 +54,27 @@ class acfe_form_front{
|
|
54 |
return;
|
55 |
|
56 |
foreach($this->fields as $k => $field){
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
continue;
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
|
67 |
// Honeypot
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
|
74 |
// Validation
|
75 |
acfe_setup_meta($_POST['acf'], 'acfe/form/validation', true);
|
76 |
-
|
77 |
-
|
78 |
|
79 |
// Actions
|
80 |
if(have_rows('acfe_form_actions', $form_id)):
|
@@ -83,15 +83,15 @@ class acfe_form_front{
|
|
83 |
|
84 |
$action = get_row_layout();
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
|
96 |
$rows[] = array(
|
97 |
'action' => $action,
|
@@ -125,8 +125,8 @@ class acfe_form_front{
|
|
125 |
function check_submit_form(){
|
126 |
|
127 |
// Verify nonce.
|
128 |
-
|
129 |
-
|
130 |
|
131 |
$form = acfe_form_decrypt_args();
|
132 |
|
@@ -135,26 +135,26 @@ class acfe_form_front{
|
|
135 |
|
136 |
// ACF
|
137 |
$_POST['acf'] = isset($_POST['acf']) ? $_POST['acf'] : array();
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
|
142 |
-
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
|
152 |
}
|
153 |
|
154 |
function submit_form($form){
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
$form_name = acf_maybe_get($form, 'name');
|
159 |
$form_id = acf_maybe_get($form, 'ID');
|
160 |
|
@@ -211,8 +211,8 @@ class acfe_form_front{
|
|
211 |
exit;
|
212 |
|
213 |
}
|
214 |
-
|
215 |
-
|
216 |
|
217 |
function validate_form($param){
|
218 |
|
@@ -322,7 +322,7 @@ class acfe_form_front{
|
|
322 |
'errors_class' => get_field('acfe_form_errors_class', $form_id),
|
323 |
'updated_message' => get_field('acfe_form_updated_message', $form_id),
|
324 |
'html_updated_message' => get_field('acfe_form_html_updated_message', $form_id),
|
325 |
-
'updated_hide_form'
|
326 |
'return' => get_field('acfe_form_return', $form_id), // Deprecated
|
327 |
|
328 |
// Advanced
|
@@ -389,24 +389,24 @@ class acfe_form_front{
|
|
389 |
if(have_rows('acfe_form_actions', $form_id)):
|
390 |
while(have_rows('acfe_form_actions', $form_id)): the_row();
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
endwhile;
|
411 |
endif;
|
412 |
|
@@ -446,11 +446,11 @@ class acfe_form_front{
|
|
446 |
}
|
447 |
|
448 |
// Register local fields.
|
449 |
-
|
450 |
|
451 |
-
|
452 |
|
453 |
-
|
454 |
|
455 |
// honeypot
|
456 |
if($args['honeypot']){
|
@@ -539,12 +539,12 @@ class acfe_form_front{
|
|
539 |
}
|
540 |
|
541 |
// uploader (always set incase of multiple forms on the page)
|
542 |
-
|
543 |
|
544 |
if($args['uploader'] !== 'default'){
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
|
549 |
}
|
550 |
|
@@ -555,8 +555,12 @@ class acfe_form_front{
|
|
555 |
$wrapper = $args['form'] ? 'form' : 'div';
|
556 |
|
557 |
?>
|
|
|
|
|
558 |
|
559 |
<<?php echo $wrapper; ?> <?php acf_esc_attr_e($args['form_attributes']); ?>>
|
|
|
|
|
560 |
|
561 |
<?php
|
562 |
|
@@ -564,9 +568,9 @@ class acfe_form_front{
|
|
564 |
|
565 |
// render post data
|
566 |
acf_form_data(array(
|
567 |
-
'screen'
|
568 |
-
'post_id'
|
569 |
-
'form'
|
570 |
));
|
571 |
|
572 |
}
|
@@ -592,95 +596,95 @@ class acfe_form_front{
|
|
592 |
|
593 |
// Normal Render
|
594 |
else{
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
|
685 |
acf_render_fields($fields, acf_uniqid('acfe_form'), $args['field_el'], $args['instruction_placement']);
|
686 |
|
@@ -703,8 +707,12 @@ class acfe_form_front{
|
|
703 |
</div>
|
704 |
|
705 |
<?php endif; ?>
|
|
|
|
|
706 |
|
707 |
</<?php echo $wrapper; ?>>
|
|
|
|
|
708 |
|
709 |
<?php
|
710 |
|
12 |
// vars
|
13 |
$this->fields = array(
|
14 |
'_validate_email' => array(
|
15 |
+
'prefix' => 'acf',
|
16 |
+
'name' => '_validate_email',
|
17 |
+
'key' => '_validate_email',
|
18 |
+
'label' => __('Validate Email', 'acf'),
|
19 |
+
'type' => 'text',
|
20 |
+
'value' => '',
|
21 |
+
'wrapper' => array('style' => 'display:none !important;')
|
22 |
)
|
23 |
);
|
24 |
|
26 |
add_action('wp', array($this, 'check_submit_form'));
|
27 |
|
28 |
// Shortcode
|
29 |
+
add_shortcode('acfe_form', array($this, 'add_shortcode'));
|
30 |
|
31 |
// Validation
|
32 |
add_action('acf/validate_save_post', array($this, 'validate_save_post'), 1);
|
54 |
return;
|
55 |
|
56 |
foreach($this->fields as $k => $field){
|
57 |
+
|
58 |
+
// bail early if no in $_POST
|
59 |
+
if(!isset($_POST['acf'][ $k ]))
|
60 |
continue;
|
61 |
+
|
62 |
+
// register
|
63 |
+
acf_add_local_field($field);
|
64 |
+
|
65 |
+
}
|
66 |
|
67 |
// Honeypot
|
68 |
+
if(!empty($acf['_validate_email'])){
|
69 |
+
|
70 |
+
acf_add_validation_error('', __('Spam Detected', 'acf'));
|
71 |
+
|
72 |
+
}
|
73 |
|
74 |
// Validation
|
75 |
acfe_setup_meta($_POST['acf'], 'acfe/form/validation', true);
|
76 |
+
|
77 |
+
$rows = array();
|
78 |
|
79 |
// Actions
|
80 |
if(have_rows('acfe_form_actions', $form_id)):
|
83 |
|
84 |
$action = get_row_layout();
|
85 |
|
86 |
+
$alias = get_sub_field('acfe_form_custom_alias');
|
87 |
+
|
88 |
+
// Custom Action
|
89 |
+
if($action === 'custom'){
|
90 |
+
|
91 |
+
$action = get_sub_field('acfe_form_custom_action');
|
92 |
+
$alias = '';
|
93 |
+
|
94 |
+
}
|
95 |
|
96 |
$rows[] = array(
|
97 |
'action' => $action,
|
125 |
function check_submit_form(){
|
126 |
|
127 |
// Verify nonce.
|
128 |
+
if(!acf_verify_nonce('acfe_form'))
|
129 |
+
return;
|
130 |
|
131 |
$form = acfe_form_decrypt_args();
|
132 |
|
135 |
|
136 |
// ACF
|
137 |
$_POST['acf'] = isset($_POST['acf']) ? $_POST['acf'] : array();
|
138 |
+
|
139 |
+
// Run kses on all $_POST data.
|
140 |
+
if($form['kses'] && isset($_POST['acf'])){
|
141 |
|
142 |
+
$_POST['acf'] = wp_kses_post_deep($_POST['acf']);
|
143 |
|
144 |
+
}
|
145 |
+
|
146 |
+
// Validate data and show errors.
|
147 |
+
acf_validate_save_post(true);
|
148 |
+
|
149 |
+
// Submit form.
|
150 |
+
$this->submit_form($form);
|
151 |
|
152 |
}
|
153 |
|
154 |
function submit_form($form){
|
155 |
+
|
156 |
+
// vars
|
157 |
+
$post_id = acf_maybe_get($form, 'post_id', false);
|
158 |
$form_name = acf_maybe_get($form, 'name');
|
159 |
$form_id = acf_maybe_get($form, 'ID');
|
160 |
|
211 |
exit;
|
212 |
|
213 |
}
|
214 |
+
|
215 |
+
}
|
216 |
|
217 |
function validate_form($param){
|
218 |
|
322 |
'errors_class' => get_field('acfe_form_errors_class', $form_id),
|
323 |
'updated_message' => get_field('acfe_form_updated_message', $form_id),
|
324 |
'html_updated_message' => get_field('acfe_form_html_updated_message', $form_id),
|
325 |
+
'updated_hide_form' => get_field('acfe_form_updated_hide_form', $form_id),
|
326 |
'return' => get_field('acfe_form_return', $form_id), // Deprecated
|
327 |
|
328 |
// Advanced
|
389 |
if(have_rows('acfe_form_actions', $form_id)):
|
390 |
while(have_rows('acfe_form_actions', $form_id)): the_row();
|
391 |
|
392 |
+
$action = get_row_layout();
|
393 |
+
|
394 |
+
$alias = get_sub_field('acfe_form_custom_alias');
|
395 |
+
|
396 |
+
// Custom Action
|
397 |
+
if($action === 'custom'){
|
398 |
+
|
399 |
+
$action = get_sub_field('acfe_form_custom_action');
|
400 |
+
$alias = '';
|
401 |
+
|
402 |
+
}
|
403 |
+
|
404 |
+
$args = apply_filters('acfe/form/load/' . $action, $args, $args['post_id'], $alias);
|
405 |
+
$args = apply_filters('acfe/form/load/' . $action . '/form=' . $form_name, $args, $args['post_id'], $alias);
|
406 |
+
|
407 |
+
if(!empty($alias))
|
408 |
+
$args = apply_filters('acfe/form/load/' . $action . '/action=' . $alias, $args, $args['post_id'], $alias);
|
409 |
+
|
410 |
endwhile;
|
411 |
endif;
|
412 |
|
446 |
}
|
447 |
|
448 |
// Register local fields.
|
449 |
+
foreach($this->fields as $k => $field){
|
450 |
|
451 |
+
acf_add_local_field($field);
|
452 |
|
453 |
+
}
|
454 |
|
455 |
// honeypot
|
456 |
if($args['honeypot']){
|
539 |
}
|
540 |
|
541 |
// uploader (always set incase of multiple forms on the page)
|
542 |
+
acf_disable_filter('acfe/form/uploader');
|
543 |
|
544 |
if($args['uploader'] !== 'default'){
|
545 |
+
|
546 |
+
acf_enable_filter('acfe/form/uploader');
|
547 |
+
acf_update_setting('uploader', $args['uploader']);
|
548 |
|
549 |
}
|
550 |
|
555 |
$wrapper = $args['form'] ? 'form' : 'div';
|
556 |
|
557 |
?>
|
558 |
+
|
559 |
+
<?php do_action('acfe/form/render/before_form'); ?>
|
560 |
|
561 |
<<?php echo $wrapper; ?> <?php acf_esc_attr_e($args['form_attributes']); ?>>
|
562 |
+
|
563 |
+
<?php do_action('acfe/form/render/before_fields'); ?>
|
564 |
|
565 |
<?php
|
566 |
|
568 |
|
569 |
// render post data
|
570 |
acf_form_data(array(
|
571 |
+
'screen' => 'acfe_form',
|
572 |
+
'post_id' => $args['post_id'],
|
573 |
+
'form' => acf_encrypt(json_encode($args))
|
574 |
));
|
575 |
|
576 |
}
|
596 |
|
597 |
// Normal Render
|
598 |
else{
|
599 |
+
|
600 |
+
// vars
|
601 |
+
$field_groups = array();
|
602 |
+
$fields = array();
|
603 |
+
|
604 |
+
// Post Field groups (Deprecated)
|
605 |
+
if($args['post_field_groups']){
|
606 |
+
|
607 |
+
// Override Field Groups
|
608 |
+
$post_field_groups = acf_get_field_groups(array(
|
609 |
+
'post_id' => $args['post_field_groups']
|
610 |
+
));
|
611 |
+
|
612 |
+
$args['field_groups'] = wp_list_pluck($post_field_groups, 'key');
|
613 |
+
|
614 |
+
}
|
615 |
+
|
616 |
+
// Field groups
|
617 |
+
if($args['field_groups']){
|
618 |
+
|
619 |
+
foreach($args['field_groups'] as $selector){
|
620 |
+
|
621 |
+
// Bypass Author Module
|
622 |
+
if($selector === 'group_acfe_author')
|
623 |
+
continue;
|
624 |
+
|
625 |
+
$field_groups[] = acf_get_field_group($selector);
|
626 |
+
|
627 |
+
}
|
628 |
+
|
629 |
+
}
|
630 |
+
|
631 |
+
// Apply Field Groups Rules
|
632 |
+
if($args['field_groups_rules']){
|
633 |
+
|
634 |
+
if(!empty($field_groups)){
|
635 |
+
|
636 |
+
$post_id = get_the_ID();
|
637 |
+
|
638 |
+
$filter = array(
|
639 |
+
'post_id' => $post_id,
|
640 |
+
'post_type' => get_post_type($post_id),
|
641 |
+
);
|
642 |
+
|
643 |
+
$filtered = array();
|
644 |
+
|
645 |
+
foreach($field_groups as $field_group){
|
646 |
+
|
647 |
+
// Deleted field group
|
648 |
+
if(!isset($field_group['location']))
|
649 |
+
continue;
|
650 |
+
|
651 |
+
// Force active
|
652 |
+
$field_group['active'] = true;
|
653 |
+
|
654 |
+
if(acf_get_field_group_visibility($field_group, $filter)){
|
655 |
+
|
656 |
+
$filtered[] = $field_group;
|
657 |
+
|
658 |
+
}
|
659 |
+
|
660 |
+
}
|
661 |
+
|
662 |
+
$field_groups = $filtered;
|
663 |
+
|
664 |
+
}
|
665 |
+
|
666 |
+
}
|
667 |
+
|
668 |
+
//load fields based on field groups
|
669 |
+
if(!empty($field_groups)){
|
670 |
+
|
671 |
+
foreach($field_groups as $field_group){
|
672 |
+
|
673 |
+
$field_group_fields = acf_get_fields($field_group);
|
674 |
+
|
675 |
+
if(!empty($field_group_fields)){
|
676 |
+
|
677 |
+
foreach(array_keys($field_group_fields) as $i){
|
678 |
+
|
679 |
+
$fields[] = acf_extract_var($field_group_fields, $i);
|
680 |
+
|
681 |
+
}
|
682 |
+
|
683 |
+
}
|
684 |
+
|
685 |
+
}
|
686 |
+
|
687 |
+
}
|
688 |
|
689 |
acf_render_fields($fields, acf_uniqid('acfe_form'), $args['field_el'], $args['instruction_placement']);
|
690 |
|
707 |
</div>
|
708 |
|
709 |
<?php endif; ?>
|
710 |
+
|
711 |
+
<?php do_action('acfe/form/render/after_fields'); ?>
|
712 |
|
713 |
</<?php echo $wrapper; ?>>
|
714 |
+
|
715 |
+
<?php do_action('acfe/form/render/after_form'); ?>
|
716 |
|
717 |
<?php
|
718 |
|
@@ -48,6 +48,41 @@ class acfe_dynamic_forms_helpers{
|
|
48 |
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
function map_fields_deep_no_custom($field){
|
52 |
|
53 |
$choices = array();
|
@@ -268,7 +303,7 @@ class acfe_dynamic_forms_helpers{
|
|
268 |
$form_id = $args['ID'];
|
269 |
$form_name = $args['name'];
|
270 |
|
271 |
-
$mapped_field_groups = $this->
|
272 |
$mapped_field_groups_keys = wp_list_pluck($mapped_field_groups, 'key');
|
273 |
|
274 |
$mapped_fields = array();
|
48 |
|
49 |
}
|
50 |
|
51 |
+
function get_field_groups_front($post_id = 0){
|
52 |
+
|
53 |
+
$return = array();
|
54 |
+
|
55 |
+
if(!$post_id)
|
56 |
+
$post_id = acfe_get_post_id();
|
57 |
+
|
58 |
+
if(!$post_id)
|
59 |
+
return $return;
|
60 |
+
|
61 |
+
// Field Groups
|
62 |
+
$field_groups = get_field('acfe_form_field_groups', $post_id);
|
63 |
+
|
64 |
+
if(!empty($field_groups)){
|
65 |
+
|
66 |
+
foreach($field_groups as $field_group_key){
|
67 |
+
|
68 |
+
$field_group = acf_get_field_group($field_group_key);
|
69 |
+
|
70 |
+
if(!$field_group)
|
71 |
+
continue;
|
72 |
+
|
73 |
+
$field_group['fields'] = acf_get_fields($field_group);
|
74 |
+
|
75 |
+
$return[] = $field_group;
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
// return
|
82 |
+
return $return;
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
function map_fields_deep_no_custom($field){
|
87 |
|
88 |
$choices = array();
|
303 |
$form_id = $args['ID'];
|
304 |
$form_name = $args['name'];
|
305 |
|
306 |
+
$mapped_field_groups = $this->get_field_groups_front($form_id);
|
307 |
$mapped_field_groups_keys = wp_list_pluck($mapped_field_groups, 'key');
|
308 |
|
309 |
$mapped_fields = array();
|
@@ -60,14 +60,13 @@ class acfe_dynamic_forms_hooks{
|
|
60 |
*/
|
61 |
function field_groups_choices($field){
|
62 |
|
|
|
63 |
$field_groups = acf_get_field_groups();
|
64 |
-
|
65 |
-
if(empty($field_groups))
|
66 |
-
return $field;
|
67 |
|
68 |
foreach($field_groups as $field_group){
|
69 |
|
70 |
-
if(
|
71 |
continue;
|
72 |
|
73 |
$field['choices'][$field_group['key']] = $field_group['title'];
|
60 |
*/
|
61 |
function field_groups_choices($field){
|
62 |
|
63 |
+
// Vars
|
64 |
$field_groups = acf_get_field_groups();
|
65 |
+
$hidden = acfe_get_setting('reserved_field_groups', array());
|
|
|
|
|
66 |
|
67 |
foreach($field_groups as $field_group){
|
68 |
|
69 |
+
if(in_array($field_group['key'], $hidden))
|
70 |
continue;
|
71 |
|
72 |
$field['choices'][$field_group['key']] = $field_group['title'];
|
@@ -190,11 +190,11 @@ class acfe_dynamic_forms extends acfe_dynamic_module{
|
|
190 |
if(typeof acf !== 'undefined'){
|
191 |
|
192 |
acf.newPostbox(<?php echo wp_json_encode(array(
|
193 |
-
'id'
|
194 |
-
'key'
|
195 |
-
'style'
|
196 |
-
'label'
|
197 |
-
'edit'
|
198 |
)); ?>);
|
199 |
|
200 |
}
|
@@ -269,11 +269,11 @@ class acfe_dynamic_forms extends acfe_dynamic_module{
|
|
269 |
if(typeof acf !== 'undefined'){
|
270 |
|
271 |
acf.newPostbox(<?php echo wp_json_encode(array(
|
272 |
-
'id'
|
273 |
-
'key'
|
274 |
-
'style'
|
275 |
-
'label'
|
276 |
-
'edit'
|
277 |
)); ?>);
|
278 |
|
279 |
}
|
@@ -1801,39 +1801,6 @@ acf_new_instance('acfe_dynamic_forms');
|
|
1801 |
|
1802 |
endif;
|
1803 |
|
1804 |
-
/*
|
1805 |
-
* ACFE: Import Forms
|
1806 |
-
*/
|
1807 |
-
function acfe_import_forms($forms){
|
1808 |
-
|
1809 |
-
// json
|
1810 |
-
if(is_string($forms))
|
1811 |
-
$forms = json_decode($forms, true);
|
1812 |
-
|
1813 |
-
if(!is_array($forms) || empty($forms))
|
1814 |
-
return new WP_Error('acfe_import_forms_invalid_input', __("Input is invalid"));
|
1815 |
-
|
1816 |
-
if(!acf_is_sequential_array($forms))
|
1817 |
-
return new WP_Error('acfe_import_forms_invalid_array', __("Array is not sequential"));
|
1818 |
-
|
1819 |
-
$return = array();
|
1820 |
-
|
1821 |
-
// Loop over args
|
1822 |
-
foreach($forms as $args){
|
1823 |
-
|
1824 |
-
$message = acfe_import_form($args);
|
1825 |
-
|
1826 |
-
if(is_wp_error($message))
|
1827 |
-
return $message;
|
1828 |
-
|
1829 |
-
$return[] = $message;
|
1830 |
-
|
1831 |
-
}
|
1832 |
-
|
1833 |
-
return $return;
|
1834 |
-
|
1835 |
-
}
|
1836 |
-
|
1837 |
/*
|
1838 |
* ACFE: Import Form
|
1839 |
*/
|
@@ -1844,41 +1811,76 @@ function acfe_import_form($args){
|
|
1844 |
$args = json_decode($args, true);
|
1845 |
|
1846 |
if(!is_array($args) || empty($args))
|
1847 |
-
return new WP_Error('acfe_import_form_invalid_input', __("Input is invalid"));
|
1848 |
|
1849 |
-
|
1850 |
-
return new WP_Error('acfe_import_form_invalid_array', __("Array is not associative"));
|
1851 |
-
|
1852 |
-
// Import
|
1853 |
$instance = acf_get_instance('acfe_dynamic_forms');
|
1854 |
-
$post_id = $instance->import($args);
|
1855 |
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
'
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
|
|
|
|
|
|
1863 |
|
1864 |
-
|
1865 |
|
1866 |
-
|
1867 |
-
$return['message'] = $post_id->get_error_message();
|
1868 |
|
1869 |
-
|
1870 |
-
|
1871 |
-
$return['post_id'] = $post_id;
|
1872 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1873 |
}
|
1874 |
|
1875 |
-
return $
|
1876 |
|
1877 |
}
|
1878 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1879 |
/*
|
1880 |
* Deprecated ACFE: Import Dynamic Form
|
1881 |
*/
|
1882 |
function acfe_import_dynamic_form($forms = false){
|
1883 |
-
return
|
1884 |
}
|
190 |
if(typeof acf !== 'undefined'){
|
191 |
|
192 |
acf.newPostbox(<?php echo wp_json_encode(array(
|
193 |
+
'id' => 'acfe-form-integration',
|
194 |
+
'key' => '',
|
195 |
+
'style' => 'default',
|
196 |
+
'label' => 'top',
|
197 |
+
'edit' => false
|
198 |
)); ?>);
|
199 |
|
200 |
}
|
269 |
if(typeof acf !== 'undefined'){
|
270 |
|
271 |
acf.newPostbox(<?php echo wp_json_encode(array(
|
272 |
+
'id' => 'acfe-form-details',
|
273 |
+
'key' => '',
|
274 |
+
'style' => 'default',
|
275 |
+
'label' => 'left',
|
276 |
+
'edit' => false
|
277 |
)); ?>);
|
278 |
|
279 |
}
|
1801 |
|
1802 |
endif;
|
1803 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1804 |
/*
|
1805 |
* ACFE: Import Form
|
1806 |
*/
|
1811 |
$args = json_decode($args, true);
|
1812 |
|
1813 |
if(!is_array($args) || empty($args))
|
1814 |
+
return new WP_Error('acfe_import_form_invalid_input', __("Input is invalid: Must be a json string or an array."));
|
1815 |
|
1816 |
+
// Instance
|
|
|
|
|
|
|
1817 |
$instance = acf_get_instance('acfe_dynamic_forms');
|
|
|
1818 |
|
1819 |
+
// Single
|
1820 |
+
if(acf_maybe_get($args, 'title')){
|
1821 |
+
|
1822 |
+
$name = acf_maybe_get($args, 'acfe_form_name');
|
1823 |
+
|
1824 |
+
$args = array(
|
1825 |
+
$name => $args
|
1826 |
+
);
|
1827 |
+
|
1828 |
+
}
|
1829 |
|
1830 |
+
$result = array();
|
1831 |
|
1832 |
+
foreach($args as $name => $data){
|
|
|
1833 |
|
1834 |
+
// Import
|
1835 |
+
$post_id = $instance->import($name, $data);
|
|
|
1836 |
|
1837 |
+
$return = array(
|
1838 |
+
'success' => true,
|
1839 |
+
'post_id' => $post_id,
|
1840 |
+
'message' => 'Form "' . acf_maybe_get($data, 'title') . '" successfully imported.',
|
1841 |
+
);
|
1842 |
+
|
1843 |
+
// Error
|
1844 |
+
if(is_wp_error($post_id)){
|
1845 |
+
|
1846 |
+
$return['post_id'] = 0;
|
1847 |
+
$return['success'] = false;
|
1848 |
+
$return['message'] = $post_id->get_error_message();
|
1849 |
+
|
1850 |
+
if($post_id->get_error_code() === 'acfe_form_import_already_exists'){
|
1851 |
+
|
1852 |
+
$get_post = get_page_by_path($name, OBJECT, $instance->post_type);
|
1853 |
+
|
1854 |
+
if($get_post){
|
1855 |
+
$return['post_id'] = $get_post->ID;
|
1856 |
+
}
|
1857 |
+
|
1858 |
+
}
|
1859 |
+
|
1860 |
+
}
|
1861 |
+
|
1862 |
+
$result[] = $return;
|
1863 |
+
|
1864 |
+
}
|
1865 |
+
|
1866 |
+
if(count($result) === 1){
|
1867 |
+
$result = $result[0];
|
1868 |
}
|
1869 |
|
1870 |
+
return $result;
|
1871 |
|
1872 |
}
|
1873 |
|
1874 |
+
/*
|
1875 |
+
* Deprecated ACFE: Import Forms
|
1876 |
+
*/
|
1877 |
+
function acfe_import_forms($forms){
|
1878 |
+
return acfe_import_form($forms);
|
1879 |
+
}
|
1880 |
+
|
1881 |
/*
|
1882 |
* Deprecated ACFE: Import Dynamic Form
|
1883 |
*/
|
1884 |
function acfe_import_dynamic_form($forms = false){
|
1885 |
+
return acfe_import_form($forms);
|
1886 |
}
|
@@ -248,11 +248,11 @@ class acfe_dynamic_options_pages extends acfe_dynamic_module{
|
|
248 |
return;
|
249 |
|
250 |
acf.newPostbox(<?php echo wp_json_encode(array(
|
251 |
-
'id'
|
252 |
-
'key'
|
253 |
-
'style'
|
254 |
-
'label'
|
255 |
-
'edit'
|
256 |
)); ?>);
|
257 |
|
258 |
})(jQuery);
|
@@ -827,16 +827,16 @@ class acfe_dynamic_options_pages extends acfe_dynamic_module{
|
|
827 |
acf_update_setting('l10n_var_export', true);
|
828 |
|
829 |
$str_replace = array(
|
830 |
-
" "
|
831 |
-
"'!!__(!!\'"
|
832 |
-
"!!\', !!\'"
|
833 |
-
"!!\')!!'"
|
834 |
-
"array ("
|
835 |
);
|
836 |
|
837 |
$preg_replace = array(
|
838 |
-
'/([\t\r\n]+?)array/'
|
839 |
-
'/[0-9]+ => array/'
|
840 |
);
|
841 |
|
842 |
// Get settings.
|
@@ -1128,7 +1128,7 @@ Defaults to \'options\'.',
|
|
1128 |
'label' => 'Autoload',
|
1129 |
'name' => 'autoload',
|
1130 |
'type' => 'true_false',
|
1131 |
-
'instructions' => '(boolean)
|
1132 |
Defaults to false.',
|
1133 |
'required' => 0,
|
1134 |
'conditional_logic' => 0,
|
248 |
return;
|
249 |
|
250 |
acf.newPostbox(<?php echo wp_json_encode(array(
|
251 |
+
'id' => 'acfe-dop-field-groups',
|
252 |
+
'key' => '',
|
253 |
+
'style' => 'default',
|
254 |
+
'label' => 'left',
|
255 |
+
'edit' => false
|
256 |
)); ?>);
|
257 |
|
258 |
})(jQuery);
|
827 |
acf_update_setting('l10n_var_export', true);
|
828 |
|
829 |
$str_replace = array(
|
830 |
+
" " => "\t",
|
831 |
+
"'!!__(!!\'" => "__('",
|
832 |
+
"!!\', !!\'" => "', '",
|
833 |
+
"!!\')!!'" => "')",
|
834 |
+
"array (" => "array("
|
835 |
);
|
836 |
|
837 |
$preg_replace = array(
|
838 |
+
'/([\t\r\n]+?)array/' => 'array',
|
839 |
+
'/[0-9]+ => array/' => 'array'
|
840 |
);
|
841 |
|
842 |
// Get settings.
|
1128 |
'label' => 'Autoload',
|
1129 |
'name' => 'autoload',
|
1130 |
'type' => 'true_false',
|
1131 |
+
'instructions' => '(boolean) Whether to load the option (values saved from this options page) when WordPress starts up.
|
1132 |
Defaults to false.',
|
1133 |
'required' => 0,
|
1134 |
'conditional_logic' => 0,
|
@@ -963,16 +963,16 @@ class acfe_dynamic_post_types extends acfe_dynamic_module{
|
|
963 |
acf_update_setting('l10n_var_export', true);
|
964 |
|
965 |
$str_replace = array(
|
966 |
-
" "
|
967 |
-
"'!!__(!!\'"
|
968 |
-
"!!\', !!\'"
|
969 |
-
"!!\')!!'"
|
970 |
-
"array ("
|
971 |
);
|
972 |
|
973 |
$preg_replace = array(
|
974 |
-
'/([\t\r\n]+?)array/'
|
975 |
-
'/[0-9]+ => array/'
|
976 |
);
|
977 |
|
978 |
// Get settings.
|
963 |
acf_update_setting('l10n_var_export', true);
|
964 |
|
965 |
$str_replace = array(
|
966 |
+
" " => "\t",
|
967 |
+
"'!!__(!!\'" => "__('",
|
968 |
+
"!!\', !!\'" => "', '",
|
969 |
+
"!!\')!!'" => "')",
|
970 |
+
"array (" => "array("
|
971 |
);
|
972 |
|
973 |
$preg_replace = array(
|
974 |
+
'/([\t\r\n]+?)array/' => 'array',
|
975 |
+
'/[0-9]+ => array/' => 'array'
|
976 |
);
|
977 |
|
978 |
// Get settings.
|
@@ -32,7 +32,7 @@ class acfe_single_meta{
|
|
32 |
add_filter('acf/pre_load_meta', array($this, 'pre_load_meta'), 999, 2);
|
33 |
|
34 |
// Values
|
35 |
-
add_filter('acf/pre_load_metadata', array($this, 'pre_load_metadata'),
|
36 |
add_filter('acf/update_value', array($this, 'update_value'), 999, 3);
|
37 |
add_filter('acf/pre_update_metadata', array($this, 'pre_update_metadata'), 999, 5);
|
38 |
add_filter('acf/pre_delete_metadata', array($this, 'pre_delete_metadata'), 999, 4);
|
@@ -45,20 +45,20 @@ class acfe_single_meta{
|
|
45 |
add_action('acf/render_field_settings', array($this, 'field_setting'));
|
46 |
|
47 |
// Post
|
48 |
-
add_action('load-post.php',
|
49 |
-
add_action('load-post-new.php',
|
50 |
|
51 |
// Term
|
52 |
-
add_action('load-edit-tags.php',
|
53 |
-
add_action('load-term.php',
|
54 |
|
55 |
// User
|
56 |
-
add_action('load-user-new.php',
|
57 |
-
add_action('load-user-edit.php',
|
58 |
-
add_action('load-profile.php',
|
59 |
|
60 |
// Nav Menu Items
|
61 |
-
add_action('wp_nav_menu_item_custom_fields',
|
62 |
|
63 |
// Options
|
64 |
//add_action('acf/options_page/submitbox_before_major_actions', array($this, 'load_options'));
|
32 |
add_filter('acf/pre_load_meta', array($this, 'pre_load_meta'), 999, 2);
|
33 |
|
34 |
// Values
|
35 |
+
add_filter('acf/pre_load_metadata', array($this, 'pre_load_metadata'), 999, 4);
|
36 |
add_filter('acf/update_value', array($this, 'update_value'), 999, 3);
|
37 |
add_filter('acf/pre_update_metadata', array($this, 'pre_update_metadata'), 999, 5);
|
38 |
add_filter('acf/pre_delete_metadata', array($this, 'pre_delete_metadata'), 999, 4);
|
45 |
add_action('acf/render_field_settings', array($this, 'field_setting'));
|
46 |
|
47 |
// Post
|
48 |
+
add_action('load-post.php', array($this, 'load_post'));
|
49 |
+
add_action('load-post-new.php', array($this, 'load_post'));
|
50 |
|
51 |
// Term
|
52 |
+
add_action('load-edit-tags.php', array($this, 'load_term'));
|
53 |
+
add_action('load-term.php', array($this, 'load_term'));
|
54 |
|
55 |
// User
|
56 |
+
add_action('load-user-new.php', array($this, 'load_user'));
|
57 |
+
add_action('load-user-edit.php', array($this, 'load_user'));
|
58 |
+
add_action('load-profile.php', array($this, 'load_user'));
|
59 |
|
60 |
// Nav Menu Items
|
61 |
+
add_action('wp_nav_menu_item_custom_fields', array($this, 'wp_nav_menu_item_custom_fields'), 5);
|
62 |
|
63 |
// Options
|
64 |
//add_action('acf/options_page/submitbox_before_major_actions', array($this, 'load_options'));
|
@@ -998,16 +998,16 @@ class acfe_dynamic_taxonomies extends acfe_dynamic_module{
|
|
998 |
acf_update_setting('l10n_var_export', true);
|
999 |
|
1000 |
$str_replace = array(
|
1001 |
-
" "
|
1002 |
-
"'!!__(!!\'"
|
1003 |
-
"!!\', !!\'"
|
1004 |
-
"!!\')!!'"
|
1005 |
-
"array ("
|
1006 |
);
|
1007 |
|
1008 |
$preg_replace = array(
|
1009 |
-
'/([\t\r\n]+?)array/'
|
1010 |
-
'/[0-9]+ => array/'
|
1011 |
);
|
1012 |
|
1013 |
// Get settings.
|
998 |
acf_update_setting('l10n_var_export', true);
|
999 |
|
1000 |
$str_replace = array(
|
1001 |
+
" " => "\t",
|
1002 |
+
"'!!__(!!\'" => "__('",
|
1003 |
+
"!!\', !!\'" => "', '",
|
1004 |
+
"!!\')!!'" => "')",
|
1005 |
+
"array (" => "array("
|
1006 |
);
|
1007 |
|
1008 |
$preg_replace = array(
|
1009 |
+
'/([\t\r\n]+?)array/' => 'array',
|
1010 |
+
'/[0-9]+ => array/' => 'array'
|
1011 |
);
|
1012 |
|
1013 |
// Get settings.
|
@@ -14,7 +14,7 @@ class acfe_enhanced_ui{
|
|
14 |
function __construct(){
|
15 |
|
16 |
// Action
|
17 |
-
add_action('admin_enqueue_scripts',
|
18 |
|
19 |
}
|
20 |
|
@@ -126,7 +126,7 @@ class acfe_enhanced_ui{
|
|
126 |
$post_id = 'term_' . $term->term_id;
|
127 |
|
128 |
// screen
|
129 |
-
$screen =
|
130 |
|
131 |
// field groups
|
132 |
$field_groups = acf_get_field_groups(array(
|
@@ -137,8 +137,8 @@ class acfe_enhanced_ui{
|
|
137 |
|
138 |
// form data
|
139 |
acf_form_data(array(
|
140 |
-
'screen'
|
141 |
-
'post_id'
|
142 |
));
|
143 |
|
144 |
$this->add_metaboxes($field_groups, $post_id, $screen);
|
@@ -225,9 +225,9 @@ class acfe_enhanced_ui{
|
|
225 |
(function($){
|
226 |
|
227 |
acfe.enhancedEditUI({
|
228 |
-
screen:
|
229 |
-
submit:
|
230 |
-
pageTitle:
|
231 |
});
|
232 |
|
233 |
})(jQuery);
|
@@ -248,8 +248,8 @@ class acfe_enhanced_ui{
|
|
248 |
|
249 |
// render
|
250 |
$this->user_add_metaboxes(array(
|
251 |
-
'user_id'
|
252 |
-
'view'
|
253 |
));
|
254 |
|
255 |
}
|
@@ -287,8 +287,8 @@ class acfe_enhanced_ui{
|
|
287 |
|
288 |
// args
|
289 |
$args = wp_parse_args($args, array(
|
290 |
-
'user_id'
|
291 |
-
'view'
|
292 |
));
|
293 |
|
294 |
// screen
|
@@ -303,8 +303,8 @@ class acfe_enhanced_ui{
|
|
303 |
|
304 |
// field groups
|
305 |
$field_groups = acf_get_field_groups(array(
|
306 |
-
'user_id'
|
307 |
-
'user_form'
|
308 |
));
|
309 |
|
310 |
if($field_groups){
|
@@ -348,8 +348,8 @@ class acfe_enhanced_ui{
|
|
348 |
(function($){
|
349 |
|
350 |
acfe.enhancedEditUI({
|
351 |
-
screen:
|
352 |
-
pageTitle:
|
353 |
});
|
354 |
|
355 |
})(jQuery);
|
@@ -442,8 +442,8 @@ class acfe_enhanced_ui{
|
|
442 |
<?php } ?>
|
443 |
|
444 |
acfe.enhancedEditUI({
|
445 |
-
screen:
|
446 |
-
pageTitle:
|
447 |
});
|
448 |
|
449 |
})(jQuery);
|
@@ -461,10 +461,10 @@ class acfe_enhanced_ui{
|
|
461 |
foreach($field_groups as $field_group){
|
462 |
|
463 |
// vars
|
464 |
-
$id = "acf-{$field_group['key']}";
|
465 |
-
$title = $field_group['title'];
|
466 |
-
$context = $field_group['position'];
|
467 |
-
$priority = 'high';
|
468 |
|
469 |
// Reduce priority for sidebar metaboxes for best position.
|
470 |
if($context == 'side'){
|
@@ -475,11 +475,11 @@ class acfe_enhanced_ui{
|
|
475 |
|
476 |
// Localize data
|
477 |
$postboxes[] = array(
|
478 |
-
'id'
|
479 |
-
'key'
|
480 |
-
'style'
|
481 |
-
'label'
|
482 |
-
'edit'
|
483 |
);
|
484 |
|
485 |
// Add meta box
|
@@ -489,7 +489,7 @@ class acfe_enhanced_ui{
|
|
489 |
|
490 |
// Localize postboxes.
|
491 |
acf_localize_data(array(
|
492 |
-
'postboxes'
|
493 |
));
|
494 |
|
495 |
}
|
14 |
function __construct(){
|
15 |
|
16 |
// Action
|
17 |
+
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'), 15);
|
18 |
|
19 |
}
|
20 |
|
126 |
$post_id = 'term_' . $term->term_id;
|
127 |
|
128 |
// screen
|
129 |
+
$screen = get_current_screen();
|
130 |
|
131 |
// field groups
|
132 |
$field_groups = acf_get_field_groups(array(
|
137 |
|
138 |
// form data
|
139 |
acf_form_data(array(
|
140 |
+
'screen' => 'taxonomy',
|
141 |
+
'post_id' => $post_id,
|
142 |
));
|
143 |
|
144 |
$this->add_metaboxes($field_groups, $post_id, $screen);
|
225 |
(function($){
|
226 |
|
227 |
acfe.enhancedEditUI({
|
228 |
+
screen: 'term-edit',
|
229 |
+
submit: '> .edit-tag-actions',
|
230 |
+
pageTitle: true
|
231 |
});
|
232 |
|
233 |
})(jQuery);
|
248 |
|
249 |
// render
|
250 |
$this->user_add_metaboxes(array(
|
251 |
+
'user_id' => $user->ID,
|
252 |
+
'view' => 'edit'
|
253 |
));
|
254 |
|
255 |
}
|
287 |
|
288 |
// args
|
289 |
$args = wp_parse_args($args, array(
|
290 |
+
'user_id' => 0,
|
291 |
+
'view' => 'edit'
|
292 |
));
|
293 |
|
294 |
// screen
|
303 |
|
304 |
// field groups
|
305 |
$field_groups = acf_get_field_groups(array(
|
306 |
+
'user_id' => $args['user_id'] ? $args['user_id'] : 'new',
|
307 |
+
'user_form' => $args['view']
|
308 |
));
|
309 |
|
310 |
if($field_groups){
|
348 |
(function($){
|
349 |
|
350 |
acfe.enhancedEditUI({
|
351 |
+
screen: 'user-new',
|
352 |
+
pageTitle: true
|
353 |
});
|
354 |
|
355 |
})(jQuery);
|
442 |
<?php } ?>
|
443 |
|
444 |
acfe.enhancedEditUI({
|
445 |
+
screen: 'settings',
|
446 |
+
pageTitle: pageTitle
|
447 |
});
|
448 |
|
449 |
})(jQuery);
|
461 |
foreach($field_groups as $field_group){
|
462 |
|
463 |
// vars
|
464 |
+
$id = "acf-{$field_group['key']}"; // acf-group_123
|
465 |
+
$title = $field_group['title']; // Group 1
|
466 |
+
$context = $field_group['position']; // normal, side, acf_after_title
|
467 |
+
$priority = 'high'; // high, core, default, low
|
468 |
|
469 |
// Reduce priority for sidebar metaboxes for best position.
|
470 |
if($context == 'side'){
|
475 |
|
476 |
// Localize data
|
477 |
$postboxes[] = array(
|
478 |
+
'id' => $id,
|
479 |
+
'key' => $field_group['key'],
|
480 |
+
'style' => $field_group['style'],
|
481 |
+
'label' => $field_group['label_placement'],
|
482 |
+
'edit' => acf_get_field_group_edit_link($field_group['ID'])
|
483 |
);
|
484 |
|
485 |
// Add meta box
|
489 |
|
490 |
// Localize postboxes.
|
491 |
acf_localize_data(array(
|
492 |
+
'postboxes' => $postboxes
|
493 |
));
|
494 |
|
495 |
}
|
@@ -10,11 +10,11 @@ if(!defined('ABSPATH'))
|
|
10 |
*/
|
11 |
function acfe_include($filename = ''){
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
|
19 |
}
|
20 |
|
@@ -27,11 +27,11 @@ function acfe_include($filename = ''){
|
|
27 |
*/
|
28 |
function acfe_get_url($filename = ''){
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
}
|
36 |
|
37 |
/**
|
10 |
*/
|
11 |
function acfe_include($filename = ''){
|
12 |
|
13 |
+
$file_path = ACFE_PATH . ltrim($filename, '/');
|
14 |
|
15 |
+
if(file_exists($file_path)){
|
16 |
+
include_once($file_path);
|
17 |
+
}
|
18 |
|
19 |
}
|
20 |
|
27 |
*/
|
28 |
function acfe_get_url($filename = ''){
|
29 |
|
30 |
+
if(!defined('ACFE_URL')){
|
31 |
+
define('ACFE_URL', acf_get_setting('acfe/url'));
|
32 |
+
}
|
33 |
|
34 |
+
return ACFE_URL . ltrim($filename, '/');
|
35 |
}
|
36 |
|
37 |
/**
|
@@ -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.7
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 0.8.8.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -685,6 +685,44 @@ function my_acfe_modules(){
|
|
685 |
|
686 |
== Changelog ==
|
687 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
688 |
= 0.8.8.1 =
|
689 |
|
690 |
**ACF Extended Pro 0.8.8.1:**
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.7
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 0.8.8.2
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
685 |
|
686 |
== Changelog ==
|
687 |
|
688 |
+
= 0.8.8.2 =
|
689 |
+
|
690 |
+
**ACF Extended Pro 0.8.8.2:**
|
691 |
+
* Field: Added Advanced "Color Picker" field settings with RGBA support, Palette display style, Custom predefined colors & Allow null
|
692 |
+
* Field: Added "Date Range Picker" field with Custom ranges, No weekends, Min/max date & Min/max days support
|
693 |
+
* Field: Flexible Content Grid System - Fixed sub Flexible Content Grid CSS bug
|
694 |
+
* Field: Flexible Content Grid System - Tweaked `get_flexible_grid_class()` prefix
|
695 |
+
* Field: Fields Selector - Added "Field Name" return value setting
|
696 |
+
* Field: Post Field - Fixed Permalink "Save" & "Cancel" missing text when editing a permalink
|
697 |
+
* Module: Added "Force Sync" module allowing to automatically sync Json Files to DB with the newest version
|
698 |
+
* Module: Dynamic Template - Improved instruction
|
699 |
+
* Module: Global Conditional Logic - Fixed compatibility with Terms & Users screen when Enhanced UI is disabled
|
700 |
+
|
701 |
+
**ACF Extended Basic 0.8.8.2:**
|
702 |
+
* Field: Clone - Fixed internal ACFE module field groups which where selectable in clone
|
703 |
+
* Field: Google reCaptcha - Renamed the field to Google reCaptcha
|
704 |
+
* Field: Post Object - Fixed duplicated post creation when using "Custom Value" setting
|
705 |
+
* Module: Forms - Fixed Clone Render when using "Override Form Render" settings
|
706 |
+
* Module: Forms - Fixed "Redirect Action" named hook not working with a custom action name
|
707 |
+
* Module: Forms - Added render actions hooks
|
708 |
+
* Module: Forms - Fixed `acfe_import_form()` function
|
709 |
+
* Module: Block Types - Changed the "Mode" setting default value to "Preview", as in the documentation
|
710 |
+
* Module: Multilang - Options Post ID `options` can now be excluded from the module translation
|
711 |
+
* Module: Multilang - Added `acfe/modules/multilang/exclude_options` filter to exclude specific Options Post ID from module translation
|
712 |
+
* Module: Multilang - Added `acfe/modules/multilang/include_options` filter to include specific Options Post ID from module translation
|
713 |
+
* Module: Multilang - Deprecated the `acfe/modules/multilang/options` filter
|
714 |
+
* Module: Multilang - WPML string translations now use `wpml_translate_single_string` instead of `__()`
|
715 |
+
* Module: Settings UI - Fixed potential duplicated table `thead` columns
|
716 |
+
* Module: Enhanced UI - Fixed possible metaboxes screen name collision with taxonomy name
|
717 |
+
* General: ACFE Modal - Fixed `show_field` on modal open
|
718 |
+
* General: ACFE Modal - Fixed possible duplicate field instructions in repeaters
|
719 |
+
* General: The `acfe_get_post_id()` helper now correctly retrieve the Post ID in ACF Block Types
|
720 |
+
* General: Fixed `get_fields()` calls in `acfe/save` hooks when a bidirectional value is set
|
721 |
+
* General: Enhanced Local Meta logic
|
722 |
+
* General: Enhanced `acfe/save` & `acfe/validate_save` hooks logic
|
723 |
+
* General: Code format cleanup
|
724 |
+
* Compatibility: Added ACFE Field Types to WP GraphQL ACF plugin
|
725 |
+
|
726 |
= 0.8.8.1 =
|
727 |
|
728 |
**ACF Extended Pro 0.8.8.1:**
|