Updates to 6.3.0.1

This commit is contained in:
ACF 2024-05-27 07:25:29 +00:00
parent 7dc881bc8f
commit 4f4758c75f
259 changed files with 5096 additions and 1264 deletions

24
acf.php
View File

@ -9,14 +9,14 @@
* Plugin Name: Advanced Custom Fields PRO
* Plugin URI: https://www.advancedcustomfields.com
* Description: Customize WordPress with powerful, professional and intuitive fields.
* Version: 6.2.10
* Version: 6.3.0.1
* Author: WP Engine
* Author URI: https://wpengine.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=plugin_directory&utm_content=advanced_custom_fields
* Update URI: https://www.advancedcustomfields.com/pro
* Text Domain: acf
* Domain Path: /lang
* Requires PHP: 7.0
* Requires at least: 5.8
* Requires PHP: 7.4
* Requires at least: 6.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -36,7 +36,7 @@ if ( ! class_exists( 'ACF' ) ) {
*
* @var string
*/
public $version = '6.2.10';
public $version = '6.3.0.1';
/**
* The plugin settings array.
@ -143,6 +143,7 @@ if ( ! class_exists( 'ACF' ) ) {
// Include classes.
acf_include( 'includes/class-acf-data.php' );
acf_include( 'includes/class-acf-internal-post-type.php' );
acf_include( 'includes/class-acf-site-health.php' );
acf_include( 'includes/fields/class-acf-field.php' );
acf_include( 'includes/locations/abstract-acf-legacy-location.php' );
acf_include( 'includes/locations/abstract-acf-location.php' );
@ -164,6 +165,14 @@ if ( ! class_exists( 'ACF' ) ) {
acf_include( 'includes/acf-input-functions.php' );
acf_include( 'includes/acf-wp-functions.php' );
// Override the shortcode default value based on the version when installed.
$first_activated_version = acf_get_version_when_first_activated();
// Only enable shortcode by default for versions prior to 6.3
if ( $first_activated_version && version_compare( $first_activated_version, '6.3', '>=' ) ) {
$this->settings['enable_shortcode'] = false;
}
// Include core.
acf_include( 'includes/fields.php' );
acf_include( 'includes/locations.php' );
@ -305,6 +314,7 @@ if ( ! class_exists( 'ACF' ) ) {
acf_include( 'includes/fields/class-acf-field-date_time_picker.php' );
acf_include( 'includes/fields/class-acf-field-time_picker.php' );
acf_include( 'includes/fields/class-acf-field-color_picker.php' );
acf_include( 'includes/fields/class-acf-field-icon_picker.php' );
acf_include( 'includes/fields/class-acf-field-message.php' );
acf_include( 'includes/fields/class-acf-field-accordion.php' );
acf_include( 'includes/fields/class-acf-field-tab.php' );
@ -762,8 +772,14 @@ if ( ! class_exists( 'ACF' ) ) {
// If acf_version is set, this isn't the first activated version, so leave it unset so it's legacy.
if ( null === get_option( 'acf_version', null ) ) {
update_option( 'acf_first_activated_version', ACF_VERSION, true );
do_action( 'acf/first_activated' );
}
}
if ( acf_is_pro() ) {
do_action( 'acf/activated_pro' );
}
}
}

View File

@ -690,7 +690,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .p3 {
font-size: 13.5px;
}
.acf-admin-page .p4, .acf-admin-page .acf-field-list .acf-sortable-handle, .acf-field-list .acf-admin-page .acf-sortable-handle, .acf-admin-page .post-type-acf-field-group .acf-field-object .handle li.li-field-label a.edit-field, .post-type-acf-field-group .acf-field-object .handle li.li-field-label .acf-admin-page a.edit-field, .acf-admin-page .post-type-acf-field-group .acf-field-object .handle li, .post-type-acf-field-group .acf-field-object .handle .acf-admin-page li, .acf-admin-page .post-type-acf-field-group .acf-thead li, .post-type-acf-field-group .acf-thead .acf-admin-page li, .acf-admin-page .acf-input .select2-container.-acf .select2-selection__rendered, .acf-admin-page .button, .acf-admin-page input[type=text],
.acf-admin-page .p4, .acf-admin-page .acf-field-list .acf-sortable-handle, .acf-field-list .acf-admin-page .acf-sortable-handle, .acf-admin-page .post-type-acf-field-group .acf-field-object .handle li.li-field-label a.edit-field, .post-type-acf-field-group .acf-field-object .handle li.li-field-label .acf-admin-page a.edit-field, .acf-admin-page .post-type-acf-field-group .acf-field-object .handle li, .post-type-acf-field-group .acf-field-object .handle .acf-admin-page li, .acf-admin-page .post-type-acf-field-group .acf-thead li, .post-type-acf-field-group .acf-thead .acf-admin-page li, .acf-admin-page .acf-input .select2-container.-acf .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container.-acf .select2-selection__rendered, .acf-admin-page .button, .acf-admin-page input[type=text],
.acf-admin-page input[type=search],
.acf-admin-page input[type=number],
.acf-admin-page textarea,
@ -861,6 +862,7 @@ html[dir=rtl] .acf-field-object.open > .handle {
border-color: #D0D5DD;
box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.1);
border-radius: 6px;
/* stylelint-disable-next-line scss/at-extend-no-missing-placeholder */
color: #344054;
}
.acf-admin-page input[type=text]:focus,
@ -1117,11 +1119,13 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .edit-field-group-header {
display: block !important;
}
.acf-admin-page .acf-input .select2-container.-acf .select2-selection {
.acf-admin-page .acf-input .select2-container.-acf .select2-selection,
.acf-admin-page .rule-groups .select2-container.-acf .select2-selection {
border: none;
line-height: 1;
}
.acf-admin-page .acf-input .select2-container.-acf .select2-selection__rendered {
.acf-admin-page .acf-input .select2-container.-acf .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container.-acf .select2-selection__rendered {
box-sizing: border-box;
padding-right: 0;
padding-left: 0;
@ -1131,39 +1135,67 @@ html[dir=rtl] .acf-field-object.open > .handle {
border-color: #D0D5DD;
box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.1);
border-radius: 6px;
/* stylelint-disable-next-line scss/at-extend-no-missing-placeholder */
color: #344054;
}
.acf-admin-page .acf-input .select2-container--focus {
.acf-admin-page .acf-input .acf-conditional-select-name,
.acf-admin-page .rule-groups .acf-conditional-select-name {
min-width: 180px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.acf-admin-page .acf-input .acf-conditional-select-id,
.acf-admin-page .rule-groups .acf-conditional-select-id {
padding-right: 30px;
}
.acf-admin-page .acf-input .value .select2-container--focus,
.acf-admin-page .rule-groups .value .select2-container--focus {
height: 40px;
}
.acf-admin-page .acf-input .value .select2-container--open .select2-selection__rendered,
.acf-admin-page .rule-groups .value .select2-container--open .select2-selection__rendered {
border-color: #399CCB;
}
.acf-admin-page .acf-input .select2-container--focus,
.acf-admin-page .rule-groups .select2-container--focus {
outline: 3px solid #EBF5FA;
border-color: #399CCB;
border-radius: 6px;
}
.acf-admin-page .acf-input .select2-container--focus .select2-selection__rendered {
.acf-admin-page .acf-input .select2-container--focus .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--focus .select2-selection__rendered {
border-color: #399CCB !important;
}
.acf-admin-page .acf-input .select2-container--focus.select2-container--below.select2-container--open .select2-selection__rendered {
.acf-admin-page .acf-input .select2-container--focus.select2-container--below.select2-container--open .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--focus.select2-container--below.select2-container--open .select2-selection__rendered {
border-bottom-right-radius: 0 !important;
border-bottom-left-radius: 0 !important;
}
.acf-admin-page .acf-input .select2-container--focus.select2-container--above.select2-container--open .select2-selection__rendered {
.acf-admin-page .acf-input .select2-container--focus.select2-container--above.select2-container--open .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--focus.select2-container--above.select2-container--open .select2-selection__rendered {
border-top-right-radius: 0 !important;
border-top-left-radius: 0 !important;
}
.acf-admin-page .acf-input .select2-container .select2-search--inline .select2-search__field {
.acf-admin-page .acf-input .select2-container .select2-search--inline .select2-search__field,
.acf-admin-page .rule-groups .select2-container .select2-search--inline .select2-search__field {
margin: 0;
padding-left: 6px;
}
.acf-admin-page .acf-input .select2-container .select2-search--inline .select2-search__field:focus {
.acf-admin-page .acf-input .select2-container .select2-search--inline .select2-search__field:focus,
.acf-admin-page .rule-groups .select2-container .select2-search--inline .select2-search__field:focus {
outline: none;
border: none;
}
.acf-admin-page .acf-input .select2-container--default .select2-selection--multiple .select2-selection__rendered {
.acf-admin-page .acf-input .select2-container--default .select2-selection--multiple .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--default .select2-selection--multiple .select2-selection__rendered {
padding-top: 0;
padding-right: 6px;
padding-bottom: 0;
padding-left: 6px;
}
.acf-admin-page .acf-input .select2-selection__clear {
.acf-admin-page .acf-input .select2-selection__clear,
.acf-admin-page .rule-groups .select2-selection__clear {
width: 18px;
height: 18px;
margin-top: 12px;
@ -1173,7 +1205,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
overflow: hidden;
color: #fff;
}
.acf-admin-page .acf-input .select2-selection__clear:before {
.acf-admin-page .acf-input .select2-selection__clear:before,
.acf-admin-page .rule-groups .select2-selection__clear:before {
content: "";
display: block;
width: 16px;
@ -1192,7 +1225,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
mask-image: url("../../images/icons/icon-close.svg");
background-color: #98A2B3;
}
.acf-admin-page .acf-input .select2-selection__clear:hover::before {
.acf-admin-page .acf-input .select2-selection__clear:hover::before,
.acf-admin-page .rule-groups .select2-selection__clear:hover::before {
background-color: #0783BE;
}
.acf-admin-page .acf-label {
@ -1236,7 +1270,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-container.-acf,
.acf-admin-page .acf-field-delete-terms .select2-container.-acf,
.acf-admin-page .acf-field-assign-terms .select2-container.-acf,
.acf-admin-page .acf-field-meta-box .select2-container.-acf {
.acf-admin-page .acf-field-meta-box .select2-container.-acf,
.acf-admin-page .rule-groups .select2-container.-acf {
min-height: 40px;
}
.acf-admin-page .acf-field-setting-type .select2-container--default .select2-selection--single .select2-selection__rendered,
@ -1249,7 +1284,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .acf-field-delete-terms .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .acf-field-assign-terms .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .select2-selection__rendered {
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--default .select2-selection--single .select2-selection__rendered {
display: flex;
align-items: center;
position: relative;
@ -1270,7 +1306,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-container--default .select2-selection--single .field-type-icon,
.acf-admin-page .acf-field-delete-terms .select2-container--default .select2-selection--single .field-type-icon,
.acf-admin-page .acf-field-assign-terms .select2-container--default .select2-selection--single .field-type-icon,
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .field-type-icon {
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .field-type-icon,
.acf-admin-page .rule-groups .select2-container--default .select2-selection--single .field-type-icon {
top: auto;
width: 18px;
height: 18px;
@ -1286,7 +1323,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-container--default .select2-selection--single .field-type-icon:before,
.acf-admin-page .acf-field-delete-terms .select2-container--default .select2-selection--single .field-type-icon:before,
.acf-admin-page .acf-field-assign-terms .select2-container--default .select2-selection--single .field-type-icon:before,
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .field-type-icon:before {
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .field-type-icon:before,
.acf-admin-page .rule-groups .select2-container--default .select2-selection--single .field-type-icon:before {
width: 9px;
height: 9px;
}
@ -1300,7 +1338,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-container--open .select2-selection__rendered,
.acf-admin-page .acf-field-delete-terms .select2-container--open .select2-selection__rendered,
.acf-admin-page .acf-field-assign-terms .select2-container--open .select2-selection__rendered,
.acf-admin-page .acf-field-meta-box .select2-container--open .select2-selection__rendered {
.acf-admin-page .acf-field-meta-box .select2-container--open .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--open .select2-selection__rendered {
border-color: #6BB5D8 !important;
border-bottom-color: #D0D5DD !important;
}
@ -1314,7 +1353,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-container--open.select2-container--below .select2-selection__rendered,
.acf-admin-page .acf-field-delete-terms .select2-container--open.select2-container--below .select2-selection__rendered,
.acf-admin-page .acf-field-assign-terms .select2-container--open.select2-container--below .select2-selection__rendered,
.acf-admin-page .acf-field-meta-box .select2-container--open.select2-container--below .select2-selection__rendered {
.acf-admin-page .acf-field-meta-box .select2-container--open.select2-container--below .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--open.select2-container--below .select2-selection__rendered {
border-bottom-right-radius: 0 !important;
border-bottom-left-radius: 0 !important;
}
@ -1328,7 +1368,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-container--open.select2-container--above .select2-selection__rendered,
.acf-admin-page .acf-field-delete-terms .select2-container--open.select2-container--above .select2-selection__rendered,
.acf-admin-page .acf-field-assign-terms .select2-container--open.select2-container--above .select2-selection__rendered,
.acf-admin-page .acf-field-meta-box .select2-container--open.select2-container--above .select2-selection__rendered {
.acf-admin-page .acf-field-meta-box .select2-container--open.select2-container--above .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--open.select2-container--above .select2-selection__rendered {
border-top-right-radius: 0 !important;
border-top-left-radius: 0 !important;
border-bottom-color: #6BB5D8 !important;
@ -1344,10 +1385,11 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .acf-selection.has-icon,
.acf-admin-page .acf-field-delete-terms .acf-selection.has-icon,
.acf-admin-page .acf-field-assign-terms .acf-selection.has-icon,
.acf-admin-page .acf-field-meta-box .acf-selection.has-icon {
.acf-admin-page .acf-field-meta-box .acf-selection.has-icon,
.acf-admin-page .rule-groups .acf-selection.has-icon {
margin-left: 6px;
}
.rtl.acf-admin-page .acf-field-setting-type .acf-selection.has-icon, .acf-admin-page .acf-field-permalink-rewrite .acf-selection.has-icon, .acf-admin-page .acf-field-query-var .acf-selection.has-icon, .acf-admin-page .acf-field-capability .acf-selection.has-icon, .acf-admin-page .acf-field-parent-slug .acf-selection.has-icon, .acf-admin-page .acf-field-data-storage .acf-selection.has-icon, .acf-admin-page .acf-field-manage-terms .acf-selection.has-icon, .acf-admin-page .acf-field-edit-terms .acf-selection.has-icon, .acf-admin-page .acf-field-delete-terms .acf-selection.has-icon, .acf-admin-page .acf-field-assign-terms .acf-selection.has-icon, .acf-admin-page .acf-field-meta-box .acf-selection.has-icon {
.rtl.acf-admin-page .acf-field-setting-type .acf-selection.has-icon, .acf-admin-page .acf-field-permalink-rewrite .acf-selection.has-icon, .acf-admin-page .acf-field-query-var .acf-selection.has-icon, .acf-admin-page .acf-field-capability .acf-selection.has-icon, .acf-admin-page .acf-field-parent-slug .acf-selection.has-icon, .acf-admin-page .acf-field-data-storage .acf-selection.has-icon, .acf-admin-page .acf-field-manage-terms .acf-selection.has-icon, .acf-admin-page .acf-field-edit-terms .acf-selection.has-icon, .acf-admin-page .acf-field-delete-terms .acf-selection.has-icon, .acf-admin-page .acf-field-assign-terms .acf-selection.has-icon, .acf-admin-page .acf-field-meta-box .acf-selection.has-icon, .acf-admin-page .rule-groups .acf-selection.has-icon {
margin-right: 6px;
}
@ -1361,7 +1403,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-selection__arrow,
.acf-admin-page .acf-field-delete-terms .select2-selection__arrow,
.acf-admin-page .acf-field-assign-terms .select2-selection__arrow,
.acf-admin-page .acf-field-meta-box .select2-selection__arrow {
.acf-admin-page .acf-field-meta-box .select2-selection__arrow,
.acf-admin-page .rule-groups .select2-selection__arrow {
width: 20px;
height: 20px;
top: calc(50% - 10px);
@ -1378,7 +1421,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-selection__arrow:after,
.acf-admin-page .acf-field-delete-terms .select2-selection__arrow:after,
.acf-admin-page .acf-field-assign-terms .select2-selection__arrow:after,
.acf-admin-page .acf-field-meta-box .select2-selection__arrow:after {
.acf-admin-page .acf-field-meta-box .select2-selection__arrow:after,
.acf-admin-page .rule-groups .select2-selection__arrow:after {
content: "";
display: block;
position: absolute;
@ -1412,7 +1456,8 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-selection__arrow b[role=presentation],
.acf-admin-page .acf-field-delete-terms .select2-selection__arrow b[role=presentation],
.acf-admin-page .acf-field-assign-terms .select2-selection__arrow b[role=presentation],
.acf-admin-page .acf-field-meta-box .select2-selection__arrow b[role=presentation] {
.acf-admin-page .acf-field-meta-box .select2-selection__arrow b[role=presentation],
.acf-admin-page .rule-groups .select2-selection__arrow b[role=presentation] {
display: none;
}
.acf-admin-page .acf-field-setting-type .select2-container--open .select2-selection__arrow:after,
@ -1425,10 +1470,22 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .acf-field-edit-terms .select2-container--open .select2-selection__arrow:after,
.acf-admin-page .acf-field-delete-terms .select2-container--open .select2-selection__arrow:after,
.acf-admin-page .acf-field-assign-terms .select2-container--open .select2-selection__arrow:after,
.acf-admin-page .acf-field-meta-box .select2-container--open .select2-selection__arrow:after {
.acf-admin-page .acf-field-meta-box .select2-container--open .select2-selection__arrow:after,
.acf-admin-page .rule-groups .select2-container--open .select2-selection__arrow:after {
-webkit-mask-image: url("../../images/icons/icon-chevron-up.svg");
mask-image: url("../../images/icons/icon-chevron-up.svg");
}
.acf-admin-page .acf-term-search-term-name {
background-color: #F9FAFB;
border-top: 1px solid #EAECF0;
border-bottom: 1px solid #EAECF0;
color: #98A2B3;
padding: 5px 5px 5px 10px;
width: 100%;
margin: 0;
display: block;
font-weight: 300;
}
.acf-admin-page .field-type-select-results {
position: relative;
top: 4px;
@ -2375,6 +2432,29 @@ html[dir=rtl] .acf-field-object.open > .handle {
}
}
.acf-taxonomy-select-id,
.acf-relationship-select-id,
.acf-post_object-select-id,
.acf-page_link-select-id {
color: #98A2B3;
padding-left: 10px;
}
.acf-taxonomy-select-sub-item {
max-width: 180px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-left: 5px;
}
.acf-taxonomy-select-name {
max-width: 180px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/*----------------------------------------------------------------------------
*
* Prefix & append styling
@ -2969,7 +3049,6 @@ html[dir=rtl] .acf-field-object.open > .handle {
margin-bottom: 16px;
}
.post-type-acf-field-group .acf-field-setting-fc_layout {
overflow: hidden;
width: calc(100% - 144px);
margin-right: 72px;
margin-left: 72px;
@ -3019,7 +3098,7 @@ html[dir=rtl] .acf-field-object.open > .handle {
align-items: center;
justify-content: left;
background-color: #F9FAFB;
border-radius: 8px 8px 0px 0px;
border-radius: 8px;
min-height: 64px;
margin-bottom: 0px;
padding-right: 24px;
@ -3110,6 +3189,9 @@ html[dir=rtl] .acf-field-object.open > .handle {
.post-type-acf-field-group .acf-field-settings-fc_head .acf-fl-actions li:last-of-type {
margin-right: 0;
}
.post-type-acf-field-group .acf-field-settings-fc_head.open {
border-radius: 8px 8px 0px 0px;
}
/*---------------------------------------------------------------------------------------------
*

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2408,7 +2408,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-internal-post-type .wp-list-table tbody td,
.acf-internal-post-type .wp-list-table tbody .acf-admin-page td, .acf-admin-page .acf-internal-post-type .wp-list-table thead th, .acf-internal-post-type .wp-list-table thead .acf-admin-page th, .acf-admin-page .acf-internal-post-type .wp-list-table thead td, .acf-internal-post-type .wp-list-table thead .acf-admin-page td,
.acf-admin-page .acf-internal-post-type .wp-list-table tfoot th,
.acf-internal-post-type .wp-list-table tfoot .acf-admin-page th, .acf-admin-page .acf-internal-post-type .wp-list-table tfoot td, .acf-internal-post-type .wp-list-table tfoot .acf-admin-page td, .acf-admin-page .acf-input .select2-container.-acf .select2-selection__rendered, .acf-admin-page .button, .acf-admin-page input[type=text],
.acf-internal-post-type .wp-list-table tfoot .acf-admin-page th, .acf-admin-page .acf-internal-post-type .wp-list-table tfoot td, .acf-internal-post-type .wp-list-table tfoot .acf-admin-page td, .acf-admin-page .acf-input .select2-container.-acf .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container.-acf .select2-selection__rendered, .acf-admin-page .button, .acf-admin-page input[type=text],
.acf-admin-page input[type=search],
.acf-admin-page input[type=number],
.acf-admin-page textarea,
@ -2623,6 +2624,7 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
border-color: #D0D5DD;
box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.1);
border-radius: 6px;
/* stylelint-disable-next-line scss/at-extend-no-missing-placeholder */
color: #344054;
}
.acf-admin-page input[type=text]:focus,
@ -2879,11 +2881,13 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .edit-field-group-header {
display: block !important;
}
.acf-admin-page .acf-input .select2-container.-acf .select2-selection {
.acf-admin-page .acf-input .select2-container.-acf .select2-selection,
.acf-admin-page .rule-groups .select2-container.-acf .select2-selection {
border: none;
line-height: 1;
}
.acf-admin-page .acf-input .select2-container.-acf .select2-selection__rendered {
.acf-admin-page .acf-input .select2-container.-acf .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container.-acf .select2-selection__rendered {
box-sizing: border-box;
padding-right: 0;
padding-left: 0;
@ -2893,39 +2897,67 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
border-color: #D0D5DD;
box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.1);
border-radius: 6px;
/* stylelint-disable-next-line scss/at-extend-no-missing-placeholder */
color: #344054;
}
.acf-admin-page .acf-input .select2-container--focus {
.acf-admin-page .acf-input .acf-conditional-select-name,
.acf-admin-page .rule-groups .acf-conditional-select-name {
min-width: 180px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.acf-admin-page .acf-input .acf-conditional-select-id,
.acf-admin-page .rule-groups .acf-conditional-select-id {
padding-right: 30px;
}
.acf-admin-page .acf-input .value .select2-container--focus,
.acf-admin-page .rule-groups .value .select2-container--focus {
height: 40px;
}
.acf-admin-page .acf-input .value .select2-container--open .select2-selection__rendered,
.acf-admin-page .rule-groups .value .select2-container--open .select2-selection__rendered {
border-color: #399CCB;
}
.acf-admin-page .acf-input .select2-container--focus,
.acf-admin-page .rule-groups .select2-container--focus {
outline: 3px solid #EBF5FA;
border-color: #399CCB;
border-radius: 6px;
}
.acf-admin-page .acf-input .select2-container--focus .select2-selection__rendered {
.acf-admin-page .acf-input .select2-container--focus .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--focus .select2-selection__rendered {
border-color: #399CCB !important;
}
.acf-admin-page .acf-input .select2-container--focus.select2-container--below.select2-container--open .select2-selection__rendered {
.acf-admin-page .acf-input .select2-container--focus.select2-container--below.select2-container--open .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--focus.select2-container--below.select2-container--open .select2-selection__rendered {
border-bottom-right-radius: 0 !important;
border-bottom-left-radius: 0 !important;
}
.acf-admin-page .acf-input .select2-container--focus.select2-container--above.select2-container--open .select2-selection__rendered {
.acf-admin-page .acf-input .select2-container--focus.select2-container--above.select2-container--open .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--focus.select2-container--above.select2-container--open .select2-selection__rendered {
border-top-right-radius: 0 !important;
border-top-left-radius: 0 !important;
}
.acf-admin-page .acf-input .select2-container .select2-search--inline .select2-search__field {
.acf-admin-page .acf-input .select2-container .select2-search--inline .select2-search__field,
.acf-admin-page .rule-groups .select2-container .select2-search--inline .select2-search__field {
margin: 0;
padding-left: 6px;
}
.acf-admin-page .acf-input .select2-container .select2-search--inline .select2-search__field:focus {
.acf-admin-page .acf-input .select2-container .select2-search--inline .select2-search__field:focus,
.acf-admin-page .rule-groups .select2-container .select2-search--inline .select2-search__field:focus {
outline: none;
border: none;
}
.acf-admin-page .acf-input .select2-container--default .select2-selection--multiple .select2-selection__rendered {
.acf-admin-page .acf-input .select2-container--default .select2-selection--multiple .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--default .select2-selection--multiple .select2-selection__rendered {
padding-top: 0;
padding-right: 6px;
padding-bottom: 0;
padding-left: 6px;
}
.acf-admin-page .acf-input .select2-selection__clear {
.acf-admin-page .acf-input .select2-selection__clear,
.acf-admin-page .rule-groups .select2-selection__clear {
width: 18px;
height: 18px;
margin-top: 12px;
@ -2935,7 +2967,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
overflow: hidden;
color: #fff;
}
.acf-admin-page .acf-input .select2-selection__clear:before {
.acf-admin-page .acf-input .select2-selection__clear:before,
.acf-admin-page .rule-groups .select2-selection__clear:before {
content: "";
display: block;
width: 16px;
@ -2954,7 +2987,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
mask-image: url("../../images/icons/icon-close.svg");
background-color: #98A2B3;
}
.acf-admin-page .acf-input .select2-selection__clear:hover::before {
.acf-admin-page .acf-input .select2-selection__clear:hover::before,
.acf-admin-page .rule-groups .select2-selection__clear:hover::before {
background-color: #0783BE;
}
.acf-admin-page .acf-label {
@ -2998,7 +3032,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-container.-acf,
.acf-admin-page .acf-field-delete-terms .select2-container.-acf,
.acf-admin-page .acf-field-assign-terms .select2-container.-acf,
.acf-admin-page .acf-field-meta-box .select2-container.-acf {
.acf-admin-page .acf-field-meta-box .select2-container.-acf,
.acf-admin-page .rule-groups .select2-container.-acf {
min-height: 40px;
}
.acf-admin-page .acf-field-setting-type .select2-container--default .select2-selection--single .select2-selection__rendered,
@ -3011,7 +3046,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .acf-field-delete-terms .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .acf-field-assign-terms .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .select2-selection__rendered {
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--default .select2-selection--single .select2-selection__rendered {
display: flex;
align-items: center;
position: relative;
@ -3032,7 +3068,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-container--default .select2-selection--single .field-type-icon,
.acf-admin-page .acf-field-delete-terms .select2-container--default .select2-selection--single .field-type-icon,
.acf-admin-page .acf-field-assign-terms .select2-container--default .select2-selection--single .field-type-icon,
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .field-type-icon {
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .field-type-icon,
.acf-admin-page .rule-groups .select2-container--default .select2-selection--single .field-type-icon {
top: auto;
width: 18px;
height: 18px;
@ -3048,7 +3085,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-container--default .select2-selection--single .field-type-icon:before,
.acf-admin-page .acf-field-delete-terms .select2-container--default .select2-selection--single .field-type-icon:before,
.acf-admin-page .acf-field-assign-terms .select2-container--default .select2-selection--single .field-type-icon:before,
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .field-type-icon:before {
.acf-admin-page .acf-field-meta-box .select2-container--default .select2-selection--single .field-type-icon:before,
.acf-admin-page .rule-groups .select2-container--default .select2-selection--single .field-type-icon:before {
width: 9px;
height: 9px;
}
@ -3062,7 +3100,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-container--open .select2-selection__rendered,
.acf-admin-page .acf-field-delete-terms .select2-container--open .select2-selection__rendered,
.acf-admin-page .acf-field-assign-terms .select2-container--open .select2-selection__rendered,
.acf-admin-page .acf-field-meta-box .select2-container--open .select2-selection__rendered {
.acf-admin-page .acf-field-meta-box .select2-container--open .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--open .select2-selection__rendered {
border-color: #6BB5D8 !important;
border-bottom-color: #D0D5DD !important;
}
@ -3076,7 +3115,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-container--open.select2-container--below .select2-selection__rendered,
.acf-admin-page .acf-field-delete-terms .select2-container--open.select2-container--below .select2-selection__rendered,
.acf-admin-page .acf-field-assign-terms .select2-container--open.select2-container--below .select2-selection__rendered,
.acf-admin-page .acf-field-meta-box .select2-container--open.select2-container--below .select2-selection__rendered {
.acf-admin-page .acf-field-meta-box .select2-container--open.select2-container--below .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--open.select2-container--below .select2-selection__rendered {
border-bottom-right-radius: 0 !important;
border-bottom-left-radius: 0 !important;
}
@ -3090,7 +3130,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-container--open.select2-container--above .select2-selection__rendered,
.acf-admin-page .acf-field-delete-terms .select2-container--open.select2-container--above .select2-selection__rendered,
.acf-admin-page .acf-field-assign-terms .select2-container--open.select2-container--above .select2-selection__rendered,
.acf-admin-page .acf-field-meta-box .select2-container--open.select2-container--above .select2-selection__rendered {
.acf-admin-page .acf-field-meta-box .select2-container--open.select2-container--above .select2-selection__rendered,
.acf-admin-page .rule-groups .select2-container--open.select2-container--above .select2-selection__rendered {
border-top-right-radius: 0 !important;
border-top-left-radius: 0 !important;
border-bottom-color: #6BB5D8 !important;
@ -3106,10 +3147,11 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .acf-selection.has-icon,
.acf-admin-page .acf-field-delete-terms .acf-selection.has-icon,
.acf-admin-page .acf-field-assign-terms .acf-selection.has-icon,
.acf-admin-page .acf-field-meta-box .acf-selection.has-icon {
.acf-admin-page .acf-field-meta-box .acf-selection.has-icon,
.acf-admin-page .rule-groups .acf-selection.has-icon {
margin-left: 6px;
}
.rtl.acf-admin-page .acf-field-setting-type .acf-selection.has-icon, .acf-admin-page .acf-field-permalink-rewrite .acf-selection.has-icon, .acf-admin-page .acf-field-query-var .acf-selection.has-icon, .acf-admin-page .acf-field-capability .acf-selection.has-icon, .acf-admin-page .acf-field-parent-slug .acf-selection.has-icon, .acf-admin-page .acf-field-data-storage .acf-selection.has-icon, .acf-admin-page .acf-field-manage-terms .acf-selection.has-icon, .acf-admin-page .acf-field-edit-terms .acf-selection.has-icon, .acf-admin-page .acf-field-delete-terms .acf-selection.has-icon, .acf-admin-page .acf-field-assign-terms .acf-selection.has-icon, .acf-admin-page .acf-field-meta-box .acf-selection.has-icon {
.rtl.acf-admin-page .acf-field-setting-type .acf-selection.has-icon, .acf-admin-page .acf-field-permalink-rewrite .acf-selection.has-icon, .acf-admin-page .acf-field-query-var .acf-selection.has-icon, .acf-admin-page .acf-field-capability .acf-selection.has-icon, .acf-admin-page .acf-field-parent-slug .acf-selection.has-icon, .acf-admin-page .acf-field-data-storage .acf-selection.has-icon, .acf-admin-page .acf-field-manage-terms .acf-selection.has-icon, .acf-admin-page .acf-field-edit-terms .acf-selection.has-icon, .acf-admin-page .acf-field-delete-terms .acf-selection.has-icon, .acf-admin-page .acf-field-assign-terms .acf-selection.has-icon, .acf-admin-page .acf-field-meta-box .acf-selection.has-icon, .acf-admin-page .rule-groups .acf-selection.has-icon {
margin-right: 6px;
}
@ -3123,7 +3165,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-selection__arrow,
.acf-admin-page .acf-field-delete-terms .select2-selection__arrow,
.acf-admin-page .acf-field-assign-terms .select2-selection__arrow,
.acf-admin-page .acf-field-meta-box .select2-selection__arrow {
.acf-admin-page .acf-field-meta-box .select2-selection__arrow,
.acf-admin-page .rule-groups .select2-selection__arrow {
width: 20px;
height: 20px;
top: calc(50% - 10px);
@ -3140,7 +3183,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-selection__arrow:after,
.acf-admin-page .acf-field-delete-terms .select2-selection__arrow:after,
.acf-admin-page .acf-field-assign-terms .select2-selection__arrow:after,
.acf-admin-page .acf-field-meta-box .select2-selection__arrow:after {
.acf-admin-page .acf-field-meta-box .select2-selection__arrow:after,
.acf-admin-page .rule-groups .select2-selection__arrow:after {
content: "";
display: block;
position: absolute;
@ -3174,7 +3218,8 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-selection__arrow b[role=presentation],
.acf-admin-page .acf-field-delete-terms .select2-selection__arrow b[role=presentation],
.acf-admin-page .acf-field-assign-terms .select2-selection__arrow b[role=presentation],
.acf-admin-page .acf-field-meta-box .select2-selection__arrow b[role=presentation] {
.acf-admin-page .acf-field-meta-box .select2-selection__arrow b[role=presentation],
.acf-admin-page .rule-groups .select2-selection__arrow b[role=presentation] {
display: none;
}
.acf-admin-page .acf-field-setting-type .select2-container--open .select2-selection__arrow:after,
@ -3187,10 +3232,22 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .acf-field-edit-terms .select2-container--open .select2-selection__arrow:after,
.acf-admin-page .acf-field-delete-terms .select2-container--open .select2-selection__arrow:after,
.acf-admin-page .acf-field-assign-terms .select2-container--open .select2-selection__arrow:after,
.acf-admin-page .acf-field-meta-box .select2-container--open .select2-selection__arrow:after {
.acf-admin-page .acf-field-meta-box .select2-container--open .select2-selection__arrow:after,
.acf-admin-page .rule-groups .select2-container--open .select2-selection__arrow:after {
-webkit-mask-image: url("../../images/icons/icon-chevron-up.svg");
mask-image: url("../../images/icons/icon-chevron-up.svg");
}
.acf-admin-page .acf-term-search-term-name {
background-color: #F9FAFB;
border-top: 1px solid #EAECF0;
border-bottom: 1px solid #EAECF0;
color: #98A2B3;
padding: 5px 5px 5px 10px;
width: 100%;
margin: 0;
display: block;
font-weight: 300;
}
.acf-admin-page .field-type-select-results {
position: relative;
top: 4px;
@ -4752,6 +4809,7 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-headerbar-field-editor {
position: relative;
top: 46px;
z-index: unset;
}
}
@media screen and (max-width: 880px) {
@ -5526,6 +5584,11 @@ h3.acf-sub-field-list-title:before,
mask-image: url("../../images/field-type-icons/icon-field-color-picker.svg");
}
.field-type-icon.field-type-icon-icon-picker:before {
-webkit-mask-image: url("../../images/field-type-icons/icon-field-icon-picker.svg");
mask-image: url("../../images/field-type-icons/icon-field-icon-picker.svg");
}
.field-type-icon.field-type-icon-message:before {
-webkit-mask-image: url("../../images/field-type-icons/icon-field-message.svg");
mask-image: url("../../images/field-type-icons/icon-field-message.svg");
@ -6967,5 +7030,419 @@ h3.acf-sub-field-list-title:before,
display: none;
}
}
.acf-block-body .acf-field-icon-picker .acf-tab-group {
margin: 0;
padding-left: 0 !important;
}
.acf-field-icon-picker {
max-width: 600px;
}
.acf-field-icon-picker .acf-tab-group {
padding: 0;
border-bottom: 0;
overflow: hidden;
}
.acf-field-icon-picker .active a {
background: #667085;
color: #fff;
}
.acf-field-icon-picker .acf-dashicons-search-wrap {
position: relative;
}
.acf-field-icon-picker .acf-dashicons-search-wrap::after {
content: "";
display: block;
position: absolute;
top: 6px;
left: 10px;
width: 18px;
height: 18px;
-webkit-mask-image: url(../../images/icons/icon-search.svg);
mask-image: url(../../images/icons/icon-search.svg);
background-color: #98A2B3;
border: none;
border-radius: 0;
-webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-position: center;
mask-position: center;
text-indent: 500%;
white-space: nowrap;
overflow: hidden;
}
.acf-field-icon-picker .acf-dashicons-search-wrap .acf-dashicons-search-input {
padding-left: 32px;
border-radius: 0;
}
.acf-field-icon-picker .acf-dashicons-list {
margin-bottom: 0;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-content: start;
height: 135px;
overflow: hidden;
overflow-y: auto;
background-color: #f9f9f9;
border: 1px solid #8c8f94;
border-top: none;
border-radius: 0 0 6px 6px;
gap: 8px;
padding: 8px;
}
.acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon {
background-color: transparent;
display: flex;
justify-content: center;
align-items: center;
width: 32px;
height: 32px;
border: solid 2px transparent;
color: #3c434a;
}
.acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon label {
display: none;
}
.acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon [type=radio],
.acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon [type=radio]:active,
.acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon [type=radio]:checked::before,
.acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon [type=radio]:focus {
all: initial;
appearance: none;
}
.acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon:hover {
border: solid 2px #0783BE;
border-radius: 6px;
cursor: pointer;
}
.acf-field-icon-picker .acf-dashicons-list .active {
border: solid 2px #0783BE;
background-color: #EBF5FA;
border-radius: 6px;
}
.acf-field-icon-picker .acf-dashicons-list .active.focus {
border: solid 2px #0783BE;
background-color: #EBF5FA;
border-radius: 6px;
box-shadow: 0 0 2px #0783be;
}
.acf-field-icon-picker .acf-dashicons-list::after {
content: "";
flex: auto;
}
.acf-field-icon-picker .acf-dashicons-list-empty {
position: relative;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
padding-top: 10px;
padding-left: 10px;
height: 135px;
overflow: scroll;
background-color: #F9FAFB;
border: 1px solid #D0D5DD;
border-top: none;
border-radius: 0 0 6px 6px;
}
.acf-field-icon-picker .acf-dashicons-list-empty img {
height: 30px;
width: 30px;
color: #D0D5DD;
}
.acf-field-icon-picker .acf-icon-picker-media-library,
.acf-field-icon-picker .acf-icon-picker-url-tabs {
box-sizing: border-box;
display: flex;
align-items: center;
justify-items: center;
gap: 12px;
background-color: #f9f9f9;
padding: 12px;
border: 1px solid #8c8f94;
border-radius: 0;
}
.acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-preview,
.acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-preview {
all: unset;
cursor: pointer;
}
.acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-preview:focus,
.acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-preview:focus {
outline: 1px solid #0783BE;
border-radius: 6px;
}
.acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-preview-dashicon,
.acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-preview-img,
.acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-preview-dashicon,
.acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-preview-img {
box-sizing: border-box;
width: 40px;
height: 40px;
border: solid 2px transparent;
color: #fff;
background-color: #191e23;
display: flex;
justify-content: center;
align-items: center;
border-radius: 6px;
}
.acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-preview-img > img,
.acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-preview-img > img {
width: 90%;
height: 90%;
object-fit: cover;
border-radius: 5px;
border: 1px solid #667085;
}
.acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-button,
.acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-button {
height: 40px;
background-color: #0783BE;
border: none;
border-radius: 6px;
padding: 8px 12px;
color: #fff;
display: flex;
align-items: center;
justify-items: center;
gap: 4px;
cursor: pointer;
}
.acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-url,
.acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-url {
width: 100%;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker {
max-width: 600px;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .active a {
background: #667085;
color: #fff;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-tab-button {
border: none;
height: 25px;
padding: 5px 10px;
border-radius: 15px;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker li a .acf-tab-button {
color: #667085;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker > *:not(.acf-tab-wrap) {
top: -32px;
position: relative;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-tab-wrap .acf-tab-group {
margin-right: 48px;
display: flex;
gap: 10px;
justify-content: flex-end;
align-items: center;
background: none;
border: none;
max-width: 648px;
border-bottom-width: 0;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-tab-wrap .acf-tab-group li {
all: initial;
box-sizing: border-box;
margin-bottom: -17px;
margin-right: 0;
border-radius: 10px;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-tab-wrap .acf-tab-group li a {
all: initial;
outline: 1px solid transparent;
color: #667085;
box-sizing: border-box;
border-radius: 100px;
cursor: pointer;
padding: 7px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 12.5px;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-tab-wrap .acf-tab-group li.active a {
background-color: #667085;
color: #fff;
border-bottom-width: 1px !important;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-tab-wrap .acf-tab-group li a:focus {
outline: 1px solid #0783BE;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-tab-wrap {
background: none;
border: none;
overflow: visible;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-search-wrap {
position: relative;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-search-wrap::after {
content: "";
display: block;
position: absolute;
top: 11px;
left: 10px;
width: 18px;
height: 18px;
-webkit-mask-image: url(../../images/icons/icon-search.svg);
mask-image: url(../../images/icons/icon-search.svg);
background-color: #98A2B3;
border: none;
border-radius: 0;
-webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-position: center;
mask-position: center;
text-indent: 500%;
white-space: nowrap;
overflow: hidden;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-search-wrap .acf-dashicons-search-input {
padding-left: 32px;
border-radius: 6px 6px 0 0;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list {
margin-bottom: -32px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-content: start;
height: 135px;
overflow: hidden;
overflow-y: auto;
background-color: #F9FAFB;
border: 1px solid #D0D5DD;
border-top: none;
border-radius: 0 0 6px 6px;
gap: 8px;
padding: 8px;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon {
background-color: transparent;
display: flex;
justify-content: center;
align-items: center;
width: 32px;
height: 32px;
border: solid 2px transparent;
color: #3c434a;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon label {
display: none;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon [type=radio],
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon [type=radio]:active,
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon [type=radio]:checked::before,
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon [type=radio]:focus {
all: initial;
appearance: none;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list .acf-icon-picker-dashicon:hover {
border: solid 2px #0783BE;
border-radius: 6px;
cursor: pointer;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list .active {
border: solid 2px #0783BE;
background-color: #EBF5FA;
border-radius: 6px;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list .active.focus {
border: solid 2px #0783BE;
background-color: #EBF5FA;
border-radius: 6px;
box-shadow: 0 0 2px #0783be;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list::after {
content: "";
flex: auto;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list-empty {
position: relative;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
padding-top: 10px;
padding-left: 10px;
height: 135px;
overflow: scroll;
background-color: #F9FAFB;
border: 1px solid #D0D5DD;
border-top: none;
border-radius: 0 0 6px 6px;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-dashicons-list-empty img {
height: 30px;
width: 30px;
color: #D0D5DD;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-media-library,
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-url-tabs {
box-sizing: border-box;
display: flex;
align-items: center;
justify-items: center;
gap: 12px;
background-color: #F9FAFB;
padding: 12px;
border: 1px solid #D0D5DD;
border-radius: 6px;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-preview,
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-preview {
all: unset;
cursor: pointer;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-preview:focus,
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-preview:focus {
outline: 1px solid #0783BE;
border-radius: 6px;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-preview-dashicon,
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-preview-img,
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-preview-dashicon,
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-preview-img {
box-sizing: border-box;
width: 40px;
height: 40px;
border: solid 2px transparent;
color: #fff;
background-color: #191e23;
display: flex;
justify-content: center;
align-items: center;
border-radius: 6px;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-preview-img > img,
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-preview-img > img {
width: 90%;
height: 90%;
object-fit: cover;
border-radius: 5px;
border: 1px solid #667085;
}
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-media-library .acf-icon-picker-media-library-button,
.acf-admin-page.acf-internal-post-type .acf-field-icon-picker .acf-icon-picker-url-tabs .acf-icon-picker-media-library-button {
height: 40px;
background-color: #0783BE;
border: none;
border-radius: 6px;
padding: 8px 12px;
color: #fff;
display: flex;
align-items: center;
justify-items: center;
gap: 4px;
cursor: pointer;
}
/*# sourceMappingURL=acf-global.css.map*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2437,8 +2437,8 @@ tr.acf-accordion + tr.acf-accordion {
.block-editor .edit-post-sidebar .acf-fields > .acf-field {
border-width: 0;
border-color: #e2e4e7;
margin: 16px;
padding: 0;
margin: 0px;
padding: 10px 16px;
width: auto !important;
min-height: 0 !important;
float: none !important;
@ -2471,6 +2471,27 @@ tr.acf-accordion + tr.acf-accordion {
.block-editor .edit-post-sidebar .acf-fields > .acf-field.acf-accordion .acf-accordion-content > .acf-fields {
border-top-width: 0;
}
.block-editor .edit-post-sidebar .block-editor-block-inspector .acf-fields > .acf-notice {
display: grid;
grid-template-columns: 1fr 25px;
padding: 10px;
margin: 0;
}
.block-editor .edit-post-sidebar .block-editor-block-inspector .acf-fields > .acf-notice p:last-of-type {
margin: 0;
}
.block-editor .edit-post-sidebar .block-editor-block-inspector .acf-fields > .acf-notice > .acf-notice-dismiss {
position: relative;
top: unset;
right: unset;
}
.block-editor .edit-post-sidebar .block-editor-block-inspector .acf-fields .acf-field .acf-notice {
margin: 0;
padding: 0;
}
.block-editor .edit-post-sidebar .block-editor-block-inspector .acf-fields .acf-error {
margin-bottom: 10px;
}
/*-----------------------------------------------------------------------------
*

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -697,6 +697,10 @@ html[dir=rtl] .acf-gallery .acf-gallery-side-data th.label {
margin: 0;
}
.block-editor .acf-field.acf-error {
background-color: rgba(255, 0, 0, 0.05);
}
.acf-block-component .acf-block-fields {
background: #fff;
text-align: left;
@ -722,40 +726,149 @@ html[dir=rtl] .acf-block-component .acf-block-fields {
line-height: 1.5;
}
.acf-block-body .acf-block-fields {
.acf-block-body .acf-block-fields:has(> .acf-error-message),
.acf-block-fields:has(> .acf-error-message) .acf-block-fields:has(> .acf-error-message) {
border: none !important;
}
.acf-block-body .acf-error-message,
.acf-block-fields:has(> .acf-error-message) .acf-error-message {
margin-top: 0;
border: none;
}
.acf-block-body .acf-error-message .acf-notice-dismiss,
.acf-block-fields:has(> .acf-error-message) .acf-error-message .acf-notice-dismiss {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
outline: unset;
}
.acf-block-body .acf-error-message .acf-icon.-cancel::before,
.acf-block-fields:has(> .acf-error-message) .acf-error-message .acf-icon.-cancel::before {
margin: 0 !important;
}
.acf-block-body.acf-block-has-validation-error,
.acf-block-fields:has(> .acf-error-message).acf-block-has-validation-error {
border: 2px solid #d94f4f;
}
.acf-block-body .acf-error .acf-input .acf-notice,
.acf-block-fields:has(> .acf-error-message) .acf-error .acf-input .acf-notice {
background: none !important;
border: none !important;
display: flex !important;
align-items: center !important;
padding-left: 0;
}
.acf-block-body .acf-error .acf-input .acf-notice p,
.acf-block-fields:has(> .acf-error-message) .acf-error .acf-input .acf-notice p {
margin: 0.5em 0 !important;
}
.acf-block-body .acf-error .acf-input .acf-notice::before,
.acf-block-fields:has(> .acf-error-message) .acf-error .acf-input .acf-notice::before {
content: "";
position: relative;
top: 0;
left: 0;
font-size: 20px;
background-image: url(../../../images/icons/icon-info-red.svg);
background-repeat: no-repeat;
background-position: center;
background-size: 69%;
height: 26px !important;
width: 26px !important;
box-sizing: border-box;
}
.acf-block-body .acf-error .acf-label label,
.acf-block-fields:has(> .acf-error-message) .acf-error .acf-label label {
color: #d94f4f;
}
.acf-block-body .acf-error .acf-input input,
.acf-block-fields:has(> .acf-error-message) .acf-error .acf-input input {
border-color: #d94f4f;
}
.acf-block-body.acf-block-has-validation-error::before,
.acf-block-fields:has(> .acf-error-message).acf-block-has-validation-error::before {
content: "";
position: absolute;
top: -2px;
left: -32px;
font-size: 20px;
background-color: #d94f4f;
background-image: url(../../../images/icons/icon-info-white.svg);
background-repeat: no-repeat;
background-position-x: center;
background-position-y: 52%;
background-size: 55%;
height: 40px;
width: 32px;
box-sizing: border-box;
}
.acf-block-body .acf-block-validation-error,
.acf-block-fields:has(> .acf-error-message) .acf-block-validation-error {
color: #d94f4f;
display: flex;
align-items: center;
}
.acf-block-body .acf-block-fields,
.acf-block-fields:has(> .acf-error-message) .acf-block-fields {
border: #adb2ad solid 1px;
}
.acf-block-body .acf-block-fields .acf-tab-wrap .acf-tab-group {
.acf-block-body .acf-block-fields .acf-tab-wrap .acf-tab-group,
.acf-block-fields:has(> .acf-error-message) .acf-block-fields .acf-tab-wrap .acf-tab-group {
margin-left: 0;
padding: 16px 20px 0;
}
.acf-block-body .acf-fields > .acf-field {
.acf-block-body .acf-fields > .acf-field,
.acf-block-fields:has(> .acf-error-message) .acf-fields > .acf-field {
padding: 16px 20px;
}
.acf-block-body .acf-fields > .acf-field.acf-accordion {
.acf-block-body .acf-fields > .acf-field.acf-accordion,
.acf-block-fields:has(> .acf-error-message) .acf-fields > .acf-field.acf-accordion {
border-color: #adb2ad;
}
.acf-block-body .acf-fields > .acf-field.acf-accordion .acf-accordion-title {
.acf-block-body .acf-fields > .acf-field.acf-accordion .acf-accordion-title,
.acf-block-fields:has(> .acf-error-message) .acf-fields > .acf-field.acf-accordion .acf-accordion-title {
padding: 16px 20px;
}
.acf-block-body .acf-button, .acf-block-body .acf-link a.button, .acf-block-body .acf-add-checkbox {
.acf-block-body .acf-button,
.acf-block-body .acf-link a.button,
.acf-block-body .acf-add-checkbox,
.acf-block-fields:has(> .acf-error-message) .acf-button,
.acf-block-fields:has(> .acf-error-message) .acf-link a.button,
.acf-block-fields:has(> .acf-error-message) .acf-add-checkbox {
color: #2271b1 !important;
border-color: #2271b1 !important;
background: #f6f7f7 !important;
vertical-align: top;
}
.acf-block-body .acf-button.button-primary:hover, .acf-block-body .acf-link a.button.button-primary:hover, .acf-block-body .acf-add-checkbox.button-primary:hover {
.acf-block-body .acf-button.button-primary:hover,
.acf-block-body .acf-link a.button.button-primary:hover,
.acf-block-body .acf-add-checkbox.button-primary:hover,
.acf-block-fields:has(> .acf-error-message) .acf-button.button-primary:hover,
.acf-block-fields:has(> .acf-error-message) .acf-link a.button.button-primary:hover,
.acf-block-fields:has(> .acf-error-message) .acf-add-checkbox.button-primary:hover {
color: white !important;
background: #2271b1 !important;
}
.acf-block-body .acf-button:focus, .acf-block-body .acf-link a.button:focus, .acf-block-body .acf-add-checkbox:focus {
.acf-block-body .acf-button:focus,
.acf-block-body .acf-link a.button:focus,
.acf-block-body .acf-add-checkbox:focus,
.acf-block-fields:has(> .acf-error-message) .acf-button:focus,
.acf-block-fields:has(> .acf-error-message) .acf-link a.button:focus,
.acf-block-fields:has(> .acf-error-message) .acf-add-checkbox:focus {
outline: none !important;
background: #f6f7f7 !important;
}
.acf-block-body .acf-button:hover, .acf-block-body .acf-link a.button:hover, .acf-block-body .acf-add-checkbox:hover {
.acf-block-body .acf-button:hover,
.acf-block-body .acf-link a.button:hover,
.acf-block-body .acf-add-checkbox:hover,
.acf-block-fields:has(> .acf-error-message) .acf-button:hover,
.acf-block-fields:has(> .acf-error-message) .acf-link a.button:hover,
.acf-block-fields:has(> .acf-error-message) .acf-add-checkbox:hover {
color: #0a4b78 !important;
}
.acf-block-body .acf-block-preview {
.acf-block-body .acf-block-preview,
.acf-block-fields:has(> .acf-error-message) .acf-block-preview {
min-height: 10px;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,24 +3,9 @@ var __webpack_exports__ = {};
/*!*********************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/acf-escaped-html-notice.js ***!
\*********************************************************************************/
(function ($, undefined) {
/* global, acf_escaped_html_notice */
(function ($) {
const $notice = $('.acf-escaped-html-notice');
$notice.on('click', '.notice-dismiss', function (e) {
const $target = $(e.target).closest('.acf-escaped-html-notice');
let to_dismiss = 'escaped_html';
if ($target.hasClass('acf-will-escape')) {
to_dismiss = 'to_be_escaped';
}
$.ajax({
url: ajaxurl,
data: {
'action': 'acf/dismiss_escaped_html_notice',
'nonce': acf_escaped_html_notice.nonce,
'notice': to_dismiss
},
type: 'post'
});
});
$notice.on('click', '.acf-show-more-details', function (e) {
e.preventDefault();
const $link = $(e.target);

View File

@ -1 +1 @@
{"version":3,"file":"acf-escaped-html-notice.js","mappings":";;;;;AAAA,CAAE,UAAWA,CAAC,EAAEC,SAAS,EAAG;EAE3B,MAAMC,OAAO,GAAGF,CAAC,CAAE,0BAA2B,CAAC;EAE/CE,OAAO,CAACC,EAAE,CAAE,OAAO,EAAE,iBAAiB,EAAE,UAAUC,CAAC,EAAG;IACrD,MAAMC,OAAO,GAAGL,CAAC,CAAEI,CAAC,CAACE,MAAO,CAAC,CAACC,OAAO,CAAE,0BAA2B,CAAC;IAEnE,IAAIC,UAAU,GAAG,cAAc;IAC/B,IAAKH,OAAO,CAACI,QAAQ,CAAE,iBAAkB,CAAC,EAAG;MAC5CD,UAAU,GAAG,eAAe;IAC7B;IAEAR,CAAC,CAACU,IAAI,CAAE;MACPC,GAAG,EAAEC,OAAO;MACZC,IAAI,EAAE;QACL,QAAQ,EAAE,iCAAiC;QAC3C,OAAO,EAAEC,uBAAuB,CAACC,KAAK;QACtC,QAAQ,EAAEP;MACX,CAAC;MACDQ,IAAI,EAAE;IACP,CAAE,CAAC;EACJ,CAAE,CAAC;EAEHd,OAAO,CAACC,EAAE,CAAE,OAAO,EAAE,wBAAwB,EAAE,UAAUC,CAAC,EAAG;IAC5DA,CAAC,CAACa,cAAc,CAAC,CAAC;IAElB,MAAMC,KAAK,GAAGlB,CAAC,CAAEI,CAAC,CAACE,MAAO,CAAC;IAC3B,MAAMa,QAAQ,GAAGD,KAAK,CAACX,OAAO,CAAE,0BAA2B,CAAC,CAACa,IAAI,CAAE,oBAAqB,CAAC;IAEzF,IAAKD,QAAQ,CAACE,EAAE,CAAE,SAAU,CAAC,EAAG;MAC/BF,QAAQ,CAACG,SAAS,CAAE,GAAI,CAAC;MACzBJ,KAAK,CAACK,IAAI,CAAET,uBAAuB,CAACU,YAAa,CAAC;IACnD,CAAC,MAAM;MACNL,QAAQ,CAACM,OAAO,CAAE,GAAI,CAAC;MACvBP,KAAK,CAACK,IAAI,CAAET,uBAAuB,CAACY,YAAa,CAAC;IACnD;EACD,CAAE,CAAC;AAEJ,CAAC,EAAIC,MAAO,CAAC,C","sources":["webpack://advanced-custom-fields-pro/./src/advanced-custom-fields-pro/assets/src/js/acf-escaped-html-notice.js"],"sourcesContent":["( function ( $, undefined ) {\n\n\tconst $notice = $( '.acf-escaped-html-notice' );\n\n\t$notice.on( 'click', '.notice-dismiss', function( e ) {\n\t\tconst $target = $( e.target ).closest( '.acf-escaped-html-notice' );\n\n\t\tlet to_dismiss = 'escaped_html';\n\t\tif ( $target.hasClass( 'acf-will-escape' ) ) {\n\t\t\tto_dismiss = 'to_be_escaped';\n\t\t}\n\n\t\t$.ajax( {\n\t\t\turl: ajaxurl,\n\t\t\tdata: {\n\t\t\t\t'action': 'acf/dismiss_escaped_html_notice',\n\t\t\t\t'nonce': acf_escaped_html_notice.nonce,\n\t\t\t\t'notice': to_dismiss,\n\t\t\t},\n\t\t\ttype: 'post'\n\t\t} );\n\t} );\n\n\t$notice.on( 'click', '.acf-show-more-details', function( e ) {\n\t\te.preventDefault();\n\n\t\tconst $link = $( e.target );\n\t\tconst $details = $link.closest( '.acf-escaped-html-notice' ).find( '.acf-error-details' );\n\n\t\tif ( $details.is( ':hidden' ) ) {\n\t\t\t$details.slideDown( 100 );\n\t\t\t$link.text( acf_escaped_html_notice.hide_details );\n\t\t} else {\n\t\t\t$details.slideUp( 100 );\n\t\t\t$link.text( acf_escaped_html_notice.show_details );\n\t\t}\n\t} );\n\n} )( jQuery );\n"],"names":["$","undefined","$notice","on","e","$target","target","closest","to_dismiss","hasClass","ajax","url","ajaxurl","data","acf_escaped_html_notice","nonce","type","preventDefault","$link","$details","find","is","slideDown","text","hide_details","slideUp","show_details","jQuery"],"sourceRoot":""}
{"version":3,"file":"acf-escaped-html-notice.js","mappings":";;;;;AAAA;AACA,CAAE,UAAWA,CAAC,EAAG;EAChB,MAAMC,OAAO,GAAGD,CAAC,CAAE,0BAA2B,CAAC;EAE/CC,OAAO,CAACC,EAAE,CAAE,OAAO,EAAE,wBAAwB,EAAE,UAAWC,CAAC,EAAG;IAC7DA,CAAC,CAACC,cAAc,CAAC,CAAC;IAElB,MAAMC,KAAK,GAAGL,CAAC,CAAEG,CAAC,CAACG,MAAO,CAAC;IAC3B,MAAMC,QAAQ,GAAGF,KAAK,CACpBG,OAAO,CAAE,0BAA2B,CAAC,CACrCC,IAAI,CAAE,oBAAqB,CAAC;IAE9B,IAAKF,QAAQ,CAACG,EAAE,CAAE,SAAU,CAAC,EAAG;MAC/BH,QAAQ,CAACI,SAAS,CAAE,GAAI,CAAC;MACzBN,KAAK,CAACO,IAAI,CAAEC,uBAAuB,CAACC,YAAa,CAAC;IACnD,CAAC,MAAM;MACNP,QAAQ,CAACQ,OAAO,CAAE,GAAI,CAAC;MACvBV,KAAK,CAACO,IAAI,CAAEC,uBAAuB,CAACG,YAAa,CAAC;IACnD;EACD,CAAE,CAAC;AACJ,CAAC,EAAIC,MAAO,CAAC,C","sources":["webpack://advanced-custom-fields-pro/./src/advanced-custom-fields-pro/assets/src/js/acf-escaped-html-notice.js"],"sourcesContent":["/* global, acf_escaped_html_notice */\n( function ( $ ) {\n\tconst $notice = $( '.acf-escaped-html-notice' );\n\n\t$notice.on( 'click', '.acf-show-more-details', function ( e ) {\n\t\te.preventDefault();\n\n\t\tconst $link = $( e.target );\n\t\tconst $details = $link\n\t\t\t.closest( '.acf-escaped-html-notice' )\n\t\t\t.find( '.acf-error-details' );\n\n\t\tif ( $details.is( ':hidden' ) ) {\n\t\t\t$details.slideDown( 100 );\n\t\t\t$link.text( acf_escaped_html_notice.hide_details );\n\t\t} else {\n\t\t\t$details.slideUp( 100 );\n\t\t\t$link.text( acf_escaped_html_notice.show_details );\n\t\t}\n\t} );\n} )( jQuery );\n"],"names":["$","$notice","on","e","preventDefault","$link","target","$details","closest","find","is","slideDown","text","acf_escaped_html_notice","hide_details","slideUp","show_details","jQuery"],"sourceRoot":""}

View File

@ -1 +1 @@
!function(e,t){const c=e(".acf-escaped-html-notice");c.on("click",".notice-dismiss",(function(t){let c="escaped_html";e(t.target).closest(".acf-escaped-html-notice").hasClass("acf-will-escape")&&(c="to_be_escaped"),e.ajax({url:ajaxurl,data:{action:"acf/dismiss_escaped_html_notice",nonce:acf_escaped_html_notice.nonce,notice:c},type:"post"})})),c.on("click",".acf-show-more-details",(function(t){t.preventDefault();const c=e(t.target),a=c.closest(".acf-escaped-html-notice").find(".acf-error-details");a.is(":hidden")?(a.slideDown(100),c.text(acf_escaped_html_notice.hide_details)):(a.slideUp(100),c.text(acf_escaped_html_notice.show_details))}))}(jQuery);
(()=>{var e;(e=jQuery)(".acf-escaped-html-notice").on("click",".acf-show-more-details",(function(t){t.preventDefault();const c=e(t.target),a=c.closest(".acf-escaped-html-notice").find(".acf-error-details");a.is(":hidden")?(a.slideDown(100),c.text(acf_escaped_html_notice.hide_details)):(a.slideUp(100),c.text(acf_escaped_html_notice.show_details))}))})();

View File

@ -566,6 +566,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
$tabLabel: function () {
return this.fieldObject.$el.find('.conditional-logic-badge');
},
$conditionalValueSelect: function () {
return this.$('.condition-rule-value');
},
open: function () {
var $div = this.$control();
$div.show();
@ -705,51 +708,57 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
if (!this.ruleData('field') || !this.ruleData('operator')) {
return;
}
// vars
var $select = this.$input('value');
var $td = this.$td('value');
var val = $select.val();
var currentVal = $select.val();
var savedValue = this.$rule[0].getAttribute('data-value');
// get selected field
var $field = acf.findFieldObject(this.ruleData('field'));
var field = acf.getFieldObject($field);
// get selected field conditions
var conditionTypes = acf.getConditionTypes({
fieldType: field.getType(),
operator: this.ruleData('operator')
});
// html
var conditionType = conditionTypes[0].prototype;
var choices = conditionType.choices(field);
// create html: array
if (choices instanceof Array) {
var $newSelect = $('<select></select>');
let $newSelect;
if (choices instanceof jQuery && !!choices.data('acfSelect2Props')) {
$newSelect = $select.clone();
// If converting from a disabled input, we need to convert it to an active select.
if ($newSelect.is('input')) {
var classes = $select.attr('class');
const $rebuiltSelect = $('<select></select>').addClass(classes).val(savedValue);
$newSelect = $rebuiltSelect;
}
acf.addAction('acf_conditional_value_rendered', function () {
acf.newSelect2($newSelect, choices.data('acfSelect2Props'));
});
} else if (choices instanceof Array) {
this.$conditionalValueSelect().removeClass('select2-hidden-accessible');
$newSelect = $('<select></select>');
acf.renderSelect($newSelect, choices);
// create html: string (<input />)
} else {
var $newSelect = $(choices);
this.$conditionalValueSelect().removeClass('select2-hidden-accessible');
$newSelect = $(choices);
}
// append
$select.detach();
$td.html($newSelect);
// copy attrs
// timeout needed to avoid browser bug where "disabled" attribute is not applied
setTimeout(function () {
['class', 'name', 'id'].map(function (attr) {
$newSelect.attr(attr, $select.attr(attr));
});
$select.val(savedValue);
acf.doAction('acf_conditional_value_rendered');
}, 0);
// select existing value (if not a disabled input)
if (!$newSelect.prop('disabled')) {
acf.val($newSelect, val, true);
acf.val($newSelect, currentVal, true);
}
// set
@ -774,6 +783,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
// remove all tr's except the first one
$group2.find('tr').not(':first').remove();
// Find the remaining tr and render
var $tr = $group2.find('tr');
this.renderRule($tr);
// save field
this.fieldObject.save();
},
@ -1236,7 +1249,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
if ($(e.target).hasClass('acf-input-wrap')) {
copyValue = $(e.target).find('input').first().val();
} else {
copyValue = $(e.target).text();
copyValue = $(e.target).text().trim();
}
navigator.clipboard.writeText(copyValue).then(() => {
$(e.target).closest('.copyable').addClass('copied');
@ -2762,6 +2775,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
var _field$data;
if ((field === null || field === void 0 || (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.call(field, 'key')) !== 'bidirectional_target') return args;
args.dropdownCssClass = 'field-type-select-results';
// Check for a full modern version of select2 like the one provided by ACF.
try {
$.fn.select2.amd.require('select2/compat/dropdownCss');
} catch (err) {
console.warn('ACF was not able to load the full version of select2 due to a conflicting version provided by another plugin or theme taking precedence. Skipping styling of bidirectional settings.');
delete args.dropdownCssClass;
}
args.templateResult = function (selection) {
if ('undefined' !== typeof selection.element) {
return selection;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1238,6 +1238,7 @@
timeout: 0,
dismiss: true,
target: false,
location: 'before',
close: function () {}
},
events: {
@ -1289,8 +1290,13 @@
},
show: function () {
var $target = this.get('target');
var location = this.get('location');
if ($target) {
$target.prepend(this.$el);
if (location === 'after') {
$target.append(this.$el);
} else {
$target.prepend(this.$el);
}
}
},
hide: function () {
@ -3323,7 +3329,6 @@
// filter for 3rd party customization
data = acf.applyFilters('prepare_for_ajax', data);
// return
return data;
};
@ -3869,7 +3874,6 @@
itemsHtml += '<option value="' + acf.escAttr(id) + '"' + (item.disabled ? ' disabled="disabled"' : '') + '>' + acf.strEscape(text) + '</option>';
}
});
// return
return itemsHtml;
};
@ -4349,6 +4353,15 @@
acf.doAction('refresh');
}, 0);
/**
* Log something to console if we're in debug mode.
*
* @since 6.3
*/
acf.debug = function () {
if (acf.get('debug')) console.log.apply(null, arguments);
};
// Set up actions from events
$(document).ready(function () {
acf.doAction('ready');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -40,7 +40,7 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
Component
} = React;
const {
withSelect
useSelect
} = wp.data;
const {
createHigherOrderComponent
@ -61,6 +61,15 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
*/
const blockTypes = {};
/**
* Data storage for Block Instances and their DynamicHTML components.
* This is temporarily stored on the ACF object, but this will be replaced in ACF 6.4.
* Developers should not rely on reading or using any aspect of acf.blockInstances.
*
* @since 6.3
*/
acf.blockInstances = {};
/**
* Returns a block type for the given name.
*
@ -88,6 +97,19 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
return blockType.acf_block_version || 1;
}
/**
* Returns a block's validate property. Default true.
*
* @since 6.3
*
* @param string name The block name
* @return boolean
*/
function blockSupportsValidation(name) {
const blockType = getBlockType(name);
return blockType.validate;
}
/**
* Returns true if a block (identified by client ID) is nested in a query loop block.
*
@ -229,7 +251,7 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
// Remove all empty attribute defaults from PHP values to allow serialisation.
// https://github.com/WordPress/gutenberg/issues/7342
for (const key in blockType.attributes) {
if (blockType.attributes[key].default.length === 0) {
if ('default' in blockType.attributes[key] && blockType.attributes[key].default.length === 0) {
delete blockType.attributes[key].default;
}
}
@ -264,7 +286,16 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
}
// Set edit and save functions.
blockType.edit = props => (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(ThisBlockEdit, _objectSpread({}, props));
blockType.edit = props => {
// Ensure we remove our save lock if a block is removed.
wp.element.useEffect(() => {
return () => {
if (!wp.data.dispatch('core/editor')) return;
wp.data.dispatch('core/editor').unlockPostSaving('acf/block/' + props.clientId);
};
}, []);
return (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(ThisBlockEdit, _objectSpread({}, props));
};
blockType.save = () => (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(ThisBlockSave, null);
// Add to storage.
@ -810,48 +841,62 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
/**
* The BlockBody functional component.
*
* @date 19/2/19
* @since 5.7.12
*/
function _BlockBody(props) {
function BlockBody(props) {
const {
attributes,
isSelected,
name
name,
clientId
} = props;
const {
mode
} = attributes;
const index = useSelect(select => {
const rootClientId = select('core/block-editor').getBlockRootClientId(clientId);
return select('core/block-editor').getBlockIndex(clientId, rootClientId);
});
let showForm = true;
let additionalClasses = 'acf-block-component acf-block-body';
if (mode === 'auto' && !isSelected || mode === 'preview') {
additionalClasses += ' acf-block-preview';
showForm = false;
}
// Setup block cache if required, and update mode.
if (!(clientId in acf.blockInstances)) {
acf.blockInstances[clientId] = {
validation_errors: false,
mode: mode
};
}
acf.blockInstances[clientId].mode = mode;
if (!isSelected) {
if (blockSupportsValidation(name) && acf.blockInstances[clientId].validation_errors) {
additionalClasses += ' acf-block-has-validation-error';
}
acf.blockInstances[clientId].has_been_deselected = true;
}
if (getBlockVersion(name) > 1) {
return (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", _objectSpread({}, useBlockProps({
className: additionalClasses
})), showForm ? (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockForm, _objectSpread({}, props)) : (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockPreview, _objectSpread({}, props)));
})), showForm ? (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockForm, _objectSpread(_objectSpread({}, props), {}, {
index: index
})) : (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockPreview, _objectSpread(_objectSpread({}, props), {}, {
index: index
})));
} else {
return (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", _objectSpread({}, useBlockProps()), (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", {
className: "acf-block-component acf-block-body"
}, showForm ? (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockForm, _objectSpread({}, props)) : (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockPreview, _objectSpread({}, props))));
}, showForm ? (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockForm, _objectSpread(_objectSpread({}, props), {}, {
index: index
})) : (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockPreview, _objectSpread(_objectSpread({}, props), {}, {
index: index
}))));
}
}
// Append blockIndex to component props.
const BlockBody = withSelect((select, ownProps) => {
const {
clientId
} = ownProps;
// Use optional rootClientId to allow discoverability of child blocks.
const rootClientId = select('core/block-editor').getBlockRootClientId(clientId);
const index = select('core/block-editor').getBlockIndex(clientId, rootClientId);
return {
index
};
})(_BlockBody);
/**
* A react component to append HTMl.
*
@ -900,9 +945,6 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
}
}
// Data storage for DynamicHTML components.
const store = {};
/**
* DynamicHTML Class.
*
@ -926,42 +968,65 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
this.el = false;
this.subscribed = true;
this.renderMethod = 'jQuery';
this.passedValidation = false;
this.setup(props);
// Load state.
this.loadState();
}
setup(props) {
// Do nothing.
const constructor = this.constructor.name;
if (!(constructor in acf.blockInstances[props.clientId])) {
acf.blockInstances[props.clientId][constructor] = {};
}
}
fetch() {
// Do nothing.
}
maybePreload(blockId, clientId, form) {
if (this.state.html === undefined && !isBlockInQueryLoop(this.props.clientId)) {
acf.debug('Preload check', blockId, clientId, form);
if (!isBlockInQueryLoop(this.props.clientId)) {
const preloadedBlocks = acf.get('preloadedBlocks');
const modeText = form ? 'form' : 'preview';
if (preloadedBlocks && preloadedBlocks[blockId]) {
// Ensure we only preload the correct block state (form or preview).
if (form && !preloadedBlocks[blockId].form || !form && preloadedBlocks[blockId].form) return false;
if (form && !preloadedBlocks[blockId].form || !form && preloadedBlocks[blockId].form) {
acf.debug('Preload failed: state not preloaded.');
return false;
}
// Set HTML to the preloaded version.
return preloadedBlocks[blockId].html.replaceAll(blockId, clientId);
preloadedBlocks[blockId].html = preloadedBlocks[blockId].html.replaceAll(blockId, clientId);
// Replace blockId in errors.
if (preloadedBlocks[blockId].validation && preloadedBlocks[blockId].validation.errors) {
preloadedBlocks[blockId].validation.errors = preloadedBlocks[blockId].validation.errors.map(error => {
error.input = error.input.replaceAll(blockId, clientId);
return error;
});
}
// Return preloaded object.
acf.debug('Preload successful', preloadedBlocks[blockId]);
return preloadedBlocks[blockId];
}
}
acf.debug('Preload failed: not preloaded.');
return false;
}
loadState() {
this.state = store[this.id] || {};
const client = acf.blockInstances[this.props.clientId] || {};
this.state = client[this.constructor.name] || {};
}
setState(state) {
store[this.id] = _objectSpread(_objectSpread({}, this.state), state);
acf.blockInstances[this.props.clientId][this.constructor.name] = _objectSpread(_objectSpread({}, this.state), state);
// Update component state if subscribed.
// - Allows AJAX callback to update store without modifying state of an unmounted component.
if (this.subscribed) {
super.setState(state);
}
acf.debug('SetState', Object.assign({}, this), this.props.clientId, this.constructor.name, Object.assign({}, acf.blockInstances[this.props.clientId][this.constructor.name]));
}
setHtml(html) {
html = html ? html.trim() : '';
@ -1051,6 +1116,13 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
}
}
// Lock block if required.
if (this.getValidationErrors() && this.isNotNewlyAdded()) {
this.lockBlockForSaving();
} else {
this.unlockBlockForSaving();
}
// Call context specific method.
switch (context) {
case 'append':
@ -1061,6 +1133,9 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
break;
}
}
validate() {
// Do nothing.
}
componentDidMount() {
// Fetch on first load.
if (this.state.html === undefined) {
@ -1102,6 +1177,61 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
acf.doAction('remount', this.state.$el);
});
}
isNotNewlyAdded() {
return acf.blockInstances[this.props.clientId].has_been_deselected || false;
}
hasShownValidation() {
return acf.blockInstances[this.props.clientId].shown_validation || false;
}
setShownValidation() {
acf.blockInstances[this.props.clientId].shown_validation = true;
}
setValidationErrors(errors) {
acf.blockInstances[this.props.clientId].validation_errors = errors;
}
getValidationErrors() {
return acf.blockInstances[this.props.clientId].validation_errors;
}
getMode() {
return acf.blockInstances[this.props.clientId].mode;
}
lockBlockForSaving() {
if (!wp.data.dispatch('core/editor')) return;
wp.data.dispatch('core/editor').lockPostSaving('acf/block/' + this.props.clientId);
}
unlockBlockForSaving() {
if (!wp.data.dispatch('core/editor')) return;
wp.data.dispatch('core/editor').unlockPostSaving('acf/block/' + this.props.clientId);
}
displayValidation($formEl) {
if (!blockSupportsValidation(this.props.name)) {
acf.debug('Block does not support validation');
return;
}
const errors = this.getValidationErrors();
acf.debug('Starting handle validation', Object.assign({}, this), Object.assign({}, $formEl), errors);
this.setShownValidation();
let validator = acf.getBlockFormValidator($formEl);
validator.clearErrors();
acf.doAction('blocks/validation/pre_apply', errors);
if (errors) {
validator.addErrors(errors);
validator.showErrors('after');
this.lockBlockForSaving();
} else {
// remove previous error message
if (validator.has('notice')) {
validator.get('notice').update({
type: 'success',
text: acf.__('Validation successful'),
timeout: 1000
});
validator.set('notice', null);
}
this.unlockBlockForSaving();
}
acf.doAction('blocks/validation/post_apply', errors);
}
}
/**
@ -1116,46 +1246,93 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
* @return void
*/
class BlockForm extends DynamicHTML {
setup({
clientId
}) {
this.id = `BlockForm-${clientId}`;
setup(props) {
this.id = `BlockForm-${props.clientId}`;
super.setup(props);
}
fetch() {
fetch(validate_only = false, data = false) {
// Extract props.
const {
attributes,
context,
clientId
clientId,
name
} = this.props;
let {
attributes
} = this.props;
let query = {
form: true
};
if (validate_only) {
query = {
validate: true
};
attributes.data = data;
}
const hash = createBlockAttributesHash(attributes, context);
acf.debug('BlockForm fetch', attributes, query);
// Try preloaded data first.
const preloaded = this.maybePreload(hash, clientId, true);
if (preloaded) {
this.setHtml(preloaded);
this.setHtml(acf.applyFilters('blocks/form/render', preloaded.html, true));
if (preloaded.validation) this.setValidationErrors(preloaded.validation.errors);
return;
}
if (!blockSupportsValidation(name)) {
query.validate = false;
}
// Request AJAX and update HTML on complete.
fetchBlock({
attributes,
context,
clientId,
query: {
form: true
}
query
}).done(({
data
}) => {
this.setHtml(data.form.replaceAll(data.clientId, clientId));
acf.debug('fetch block form promise');
if (data.form) {
this.setHtml(acf.applyFilters('blocks/form/render', data.form.replaceAll(data.clientId, clientId), false));
}
if (data.validation) this.setValidationErrors(data.validation.errors);
if (this.isNotNewlyAdded()) {
acf.debug("Block has already shown it's invalid. The form needs to show validation errors");
this.validate();
}
});
}
validate(loadState = true) {
if (loadState) {
this.loadState();
}
acf.debug(Object.assign({}, this));
super.displayValidation(this.state.$el);
}
shouldComponentUpdate(nextProps, nextState) {
if (blockSupportsValidation(this.props.name) && this.state.$el && this.isNotNewlyAdded() && !this.hasShownValidation()) {
this.validate(false); // Shouldn't update state in shouldComponentUpdate.
}
return super.shouldComponentUpdate(nextProps, nextState);
}
componentWillUnmount() {
super.componentWillUnmount();
//TODO: either delete this, or clear validations here (if that's a sensible idea)
acf.debug('BlockForm Component did unmount');
}
componentDidRemount() {
super.componentDidRemount();
acf.debug('BlockForm component did remount');
const {
$el
} = this.state;
if (blockSupportsValidation(this.props.name) && this.isNotNewlyAdded()) {
acf.debug("Block has already shown it's invalid. The form needs to show validation errors");
this.validate();
}
// Make sure our on append events are registered.
if ($el.data('acf-events-added') !== true) {
@ -1164,21 +1341,23 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
}
componentDidAppend() {
super.componentDidAppend();
acf.debug('BlockForm component did append');
// Extract props.
const {
attributes,
setAttributes,
clientId
clientId,
name
} = this.props;
const props = this.props;
const thisBlockForm = this;
const {
$el
} = this.state;
// Callback for updating block data.
// Callback for updating block data and validation status if we're in an edit only mode.
function serializeData(silent = false) {
const data = acf.serialize($el, `acf-${clientId}`);
const data = acf.serialize($el, `acf-block_${clientId}`);
if (silent) {
attributes.data = data;
} else {
@ -1186,6 +1365,10 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
data
});
}
if (blockSupportsValidation(name) && !silent && thisBlockForm.getMode() !== 'preview') {
acf.debug('No block preview currently available. Need to trigger a validation only fetch.');
thisBlockForm.fetch(true, data);
}
}
// Add events.
@ -1218,17 +1401,15 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
* @return void
*/
class BlockPreview extends DynamicHTML {
setup({
clientId,
name
}) {
const blockType = getBlockType(name);
setup(props) {
const blockType = getBlockType(props.name);
const contextPostId = acf.isget(this.props, 'context', 'postId');
this.id = `BlockPreview-${clientId}`;
this.id = `BlockPreview-${props.clientId}`;
super.setup(props);
// Apply the contextPostId to the ID if set to stop query loop ID duplication.
if (contextPostId) {
this.id = `BlockPreview-${clientId}-${contextPostId}`;
this.id = `BlockPreview-${props.clientId}-${contextPostId}`;
}
if (blockType.supports.jsx) {
this.renderMethod = 'jsx';
@ -1256,20 +1437,25 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
let preloaded = this.maybePreload(hash, clientId, false);
if (preloaded) {
if (getBlockVersion(name) == 1) {
preloaded = '<div class="acf-block-preview">' + preloaded + '</div>';
preloaded.html = '<div class="acf-block-preview">' + preloaded.html + '</div>';
}
this.setHtml(preloaded);
this.setHtml(acf.applyFilters('blocks/preview/render', preloaded.html, true));
if (preloaded.validation) this.setValidationErrors(preloaded.validation.errors);
return;
}
let query = {
preview: true
};
if (!blockSupportsValidation(name)) {
query.validate = false;
}
// Request AJAX and update HTML on complete.
fetchBlock({
attributes,
context,
clientId,
query: {
preview: true
},
query,
delay
}).done(({
data
@ -1278,9 +1464,24 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
if (getBlockVersion(name) == 1) {
replaceHtml = '<div class="acf-block-preview">' + replaceHtml + '</div>';
}
this.setHtml(replaceHtml);
acf.debug('fetch block render promise');
this.setHtml(acf.applyFilters('blocks/preview/render', replaceHtml, false));
if (data.validation) {
this.setValidationErrors(data.validation.errors);
}
if (this.isNotNewlyAdded()) {
this.validate();
}
});
}
validate() {
// Check we've got a block form for this instance.
const client = acf.blockInstances[this.props.clientId] || {};
const blockFormState = client.BlockForm || false;
if (blockFormState) {
super.displayValidation(blockFormState.$el);
}
}
componentDidAppend() {
super.componentDidAppend();
this.renderBlockPreviewEvent();
@ -1300,6 +1501,7 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
if (nextAttributes.anchor !== thisAttributes.anchor) {
delay = 300;
}
acf.debug('Triggering fetch from block preview shouldComponentUpdate');
this.fetch({
attributes: nextAttributes,
context: nextProps.context,
@ -1337,9 +1539,11 @@ const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
}
componentDidRemount() {
super.componentDidRemount();
acf.debug('Checking if fetch is required in BlockPreview componentDidRemount', Object.assign({}, this.state.prevAttributes), Object.assign({}, this.props.attributes), Object.assign({}, this.state.prevContext), Object.assign({}, this.props.context));
// Update preview if data has changed since last render (changing from "edit" to "preview").
if (!compareObjects(this.state.prevAttributes, this.props.attributes) || !compareObjects(this.state.prevContext, this.props.context)) {
acf.debug('Triggering block preview fetch from componentDidRemount');
this.fetch();
}
@ -2293,7 +2497,7 @@ if (
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = '18.2.0';
var ReactVersion = '18.3.1';
// ATTENTION
// When adding new symbols to this file,
@ -4969,6 +5173,7 @@ exports.PureComponent = PureComponent;
exports.StrictMode = REACT_STRICT_MODE_TYPE;
exports.Suspense = REACT_SUSPENSE_TYPE;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
exports.act = act;
exports.cloneElement = cloneElement$1;
exports.createContext = createContext;
exports.createElement = createElement$1;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -204,6 +204,7 @@
initialize: function () {
// add sortable
var $tbody = this.$el.parent();
$tbody.css('position', 'relative');
if (!$tbody.hasClass('ui-sortable')) {
$tbody.sortable({
items: '> .acf-field-setting-fc_layout',
@ -254,6 +255,7 @@
return $settings.hasClass('open');
},
open: function (element, isAddingLayout) {
const $header = element ? element.children('.acf-field-settings-fc_head') : this.$el.children('.acf-field-settings-fc_head');
const $settings = element ? element.children('.acf-field-layout-settings') : this.$el.children('.acf-field-layout-settings');
const toggle = element ? element.find('.toggle-indicator').first() : this.$el.find('.toggle-indicator').first();
@ -275,8 +277,10 @@
toggle.removeClass('closed');
}
$settings.addClass('open');
$header.addClass('open');
},
close: function () {
const $header = this.$el.children('.acf-field-settings-fc_head');
const $settings = this.$el.children('.acf-field-layout-settings');
const toggle = this.$el.find('.toggle-indicator').first();
@ -284,6 +288,7 @@
$settings.slideUp();
$settings.removeClass('open');
toggle.removeClass('open');
$header.removeClass('open');
if (!toggle.hasClass('closed')) {
toggle.addClass('closed');
}
@ -304,7 +309,7 @@
}
},
onChangeName: function (e, $el) {
const sanitizedName = acf.strSanitize($el.val());
const sanitizedName = acf.strSanitize($el.val(), false);
$el.val(sanitizedName);
this.set('layoutName', sanitizedName);
this.$el.attr('data-layout-name', sanitizedName);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 5C10 3.89543 10.8954 3 12 3C13.1046 3 14 3.89543 14 5C14 6.10457 13.1046 7 12 7C10.8954 7 10 6.10457 10 5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 12C10 10.8954 10.8954 10 12 10C13.1046 10 14 10.8954 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 10 13.1046 10 12Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 19C10 17.8954 10.8954 17 12 17C13.1046 17 14 17.8954 14 19C14 20.1046 13.1046 21 12 21C10.8954 21 10 20.1046 10 19Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17 5C17 3.89543 17.8954 3 19 3C20.1046 3 21 3.89543 21 5C21 6.10457 20.1046 7 19 7C17.8954 7 17 6.10457 17 5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17 12C17 10.8954 17.8954 10 19 10C20.1046 10 21 10.8954 21 12C21 13.1046 20.1046 14 19 14C17.8954 14 17 13.1046 17 12Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17 19C17 17.8954 17.8954 17 19 17C20.1046 17 21 17.8954 21 19C21 20.1046 20.1046 21 19 21C17.8954 21 17 20.1046 17 19Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 5C3 3.89543 3.89543 3 5 3C6.10457 3 7 3.89543 7 5C7 6.10457 6.10457 7 5 7C3.89543 7 3 6.10457 3 5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 12C3 10.8954 3.89543 10 5 10C6.10457 10 7 10.8954 7 12C7 13.1046 6.10457 14 5 14C3.89543 14 3 13.1046 3 12Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 19C3 17.8954 3.89543 17 5 17C6.10457 17 7 17.8954 7 19C7 20.1046 6.10457 21 5 21C3.89543 21 3 20.1046 3 19Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.16671 8.83337V3.83337H8.83337V8.83337H7.16671Z" fill="white"/>
<path d="M7.16671 10.5V12.1667H8.83337V10.5H7.16671Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.2917 8.00004C15.2917 12.0271 12.0271 15.2917 8.00004 15.2917C3.97296 15.2917 0.708374 12.0271 0.708374 8.00004C0.708374 3.97296 3.97296 0.708374 8.00004 0.708374C12.0271 0.708374 15.2917 3.97296 15.2917 8.00004ZM8.00004 14.0417C11.3368 14.0417 14.0417 11.3368 14.0417 8.00004C14.0417 4.66332 11.3368 1.95837 8.00004 1.95837C4.66332 1.95837 1.95837 4.66332 1.95837 8.00004C1.95837 11.3368 4.66332 14.0417 8.00004 14.0417Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 736 B

View File

@ -667,3 +667,45 @@ function acf_maybe_unserialize( $data ) {
function acf_is_pro() {
return defined( 'ACF_PRO' ) && ACF_PRO;
}
/**
* Check if ACF is a beta-like release.
*
* @since 6.3
*
* @return boolean True if the current install version contains a dash, indicating a alpha, beta or RC release.
*/
function acf_is_beta() {
return defined( 'ACF_VERSION' ) && strpos( ACF_VERSION, '-' ) !== false;
}
/**
* Returns the version of ACF when it was first activated.
* However, if ACF was first activated prior to the introduction of the acf_first_activated_version option,
* this function returns false (boolean) to indicate that the version could not be determined.
*
* @since 6.3
*
* @return string|boolean The (string) version of ACF when it was first activated, or false (boolean) if the version could not be determined.
*/
function acf_get_version_when_first_activated() {
// Check if ACF is network-activated on a multisite.
if ( is_multisite() ) {
$acf_dir_and_filename = basename( ACF_PATH ) . '/acf.php';
$plugins = get_site_option( 'active_sitewide_plugins' );
if ( isset( $plugins[ $acf_dir_and_filename ] ) ) {
$main_site_id = get_main_site_id();
if ( empty( $main_site_id ) ) {
return false;
}
// ACF is network activated, so get the version from main site's options.
return get_blog_option( $main_site_id, 'acf_first_activated_version', false );
}
}
// Check if ACF is activated on this single site.
return get_option( 'acf_first_activated_version', false );
}

View File

@ -28,7 +28,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// actions
@ -46,7 +45,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
* @param string $class
* @return n/a
*/
function register_tool( $class ) {
$instance = new $class();
@ -65,7 +63,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
* @param string $name
* @return n/a
*/
function get_tool( $name ) {
return isset( $this->tools[ $name ] ) ? $this->tools[ $name ] : null;
@ -83,7 +80,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
* @param n/a
* @return array
*/
function get_tools() {
return $this->tools;
@ -100,7 +96,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
* @param n/a
* @return n/a
*/
function admin_menu() {
// bail early if no show_admin
@ -127,7 +122,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
* @param n/a
* @return n/a
*/
function load() {
add_action( 'admin_body_class', array( $this, 'admin_body_class' ) );
@ -169,7 +163,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
* @param n/a
* @return n/a
*/
function include_tools() {
// include
@ -193,7 +186,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
* @param n/a
* @return n/a
*/
function check_submit() {
// loop
@ -221,7 +213,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
* @param n/a
* @return n/a
*/
function html() {
// vars

View File

@ -19,7 +19,8 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
add_action( 'admin_body_class', array( $this, 'admin_body_class' ) );
add_action( 'current_screen', array( $this, 'current_screen' ) );
add_action( 'admin_notices', array( $this, 'maybe_show_escaped_html_notice' ) );
add_action( 'wp_ajax_acf/dismiss_escaped_html_notice', array( $this, 'dismiss_escaped_html_notice' ) );
add_action( 'admin_init', array( $this, 'dismiss_escaped_html_notice' ) );
add_action( 'admin_init', array( $this, 'clear_escaped_html_log' ) );
add_filter( 'parent_file', array( $this, 'ensure_menu_selection' ) );
add_filter( 'submenu_file', array( $this, 'ensure_submenu_selection' ) );
}
@ -58,7 +59,6 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
'acf-escaped-html-notice',
'acf_escaped_html_notice',
array(
'nonce' => wp_create_nonce( 'acf/dismiss_escaped_html_notice' ),
'show_details' => __( 'Show&nbsp;details', 'acf' ),
'hide_details' => __( 'Hide&nbsp;details', 'acf' ),
)
@ -220,6 +220,10 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
return;
}
if ( get_option( 'acf_escaped_html_notice_dismissed' ) ) {
return;
}
$escaped = _acf_get_escaped_html_log();
// Notice for when HTML has already been escaped.
@ -229,18 +233,55 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
}
/**
* Dismisses the escaped unsafe HTML notice by clearing the stored log.
* Dismisses the escaped unsafe HTML notice.
*
* @since 6.2.5
*/
public function dismiss_escaped_html_notice() {
if ( empty( $_GET['acf-dismiss-esc-html-notice'] ) ) {
return;
}
$nonce = sanitize_text_field( wp_unslash( $_GET['acf-dismiss-esc-html-notice'] ) );
if (
! check_admin_referer( 'acf/dismiss_escaped_html_notice', 'nonce' ) ||
! current_user_can( acf_get_setting( 'capability' ) ) ) {
! wp_verify_nonce( $nonce, 'acf/dismiss_escaped_html_notice' ) ||
! current_user_can( acf_get_setting( 'capability' ) )
) {
return;
}
update_option( 'acf_escaped_html_notice_dismissed', true );
_acf_delete_escaped_html_log();
wp_safe_redirect( remove_query_arg( 'acf-dismiss-esc-html-notice' ) );
exit;
}
/**
* Clear the escaped unsafe HTML log.
*
* @since 6.2.5
*/
public function clear_escaped_html_log() {
if ( empty( $_GET['acf-clear-esc-html-log'] ) ) {
return;
}
$nonce = sanitize_text_field( wp_unslash( $_GET['acf-clear-esc-html-log'] ) );
if (
! wp_verify_nonce( $nonce, 'acf/clear_escaped_html_log' ) ||
! current_user_can( acf_get_setting( 'capability' ) )
) {
return;
}
_acf_delete_escaped_html_log();
wp_safe_redirect( remove_query_arg( 'acf-clear-esc-html-log' ) );
exit;
}
/**

View File

@ -111,6 +111,36 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
'Value is less than' => esc_html__( 'Value is less than', 'acf' ),
'Selection is greater than' => esc_html__( 'Selection is greater than', 'acf' ),
'Selection is less than' => esc_html__( 'Selection is less than', 'acf' ),
'Relationship is equal to' => esc_html__( 'Relationship is equal to', 'acf' ),
'Relationship is not equal to' => esc_html__( 'Relationship is not equal to', 'acf' ),
'Relationships contain' => esc_html__( 'Relationships contain', 'acf' ),
'Relationships do not contain' => esc_html__( 'Relationships do not contain', 'acf' ),
'Post is equal to' => esc_html__( 'Post is equal to', 'acf' ),
'Post is not equal to' => esc_html__( 'Post is not equal to', 'acf' ),
'Posts contain' => esc_html__( 'Posts contain', 'acf' ),
'Posts do not contain' => esc_html__( 'Posts do not contain', 'acf' ),
'Has any post selected' => esc_html__( 'Has any post selected', 'acf' ),
'Has no post selected' => esc_html__( 'Has no post selected', 'acf' ),
'Has any relationship selected' => esc_html__( 'Has any relationship selected', 'acf' ),
'Has no relationship selected' => esc_html__( 'Has no relationship selected', 'acf' ),
'Page is equal to' => esc_html__( 'Page is equal to', 'acf' ),
'Page is not equal to' => esc_html__( 'Page is not equal to', 'acf' ),
'Pages contain' => esc_html__( 'Pages contain', 'acf' ),
'Pages do not contain' => esc_html__( 'Pages do not contain', 'acf' ),
'Has any page selected' => esc_html__( 'Has any page selected', 'acf' ),
'Has no page selected' => esc_html__( 'Has no page selected', 'acf' ),
'User is equal to' => esc_html__( 'User is equal to', 'acf' ),
'User is not equal to' => esc_html__( 'User is not equal to', 'acf' ),
'Users contain' => esc_html__( 'Users contain', 'acf' ),
'Users do not contain' => esc_html__( 'Users do not contain', 'acf' ),
'Has any user selected' => esc_html__( 'Has any user selected', 'acf' ),
'Has no user selected' => esc_html__( 'Has no user selected', 'acf' ),
'Term is equal to' => esc_html__( 'Term is equal to', 'acf' ),
'Term is not equal to' => esc_html__( 'Term is not equal to', 'acf' ),
'Terms contain' => esc_html__( 'Terms contain', 'acf' ),
'Terms do not contain' => esc_html__( 'Terms do not contain', 'acf' ),
'Has any term selected' => esc_html__( 'Has any term selected', 'acf' ),
'Has no term selected' => esc_html__( 'Has no term selected', 'acf' ),
// Custom Select2 templates.
'Type to search...' => esc_html__( 'Type to search...', 'acf' ),

View File

@ -121,7 +121,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
// Description.
case 'acf-description':
if ( is_string( $post['description'] ) && ! empty( $post['description'] ) ) {
if ( ( is_string( $post['description'] ) || is_numeric( $post['description'] ) ) && ! empty( $post['description'] ) ) {
echo '<span class="acf-description">' . acf_esc_html( $post['description'] ) . '</span>';
} else {
echo '<span class="acf-emdash" aria-hidden="true">—</span>';

View File

@ -140,7 +140,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
// Description.
case 'acf-description':
if ( is_string( $post['description'] ) && ! empty( $post['description'] ) ) {
if ( ( is_string( $post['description'] ) || is_numeric( $post['description'] ) ) && ! empty( $post['description'] ) ) {
echo '<span class="acf-description">' . acf_esc_html( $post['description'] ) . '</span>';
} else {
echo '<span class="acf-emdash" aria-hidden="true">—</span>';

View File

@ -139,7 +139,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
// Description.
case 'acf-description':
if ( is_string( $post['description'] ) && ! empty( $post['description'] ) ) {
if ( ( is_string( $post['description'] ) || is_numeric( $post['description'] ) ) && ! empty( $post['description'] ) ) {
echo '<span class="acf-description">' . acf_esc_html( $post['description'] ) . '</span>';
} else {
echo '<span class="acf-emdash" aria-hidden="true">—</span>';

View File

@ -19,7 +19,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -40,7 +39,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
* @param n/a
* @return n/a
*/
function html() {
?>

View File

@ -36,7 +36,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
* @param n/a
* @return n/a
*/
function get_name() {
return $this->name;
}
@ -53,7 +52,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
* @param n/a
* @return n/a
*/
function get_title() {
return $this->title;
}
@ -70,7 +68,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
* @param n/a
* @return n/a
*/
function get_url() {
return acf_get_admin_tool_url( $this->name );
}
@ -87,7 +84,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
* @param n/a
* @return boolean
*/
function is_active() {
return acf_maybe_get_GET( 'tool' ) === $this->name;
}
@ -103,7 +99,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// initialize
@ -122,7 +117,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
/* do nothing */
@ -141,7 +135,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
* @param n/a
* @return n/a
*/
function load() {
/* do nothing */
@ -159,7 +152,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
* @param n/a
* @return n/a
*/
function html() {
}
@ -175,7 +167,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
* @param n/a
* @return n/a
*/
function submit() {
}
}

View File

@ -139,8 +139,19 @@ if ( empty( $field['conditional_logic'] ) ) {
</td>
<td class="value">
<?php
$conditional_field = get_field_object( $rule['field'] );
/**
* Filters the choices available for a conditional logic rule.
*
* @since 6.3.0
*
* @param array $choices The available choices.
* @param array $conditional_field The field object for the conditional field.
* @param mixed $value The value of the rule.
*/
$choices = apply_filters( 'acf/conditional_logic/choices', array( $rule['value'] => $rule['value'] ), $conditional_field, $rule['value'] );
// create field
acf_render_field(
array(
'type' => 'select',
@ -149,12 +160,9 @@ if ( empty( $field['conditional_logic'] ) ) {
'class' => 'condition-rule-value',
'disabled' => $disabled,
'value' => $rule['value'],
'choices' => array(
$rule['value'] => $rule['value'],
),
'choices' => $choices,
)
);
?>
</td>
<td class="add">

View File

@ -217,7 +217,7 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
$field,
array(
'label' => __( 'Instructions', 'acf' ),
'instructions' => __( 'Instructions for authors. Shown when submitting data', 'acf' ),
'instructions' => __( 'Instructions for content editors. Shown when submitting data.', 'acf' ),
'type' => 'textarea',
'name' => 'instructions',
'rows' => 5,

View File

@ -747,15 +747,6 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
)
);
$acf_dashicon_class_name = __( 'Dashicon class name', 'acf' );
$acf_dashicon_link = '<a href="https://developer.wordpress.org/resource/dashicons/" target="_blank">' . $acf_dashicon_class_name . '</a>';
$acf_menu_icon_instructions = sprintf(
/* translators: %s = "dashicon class name", link to the WordPress dashicon documentation. */
__( 'The icon used for the post type menu item in the admin dashboard. Can be a URL or %s to use for the icon.', 'acf' ),
$acf_dashicon_link
);
acf_render_field_wrap(
array(
'type' => 'text',
@ -795,20 +786,52 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
'field'
);
// Set the default value for the icon field.
$acf_default_icon_value = array(
'type' => 'dashicons',
'value' => 'dashicons-admin-post',
);
if ( empty( $acf_post_type['menu_icon'] ) ) {
$acf_post_type['menu_icon'] = $acf_default_icon_value;
}
// Backwards compatibility for before the icon picker was introduced.
if ( is_string( $acf_post_type['menu_icon'] ) ) {
// If the old value was a string that starts with dashicons-, assume it's a dashicon.
if ( false !== strpos( $acf_post_type['menu_icon'], 'dashicons-' ) ) {
$acf_post_type['menu_icon'] = array(
'type' => 'dashicons',
'value' => $acf_post_type['menu_icon'],
);
} else {
$acf_post_type['menu_icon'] = array(
'type' => 'url',
'value' => $acf_post_type['menu_icon'],
);
}
}
acf_render_field_wrap(
array(
'type' => 'text',
'name' => 'menu_icon',
'key' => 'menu_icon',
'prefix' => 'acf_post_type',
'value' => $acf_post_type['menu_icon'],
'label' => __( 'Menu Icon', 'acf' ),
'placeholder' => 'dashicons-admin-post',
'instructions' => $acf_menu_icon_instructions,
'conditions' => array(
'field' => 'show_in_menu',
'operator' => '==',
'value' => 1,
'type' => 'icon_picker',
'name' => 'menu_icon',
'key' => 'menu_icon',
'prefix' => 'acf_post_type',
'value' => $acf_post_type['menu_icon'],
'label' => __( 'Menu Icon', 'acf' ),
'placeholder' => 'dashicons-admin-post',
'conditions' => array(
array(
'field' => 'show_in_menu',
'operator' => '==',
'value' => '1',
),
array(
'field' => 'admin_menu_parent',
'operator' => '==',
'value' => '',
),
),
),
'div',

View File

@ -2,44 +2,67 @@
$acf_plugin_name = acf_is_pro() ? 'ACF PRO' : 'ACF';
$acf_plugin_name = '<strong>' . $acf_plugin_name . ' &mdash;</strong>';
$acf_learn_how_to_fix = '<a href="' . acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/escaping-the-field/', 'docs', '6-2-5-security-changes' ) . '" target="_blank">' . __( 'Learn how to fix this', 'acf' ) . '</a>';
$acf_learn_how_to_fix = '<a href="' . acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/escaping-the-field/', 'docs', '6-2-5-security-changes' ) . '" target="_blank">' . __( 'Learn&nbsp;more', 'acf' ) . '</a>';
$acf_class = 'notice-error';
$acf_user_can_acf = false;
if ( current_user_can( acf_get_setting( 'capability' ) ) ) {
$acf_user_can_acf = true;
$acf_show_details = ' <a class="acf-show-more-details" href="#">' . __( 'Show&nbsp;details', 'acf' ) . '</a>';
$acf_class .= ' is-dismissible';
$acf_dismiss_url = add_query_arg( array( 'acf-dismiss-esc-html-notice' => wp_create_nonce( 'acf/dismiss_escaped_html_notice' ) ) );
// "Show/Hide Details" is a button for accessibility purposes, because it isn't a link. But since the design shows a link, we need to make it look like a link.
$acf_style_button_as_link = trim(
'display: inline;
padding: 0;
background: none;
border: none;
color: #0073aa;
text-decoration: underline;
cursor: pointer;'
);
$acf_show_details = '<button style="' . esc_attr( $acf_style_button_as_link ) . '" class="acf-show-more-details">' . __( 'Show&nbsp;details', 'acf' ) . '</button>';
$acf_show_details .= ' | <a class="acf-dismiss-permanently-button" href="' . esc_url( $acf_dismiss_url ) . '">' . __( 'Dismiss permanently', 'acf' ) . '</a>';
} else {
$acf_show_details = __( 'Please contact your site administrator or developer for more details.', 'acf' );
}
$acf_error_msg = sprintf(
/* translators: %1$s - name of the ACF plugin. %2$s - Link to documentation. %3$s - Link to show more details about the error */
__( '%1$s ACF now automatically escapes unsafe HTML when rendered by <code>the_field</code> or the ACF shortcode. We\'ve detected the output of some of your fields has been modified by this change, but this may not be a breaking change. %2$s. %3$s.', 'acf' ),
__( '%1$s ACF now automatically escapes unsafe HTML when rendered by <code>the_field</code> or the ACF shortcode. We\'ve detected the output of some of your fields has been modified by this change, but this may not be a breaking change. %2$s.', 'acf' ),
$acf_plugin_name,
$acf_learn_how_to_fix,
$acf_show_details
$acf_learn_how_to_fix
);
?>
<div class="acf-admin-notice notice acf-escaped-html-notice <?php echo esc_attr( $acf_class ); ?>">
<p><?php echo acf_esc_html( $acf_error_msg ); ?></p>
<p style="margin-bottom: 0.5em; padding-bottom: 2px;"><?php echo acf_esc_html( $acf_error_msg ); ?></p>
<p style="margin: 0.5em 0; padding: 2px;"><?php echo acf_esc_html( $acf_show_details ); ?></p>
<?php if ( $acf_user_can_acf && ! empty( $acf_escaped ) ) : ?>
<ul class="acf-error-details" style="display: none; list-style: disc; margin-left: 14px;">
<?php
foreach ( $acf_escaped as $acf_field_key => $acf_data ) {
$acf_error = sprintf(
/* translators: %1$s - The selector used %2$s The field name 3%$s The parent function name */
__( '%1$s (%2$s) - rendered via %3$s', 'acf' ),
$acf_data['selector'],
$acf_data['field'],
$acf_data['function']
);
<div class="acf-error-details" style="display: none; list-style: disc; margin-left: 14px;">
<ul class="acf-error-details" style="display: none; list-style: disc; margin-left: 14px;">
<?php
foreach ( $acf_escaped as $acf_field_key => $acf_data ) {
$acf_error = sprintf(
/* translators: %1$s - The selector used %2$s The field name 3%$s The parent function name */
__( '%1$s (%2$s) - rendered via %3$s', 'acf' ),
$acf_data['selector'],
$acf_data['field'],
$acf_data['function']
);
echo '<li>' . esc_html( $acf_error ) . '</li>';
}
echo '<li>' . esc_html( $acf_error ) . '</li>';
}
?>
</ul>
<p style="margin: 0.5em 0; padding: 2px;">
<?php
$acf_clear_logs_url = add_query_arg( array( 'acf-clear-esc-html-log' => wp_create_nonce( 'acf/clear_escaped_html_log' ) ) );
// translators: %s - The clear log button opening HTML tag. %s - The closing HTML tag.
echo acf_esc_html( '<i>' . sprintf( __( 'This data is logged as we detect values that have been changed during output. %1$sClear log and dismiss%2$s after escaping the values in your code. The notice will reappear if we detect changed values again.', 'acf' ), '<a class="acf-clear-log-button" href="' . esc_url( $acf_clear_logs_url ) . '">', '</a>' ) . '</i>' );
?>
</ul>
</p>
</div>
<?php endif; ?>
</div>

View File

@ -141,13 +141,14 @@ if ( ! class_exists( 'ACF_Ajax_Query_Users' ) ) :
// Determine if more results exist.
// As this query does not return grouped results, the calculation can be exact (">").
$this->more = ( $total_users > count( $users ) + $args['offset'] );
// Otherwise, group results via role.
} else {
// Unset args that will interfer with query results.
unset( $args['role__in'], $args['role__not_in'] );
$args['search'] = $this->search ? $this->search : '';
// Loop over each role.
foreach ( $roles as $role => $role_label ) {

View File

@ -93,6 +93,12 @@ if ( ! class_exists( 'ACF_Ajax_Query' ) ) :
$this->search = sanitize_text_field( $request['search'] );
$this->is_search = true;
}
if ( isset( $request['s'] ) && acf_not_empty( $request['s'] ) ) {
$this->search = sanitize_text_field( $request['s'] );
$this->is_search = true;
}
if ( isset( $request['post_id'] ) ) {
$this->post_id = $request['post_id'];
}
@ -115,18 +121,19 @@ if ( ! class_exists( 'ACF_Ajax_Query' ) ) :
if ( isset( $request['query'] ) ) {
return (array) $request['query'];
}
return array();
}
/**
* get_items
* get_results
*
* Returns an array of results for the given args.
*
* @date 31/7/18
* @since 5.7.2
*
* @param array args The query args.
* @param array $args The query args.
* @return array
*/
function get_results( $args ) {
@ -134,7 +141,7 @@ if ( ! class_exists( 'ACF_Ajax_Query' ) ) :
}
/**
* get_item
* get_result
*
* Returns a single result for the given item object.
*

View File

@ -1153,7 +1153,7 @@ function acf_get_posts( $args = array() ) {
$args['post_status'] = acf_get_post_stati();
}
// Check if specifc post ID's have been provided.
// Check if specific post IDs have been provided.
if ( $args['post__in'] ) {
// Clean value into an array of IDs.

View File

@ -142,6 +142,11 @@ function _acf_log_escaped_html( $function, $selector, $field, $post_id ) {
return;
}
// If the notice has been dismissed, don't log further errors.
if ( get_option( 'acf_escaped_html_notice_dismissed' ) ) {
return;
}
// If the field isn't set, we've output a non-ACF field, so don't log anything.
if ( ! is_array( $field ) ) {
return;
@ -191,7 +196,7 @@ function _acf_get_escaped_html_log() {
* @return boolean True on success, or false on failure.
*/
function _acf_update_escaped_html_log( $escaped = array() ) {
return update_option( 'acf_escaped_html_log', (array) $escaped, true );
return update_option( 'acf_escaped_html_log', (array) $escaped, false );
}
/**

View File

@ -112,7 +112,7 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
// Register scripts.
wp_register_script( 'acf', acf_get_url( 'assets/build/js/acf' . $suffix . '.js' ), array( 'jquery' ), $version );
wp_register_script( 'acf-input', acf_get_url( 'assets/build/js/acf-input' . $suffix . '.js' ), array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-resizable', 'acf' ), $version );
wp_register_script( 'acf-input', acf_get_url( 'assets/build/js/acf-input' . $suffix . '.js' ), array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-resizable', 'acf', 'wp-a11y' ), $version );
wp_register_script( 'acf-field-group', acf_get_url( 'assets/build/js/acf-field-group' . $suffix . '.js' ), array( 'acf-input' ), $version );
wp_register_script( 'acf-internal-post-type', acf_get_url( 'assets/build/js/acf-internal-post-type' . $suffix . '.js' ), array( 'acf-input' ), $version );
wp_register_script( 'acf-escaped-html-notice', acf_get_url( 'assets/build/js/acf-escaped-html-notice' . $suffix . '.js' ), array( 'jquery' ), $version, true );
@ -369,6 +369,9 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
'1 field requires attention' => __( '1 field requires attention', 'acf' ),
'%d fields require attention' => __( '%d fields require attention', 'acf' ),
// Block Validation
'An ACF Block on this page requires attention before you can save.' => __( 'An ACF Block on this page requires attention before you can save.', 'acf' ),
// Other
'Edit field group' => __( 'Edit field group', 'acf' ),
)
@ -472,6 +475,7 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
'validation' => acf_get_form_data( 'validation' ),
'editor' => acf_is_block_editor() ? 'block' : 'classic',
'is_pro' => acf_is_pro(),
'debug' => acf_is_beta() || defined( SCRIPT_DEBUG ) && SCRIPT_DEBUG,
);
acf_localize_data( $data_to_localize );

View File

@ -0,0 +1,704 @@
<?php
/**
* Adds helpful debugging information to a new "Advanced Custom Fields"
* panel in the WordPress Site Health screen.
*
* @package ACF
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
if ( ! class_exists( 'ACF_Site_Health' ) ) {
/**
* The ACF Site Health class responsible for populating ACF debug information in WordPress Site Health.
*/
class ACF_Site_Health {
/**
* The option name used to store site health data.
*
* @var string
*/
public string $option_name = 'acf_site_health';
/**
* Constructs the ACF_Site_Health class.
*
* @since 6.3
*/
public function __construct() {
add_action( 'debug_information', array( $this, 'render_tab_content' ) );
add_action( 'acf_update_site_health_data', array( $this, 'update_site_health_data' ) );
if ( ! wp_next_scheduled( 'acf_update_site_health_data' ) ) {
wp_schedule_event( time(), 'weekly', 'acf_update_site_health_data' );
}
// ACF events.
add_action( 'acf/first_activated', array( $this, 'add_activation_event' ) );
add_action( 'acf/activated_pro', array( $this, 'add_activation_event' ) );
add_filter( 'acf/pre_update_field_group', array( $this, 'pre_update_acf_internal_cpt' ) );
add_filter( 'acf/pre_update_post_type', array( $this, 'pre_update_acf_internal_cpt' ) );
add_filter( 'acf/pre_update_taxonomy', array( $this, 'pre_update_acf_internal_cpt' ) );
add_filter( 'acf/pre_update_ui_options_page', array( $this, 'pre_update_acf_internal_cpt' ) );
}
/**
* Gets the stored site health information.
*
* @since 6.3
*
* @return array
*/
public function get_site_health(): array {
$site_health = get_option( $this->option_name, '' );
if ( is_string( $site_health ) ) {
$site_health = json_decode( $site_health, true );
}
return is_array( $site_health ) ? $site_health : array();
}
/**
* Updates the site health information.
*
* @since 6.3
*
* @param array $data An array of site health information to update.
* @return boolean
*/
public function update_site_health( array $data = array() ): bool {
return update_option( $this->option_name, wp_json_encode( $data ), false );
}
/**
* Stores debug data in the ACF site health option.
*
* @since 6.3
*
* @param array $data Data to update with (optional).
* @return boolean
*/
public function update_site_health_data( array $data = array() ): bool {
if ( wp_doing_cron() ) {
// Bootstrap wp-admin, as WP_Cron doesn't do this for us.
require_once trailingslashit( ABSPATH ) . 'wp-admin/includes/admin.php';
}
$site_health = $this->get_site_health();
$values = ! empty( $data ) ? $data : $this->get_site_health_values();
$updated = array();
if ( ! empty( $values ) ) {
foreach ( $values as $key => $value ) {
$updated[ $key ] = $value['debug'] ?? $value['value'];
}
}
foreach ( $site_health as $key => $value ) {
if ( 'event_' === substr( $key, 0, 6 ) ) {
$updated[ $key ] = $value;
}
}
$updated['last_updated'] = time();
return $this->update_site_health( $updated );
}
/**
* Pushes an event to the ACF site health option.
*
* @since 6.3
*
* @param string $event_name The name of the event to push.
* @return boolean
*/
public function add_site_health_event( string $event_name = '' ): bool {
$site_health = $this->get_site_health();
// Allow using action/filter hooks to set events.
if ( empty( $event_name ) ) {
$current_filter = current_filter();
if ( strpos( $current_filter, 'acf/' ) !== false ) {
$event_name = str_replace( 'acf/', '', $current_filter );
}
}
// Bail if this event was already stored.
if ( empty( $event_name ) || ! empty( $site_health[ 'event_' . $event_name ] ) ) {
return false;
}
$time = time();
$site_health[ 'event_' . $event_name ] = $time;
$site_health['last_updated'] = $time;
return $this->update_site_health( $site_health );
}
/**
* Logs activation events for free/pro.
*
* @since 6.3
*
* @return boolean
*/
public function add_activation_event() {
$event_name = 'first_activated';
if ( acf_is_pro() ) {
$event_name = 'first_activated_pro';
if ( 'acf/first_activated' !== current_filter() ) {
$site_health = $this->get_site_health();
/**
* We already have an event for when pro was first activated,
* so we don't need to log an additional event here.
*/
if ( ! empty( $site_health[ 'event_' . $event_name ] ) ) {
return false;
}
$event_name = 'activated_pro';
}
}
return $this->add_site_health_event( $event_name );
}
/**
* Adds events when ACF internal post types are created.
*
* @since 6.3
*
* @param array $post The post about to be updated.
* @return array
*/
public function pre_update_acf_internal_cpt( array $post = array() ): array {
if ( empty( $post['key'] ) ) {
return $post;
}
$post_type = acf_determine_internal_post_type( $post['key'] );
if ( $post_type ) {
$posts = acf_get_internal_post_type_posts( $post_type );
if ( empty( $posts ) ) {
$post_type = str_replace(
array(
'acf-',
'-',
),
array(
'',
'_',
),
$post_type
);
$this->add_site_health_event( 'first_created_' . $post_type );
}
}
return $post;
}
/**
* Appends the ACF section to the "Info" tab of the WordPress Site Health screen.
*
* @since 6.3
*
* @param array $debug_info The current debug info for site health.
* @return array The debug info appended with the ACF section.
*/
public function render_tab_content( array $debug_info ): array {
$data = $this->get_site_health_values();
$this->update_site_health_data( $data );
// Unset values we don't want to display yet.
$fields_to_unset = array(
'wp_version',
'mysql_version',
'is_multisite',
'active_theme',
'parent_theme',
'active_plugins',
'number_of_fields_by_type',
'number_of_third_party_fields_by_type',
);
foreach ( $fields_to_unset as $field ) {
if ( isset( $data[ $field ] ) ) {
unset( $data[ $field ] );
}
}
foreach ( $data as $key => $value ) {
if ( 'event_' === substr( $key, 0, 6 ) ) {
unset( $data[ $key ] );
}
}
$debug_info['acf'] = array(
'label' => __( 'ACF', 'acf' ),
'description' => __( 'This section contains debug information about your ACF configuration which can be useful to provide to support.', 'acf' ),
'fields' => $data,
);
return $debug_info;
}
/**
* Gets the values for all data in the ACF site health section.
*
* @since 6.3
*
* @return array
*/
public function get_site_health_values(): array {
global $wpdb;
$fields = array();
$is_pro = acf_is_pro();
$license = $is_pro ? acf_pro_get_license() : array();
$license_status = $is_pro ? acf_pro_get_license_status() : array();
$field_groups = acf_get_field_groups();
$post_types = acf_get_post_types();
$taxonomies = acf_get_taxonomies();
$yes = __( 'Yes', 'acf' );
$no = __( 'No', 'acf' );
$fields['version'] = array(
'label' => __( 'Plugin Version', 'acf' ),
'value' => defined( 'ACF_VERSION' ) ? ACF_VERSION : '',
);
$fields['plugin_type'] = array(
'label' => __( 'Plugin Type', 'acf' ),
'value' => $is_pro ? __( 'PRO', 'acf' ) : __( 'Free', 'acf' ),
'debug' => $is_pro ? 'PRO' : 'Free',
);
if ( $is_pro ) {
$fields['activated'] = array(
'label' => __( 'License Activated', 'acf' ),
'value' => ! empty( $license ) ? $yes : $no,
'debug' => ! empty( $license ),
);
$fields['activated_url'] = array(
'label' => __( 'Licensed URL', 'acf' ),
'value' => ! empty( $license['url'] ) ? $license['url'] : '',
);
$fields['license_type'] = array(
'label' => __( 'License Type', 'acf' ),
'value' => $license_status['name'],
);
$fields['license_status'] = array(
'label' => __( 'License Status', 'acf' ),
'value' => $license_status['status'],
);
$expiry = ! empty( $license_status['expiry'] ) ? $license_status['expiry'] : '';
$format = get_option( 'date_format', 'F j, Y' );
$fields['subscription_expires'] = array(
'label' => __( 'Subscription Expiry Date', 'acf' ),
'value' => is_numeric( $expiry ) ? date_i18n( $format, $expiry ) : '',
'debug' => $expiry,
);
}
$fields['wp_version'] = array(
'label' => __( 'WordPress Version', 'acf' ),
'value' => get_bloginfo( 'version' ),
);
$fields['mysql_version'] = array(
'label' => __( 'MySQL Version', 'acf' ),
'value' => $wpdb->db_server_info(),
);
$fields['is_multisite'] = array(
'label' => __( 'Is Multisite', 'acf' ),
'value' => is_multisite() ? __( 'Yes', 'acf' ) : __( 'No', 'acf' ),
'debug' => is_multisite(),
);
$active_theme = wp_get_theme();
$parent_theme = $active_theme->parent();
$fields['active_theme'] = array(
'label' => __( 'Active Theme', 'acf' ),
'value' => array(
'name' => $active_theme->get( 'Name' ),
'version' => $active_theme->get( 'Version' ),
'theme_uri' => $active_theme->get( 'ThemeURI' ),
'stylesheet' => $active_theme->get( 'Stylesheet' ),
),
);
if ( $parent_theme ) {
$fields['parent_theme'] = array(
'label' => __( 'Parent Theme', 'acf' ),
'value' => array(
'name' => $parent_theme->get( 'Name' ),
'version' => $parent_theme->get( 'Version' ),
'theme_uri' => $parent_theme->get( 'ThemeURI' ),
'stylesheet' => $parent_theme->get( 'Stylesheet' ),
),
);
}
$active_plugins = array();
$plugins = get_plugins();
foreach ( $plugins as $plugin_path => $plugin ) {
if ( ! is_plugin_active( $plugin_path ) ) {
continue;
}
$active_plugins[ $plugin_path ] = array(
'name' => $plugin['Name'],
'version' => $plugin['Version'],
'plugin_uri' => empty( $plugin['PluginURI'] ) ? '' : $plugin['PluginURI'],
);
}
$fields['active_plugins'] = array(
'label' => __( 'Active Plugins', 'acf' ),
'value' => $active_plugins,
);
$ui_field_groups = array_filter(
$field_groups,
function ( $field_group ) {
return empty( $field_group['local'] );
}
);
$fields['ui_field_groups'] = array(
'label' => __( 'Registered Field Groups (UI)', 'acf' ),
'value' => number_format_i18n( count( $ui_field_groups ) ),
);
$php_field_groups = array_filter(
$field_groups,
function ( $field_group ) {
return ! empty( $field_group['local'] ) && 'PHP' === $field_group['local'];
}
);
$fields['php_field_groups'] = array(
'label' => __( 'Registered Field Groups (PHP)', 'acf' ),
'value' => number_format_i18n( count( $php_field_groups ) ),
);
$json_field_groups = array_filter(
$field_groups,
function ( $field_group ) {
return ! empty( $field_group['local'] ) && 'json' === $field_group['local'];
}
);
$fields['json_field_groups'] = array(
'label' => __( 'Registered Field Groups (JSON)', 'acf' ),
'value' => number_format_i18n( count( $json_field_groups ) ),
);
$rest_field_groups = array_filter(
$field_groups,
function ( $field_group ) {
return ! empty( $field_group['show_in_rest'] );
}
);
$fields['rest_field_groups'] = array(
'label' => __( 'Field Groups Enabled for REST API', 'acf' ),
'value' => number_format_i18n( count( $rest_field_groups ) ),
);
$graphql_field_groups = array_filter(
$field_groups,
function ( $field_group ) {
return ! empty( $field_group['show_in_graphql'] );
}
);
if ( is_plugin_active( 'wpgraphql-acf/wpgraphql-acf.php' ) ) {
$fields['graphql_field_groups'] = array(
'label' => __( 'Field Groups Enabled for GraphQL', 'acf' ),
'value' => number_format_i18n( count( $graphql_field_groups ) ),
);
}
$all_fields = array();
foreach ( $field_groups as $field_group ) {
$all_fields = array_merge( $all_fields, acf_get_fields( $field_group ) );
}
$fields_by_type = array();
$third_party_fields_by_type = array();
$core_field_types = array_keys( acf_get_field_types() );
foreach ( $all_fields as $field ) {
if ( in_array( $field['type'], $core_field_types, true ) ) {
if ( ! isset( $fields_by_type[ $field['type'] ] ) ) {
$fields_by_type[ $field['type'] ] = 0;
}
++$fields_by_type[ $field['type'] ];
continue;
}
if ( ! isset( $third_party_fields_by_type[ $field['type'] ] ) ) {
$third_party_fields_by_type[ $field['type'] ] = 0;
}
++$third_party_fields_by_type[ $field['type'] ];
}
$fields['number_of_fields_by_type'] = array(
'label' => __( 'Number of Fields by Field Type', 'acf' ),
'value' => $fields_by_type,
);
$fields['number_of_third_party_fields_by_type'] = array(
'label' => __( 'Number of Third Party Fields by Field Type', 'acf' ),
'value' => $third_party_fields_by_type,
);
$enable_post_types = acf_get_setting( 'enable_post_types' );
$fields['post_types_enabled'] = array(
'label' => __( 'Post Types and Taxonomies Enabled', 'acf' ),
'value' => $enable_post_types ? $yes : $no,
'debug' => $enable_post_types,
);
$ui_post_types = array_filter(
$post_types,
function ( $post_type ) {
return empty( $post_type['local'] );
}
);
$fields['ui_post_types'] = array(
'label' => __( 'Registered Post Types (UI)', 'acf' ),
'value' => number_format_i18n( count( $ui_post_types ) ),
);
$json_post_types = array_filter(
$post_types,
function ( $post_type ) {
return ! empty( $post_type['local'] ) && 'json' === $post_type['local'];
}
);
$fields['json_post_types'] = array(
'label' => __( 'Registered Post Types (JSON)', 'acf' ),
'value' => number_format_i18n( count( $json_post_types ) ),
);
$ui_taxonomies = array_filter(
$taxonomies,
function ( $taxonomy ) {
return empty( $taxonomy['local'] );
}
);
$fields['ui_taxonomies'] = array(
'label' => __( 'Registered Taxonomies (UI)', 'acf' ),
'value' => number_format_i18n( count( $ui_taxonomies ) ),
);
$json_taxonomies = array_filter(
$taxonomies,
function ( $taxonomy ) {
return ! empty( $taxonomy['local'] ) && 'json' === $taxonomy['local'];
}
);
$fields['json_taxonomies'] = array(
'label' => __( 'Registered Taxonomies (JSON)', 'acf' ),
'value' => number_format_i18n( count( $json_taxonomies ) ),
);
if ( $is_pro ) {
$enable_options_pages_ui = acf_get_setting( 'enable_options_pages_ui' );
$fields['ui_options_pages_enabled'] = array(
'label' => __( 'Options Pages UI Enabled', 'acf' ),
'value' => $enable_options_pages_ui ? $yes : $no,
'debug' => $enable_options_pages_ui,
);
$options_pages = acf_get_options_pages();
$ui_options_pages = array();
if ( empty( $options_pages ) || ! is_array( $options_pages ) ) {
$options_pages = array();
}
if ( $enable_options_pages_ui ) {
$ui_options_pages = acf_get_ui_options_pages();
$ui_options_pages_in_ui = array_filter(
$ui_options_pages,
function ( $ui_options_page ) {
return empty( $ui_options_page['local'] );
}
);
$json_options_pages = array_filter(
$ui_options_pages,
function ( $ui_options_page ) {
return ! empty( $ui_options_page['local'] );
}
);
$fields['ui_options_pages'] = array(
'label' => __( 'Registered Options Pages (UI)', 'acf' ),
'value' => number_format_i18n( count( $ui_options_pages_in_ui ) ),
);
$fields['json_options_pages'] = array(
'label' => __( 'Registered Options Pages (JSON)', 'acf' ),
'value' => number_format_i18n( count( $json_options_pages ) ),
);
}
$ui_options_page_slugs = array_column( $ui_options_pages, 'menu_slug' );
$php_options_pages = array_filter(
$options_pages,
function ( $options_page ) use ( $ui_options_page_slugs ) {
return ! in_array( $options_page['menu_slug'], $ui_options_page_slugs, true );
}
);
$fields['php_options_pages'] = array(
'label' => __( 'Registered Options Pages (PHP)', 'acf' ),
'value' => number_format_i18n( count( $php_options_pages ) ),
);
}
$rest_api_format = acf_get_setting( 'rest_api_format' );
$fields['rest_api_format'] = array(
'label' => __( 'REST API Format', 'acf' ),
'value' => 'standard' === $rest_api_format ? __( 'Standard', 'acf' ) : __( 'Light', 'acf' ),
'debug' => $rest_api_format,
);
if ( $is_pro ) {
$fields['registered_acf_blocks'] = array(
'label' => __( 'Registered ACF Blocks', 'acf' ),
'value' => number_format_i18n( acf_pro_get_registered_block_count() ),
);
$blocks = acf_get_block_types();
$block_api_versions = array();
$acf_block_versions = array();
foreach ( $blocks as $block ) {
if ( ! isset( $block_api_versions[ 'v' . $block['api_version'] ] ) ) {
$block_api_versions[ 'v' . $block['api_version'] ] = 0;
}
if ( ! isset( $acf_block_versions[ 'v' . $block['acf_block_version'] ] ) ) {
$acf_block_versions[ 'v' . $block['acf_block_version'] ] = 0;
}
++$block_api_versions[ 'v' . $block['api_version'] ];
++$acf_block_versions[ 'v' . $block['acf_block_version'] ];
}
$fields['blocks_per_api_version'] = array(
'label' => __( 'Blocks Per API Version', 'acf' ),
'value' => $block_api_versions,
);
$fields['blocks_per_acf_block_version'] = array(
'label' => __( 'Blocks Per ACF Block Version', 'acf' ),
'value' => $acf_block_versions,
);
$preload_blocks = acf_get_setting( 'preload_blocks' );
$fields['preload_blocks'] = array(
'label' => __( 'Block Preloading Enabled', 'acf' ),
'value' => ! empty( $preload_blocks ) ? $yes : $no,
'debug' => $preload_blocks,
);
}
$show_admin = acf_get_setting( 'show_admin' );
$fields['admin_ui_enabled'] = array(
'label' => __( 'Admin UI Enabled', 'acf' ),
'value' => $show_admin ? $yes : $no,
'debug' => $show_admin,
);
$field_type_modal_enabled = apply_filters( 'acf/field_group/enable_field_browser', true );
$fields['field_type-modal_enabled'] = array(
'label' => __( 'Field Type Modal Enabled', 'acf' ),
'value' => ! empty( $field_type_modal_enabled ) ? $yes : $no,
'debug' => $field_type_modal_enabled,
);
$field_settings_tabs_enabled = apply_filters( 'acf/field_group/disable_field_settings_tabs', false );
$fields['field_settings_tabs_enabled'] = array(
'label' => __( 'Field Settings Tabs Enabled', 'acf' ),
'value' => empty( $field_settings_tabs_enabled ) ? $yes : $no,
'debug' => $field_settings_tabs_enabled,
);
$shortcode_enabled = acf_get_setting( 'enable_shortcode' );
$fields['shortcode_enabled'] = array(
'label' => __( 'Shortcode Enabled', 'acf' ),
'value' => ! empty( $shortcode_enabled ) ? $yes : $no,
'debug' => $shortcode_enabled,
);
$fields['registered_acf_forms'] = array(
'label' => __( 'Registered ACF Forms', 'acf' ),
'value' => number_format_i18n( count( acf_get_forms() ) ),
);
$local_json = acf_get_instance( 'ACF_Local_JSON' );
$save_paths = $local_json->get_save_paths();
$load_paths = $local_json->get_load_paths();
$fields['json_save_paths'] = array(
'label' => __( 'JSON Save Paths', 'acf' ),
'value' => number_format_i18n( count( $save_paths ) ),
'debug' => count( $save_paths ),
);
$fields['json_load_paths'] = array(
'label' => __( 'JSON Load Paths', 'acf' ),
'value' => number_format_i18n( count( $load_paths ) ),
'debug' => count( $load_paths ),
);
return $fields;
}
}
acf_new_instance( 'ACF_Site_Health' );
}

View File

@ -22,36 +22,31 @@ if ( ! class_exists( 'acf_fields' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
/* do nothing */
}
/**
* This function will register a field type instance
* This function will register a field type instance based on a class name or instance.
* It will return the instance for further use.
*
* @type function
* @date 6/07/2016
* @since 5.4.0
* @since 5.4.0
*
* @param $class (string)
* @return n/a
* @param mixed $field_class Either a class name (string) or instance of acf_field.
* @return acf_field The instance of acf_field.
*/
function register_field_type( $class ) {
// allow instance
if ( $class instanceof acf_field ) {
$this->types[ $class->name ] = $class;
// allow class name
} else {
$instance = new $class();
$this->types[ $instance->name ] = $instance;
public function register_field_type( $field_class ) {
// Allow registering an instance.
if ( $field_class instanceof acf_field ) {
$this->types[ $field_class->name ] = $field_class;
return $field_class;
}
}
// Allow registering a loaded class name.
$instance = new $field_class();
$this->types[ $instance->name ] = $instance;
return $instance;
}
/**
* This function will return a field type instance
@ -63,7 +58,6 @@ if ( ! class_exists( 'acf_fields' ) ) :
* @param $name (string)
* @return (mixed)
*/
function get_field_type( $name ) {
return isset( $this->types[ $name ] ) ? $this->types[ $name ] : null;
}
@ -79,7 +73,6 @@ if ( ! class_exists( 'acf_fields' ) ) :
* @param $name (string)
* @return (mixed)
*/
function is_field_type( $name ) {
return isset( $this->types[ $name ] );
}

View File

@ -17,7 +17,6 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -47,7 +46,6 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
* @param array $field
* @return n/a
*/
function render_field( $field ) {
// vars
@ -122,7 +120,6 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
*
* @return $field - the field array holding all the field options
*/
function load_field( $field ) {
// remove name to avoid caching issue

View File

@ -16,7 +16,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -224,7 +223,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
* @param array $field The field array holding all the field options
* @return $field
*/
function update_field( $field ) {
return acf_get_field_type( 'radio' )->update_field( $field );
@ -242,7 +240,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
* @param array $field The field array holding all the field options
* @return $value
*/
function load_value( $value, $post_id, $field ) {
return acf_get_field_type( 'radio' )->load_value( $value, $post_id, $field );
@ -258,7 +255,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
* @param array $field The field array holding all the field options
* @return $field
*/
function translate_field( $field ) {
return acf_get_field_type( 'radio' )->translate_field( $field );
@ -276,7 +272,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
* @param array $field The field array holding all the field options
* @return $value
*/
function format_value( $value, $post_id, $field ) {
return acf_get_field_type( 'radio' )->format_value( $value, $post_id, $field );

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -50,7 +49,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
* @param $field (array) the $field being edited
* @return n/a
*/
function render_field( $field ) {
// reset vars
@ -109,7 +107,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function render_field_choices( $field ) {
// walk
@ -151,7 +148,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function render_field_toggle( $field ) {
// vars
@ -186,7 +182,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function render_field_custom( $field ) {
// vars
@ -443,7 +438,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
*
* @return $field - the modified field
*/
function update_field( $field ) {
// Decode choices (convert to array).
@ -466,7 +460,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
*
* @return $value - the modified value
*/
function update_value( $value, $post_id, $field ) {
// bail early if is empty
@ -530,7 +523,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
* @param $field (array)
* @return $field
*/
function translate_field( $field ) {
return acf_get_field_type( 'select' )->translate_field( $field );
@ -550,7 +542,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
// Bail early if is empty.

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -43,7 +42,6 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function input_admin_enqueue_scripts() {
// Register scripts for non-admin.
@ -107,7 +105,6 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
$text_input = acf_get_sub_array( $field, array( 'id', 'class', 'name', 'value' ) );
$hidden_input = acf_get_sub_array( $field, array( 'name', 'value' ) );
@ -138,7 +135,6 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
*
* @param $field - an array holding all the field's data
*/
function render_field_settings( $field ) {
// display_format

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -43,7 +42,6 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function input_admin_enqueue_scripts() {
// bail early if no enqueue
@ -87,7 +85,6 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// vars
@ -243,7 +240,6 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
// save_format - compatibility with ACF < 5.0.0

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -43,7 +42,6 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function input_admin_enqueue_scripts() {
// bail early if no enqueue
@ -98,7 +96,6 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// Set value.

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_email' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -42,7 +41,6 @@ if ( ! class_exists( 'acf_field_email' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// vars

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -48,7 +47,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function input_admin_enqueue_scripts() {
// localize
@ -71,7 +69,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// vars
@ -297,7 +294,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
// bail early if no value
@ -335,7 +331,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
* @param $vars (array)
* @return $vars
*/
function get_media_item_args( $vars ) {
$vars['send'] = true;
@ -356,7 +351,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
*
* @return $value - the modified value
*/
function update_value( $value, $post_id, $field ) {
// Bail early if no value.

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -50,7 +49,6 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function input_admin_enqueue_scripts() {
// localize
@ -107,7 +105,6 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// Apply defaults.
@ -176,7 +173,6 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
*
* @param $field - an array holding all the field's data
*/
function render_field_settings( $field ) {
// center_lat

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -48,7 +47,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
*
* @return $field - the field array holding all the field options
*/
function load_field( $field ) {
// vars
@ -76,7 +74,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* @param $field (array) the field array holding all the field options
* @return $value
*/
function load_value( $value, $post_id, $field ) {
// bail early if no sub fields
@ -154,7 +151,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
*
* @return $value - the modified value
*/
function update_value( $value, $post_id, $field ) {
// bail early if no value
@ -210,7 +206,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* @param $field (array)
* @return $field
*/
function prepare_field_for_db( $field ) {
// bail early if no sub fields
@ -239,7 +234,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// bail early if no sub fields
@ -289,7 +283,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function render_field_block( $field ) {
// vars
@ -316,7 +309,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function render_field_table( $field ) {
?>
@ -381,7 +373,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
*
* @param $field - an array holding all the field's data
*/
function render_field_settings( $field ) {
// vars
@ -435,7 +426,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function validate_value( $valid, $value, $field, $input ) {
// bail early if no $value
@ -484,7 +474,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
*
* @return $field - the modified field
*/
function duplicate_field( $field ) {
// get sub fields
@ -561,7 +550,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* @param array $field The field settings
* @return void
*/
function delete_value( $post_id, $meta_key, $field ) {
// bail early if no sub fields

View File

@ -0,0 +1,681 @@
<?php
/**
* This is a PHP file containing the code for the acf_field_icon_picker class.
*
* @package Advanced_Custom_Fields_Pro
*/
if ( ! class_exists( 'acf_field_icon_picker' ) ) :
/**
* Class acf_field_icon_picker.
*/
class acf_field_icon_picker extends acf_field {
/**
* Initialize icon picker field
*
* @since 6.3
*
* @return void
*/
public function initialize() {
$this->name = 'icon_picker';
$this->label = __( 'Icon Picker', 'acf' );
$this->public = true;
$this->category = 'advanced';
$this->description = __( 'An interactive UI for selecting an icon. Select from Dashicons, the media library, or a standalone URL input.', 'acf' );
$this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-icon-picker.png';
$this->doc_url = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/icon-picker/', 'docs', 'field-type-selection' );
$this->defaults = array(
'library' => 'all',
'tabs' => array_keys( $this->get_tabs() ),
'return_format' => 'string',
'default_value' => array(
'type' => null,
'value' => null,
),
);
}
/**
* Gets the available tabs for the icon picker field.
*
* @since 6.3
*
* @return array
*/
public function get_tabs() {
$tabs = array(
'dashicons' => esc_html__( 'Dashicons', 'acf' ),
);
if ( current_user_can( 'upload_files' ) ) {
$tabs['media_library'] = esc_html__( 'Media Library', 'acf' );
}
$tabs['url'] = esc_html__( 'URL', 'acf' );
/**
* Allows filtering the tabs used by the icon picker.
*
* @since 6.3
*
* @param array $tabs An associative array of tabs in key => label format.
* @return array
*/
return apply_filters( 'acf/fields/icon_picker/tabs', $tabs );
}
/**
* Renders icon picker field
*
* @since 6.3
*
* @param object $field The ACF Field
* @return void
*/
public function render_field( $field ) {
$uploader = acf_get_setting( 'uploader' );
// Enqueue uploader scripts
if ( $uploader === 'wp' ) {
acf_enqueue_uploader();
}
$div = array(
'id' => $field['id'],
'class' => $field['class'] . ' acf-icon-picker',
);
echo '<div ' . acf_esc_attrs( $div ) . '>';
acf_hidden_input(
array(
'name' => $field['name'] . '[type]',
'value' => $field['value']['type'],
'data-hidden-type' => 'type',
)
);
acf_hidden_input(
array(
'name' => $field['name'] . '[value]',
'value' => $field['value']['value'],
'data-hidden-type' => 'value',
)
);
$tabs = $this->get_tabs();
$shown = array_filter(
$tabs,
function ( $tab ) use ( $field ) {
return in_array( $tab, $field['tabs'], true );
},
ARRAY_FILTER_USE_KEY
);
foreach ( $shown as $name => $label ) {
acf_render_field_wrap(
array(
'type' => 'tab',
'label' => $label,
'key' => 'acf_icon_picker_tabs',
'selected' => $name === $field['value']['type'],
'unique_tab_key' => $name,
)
);
$wrapper_class = str_replace( '_', '-', $name );
echo '<div class="acf-icon-picker-tabs acf-icon-picker-' . esc_attr( $wrapper_class ) . '-tabs">';
switch ( $name ) {
case 'dashicons':
echo '<div class="acf-dashicons-search-wrap">';
acf_text_input(
array(
'class' => 'acf-dashicons-search-input',
'placeholder' => esc_html__( 'Search icons...', 'acf' ),
'type' => 'search',
)
);
echo '</div>';
echo '<div class="acf-dashicons-list"></div>';
?>
<div class="acf-dashicons-list-empty">
<img src="<?php echo esc_url( acf_get_url( 'assets/images/face-sad.svg' ) ); ?>" />
<p class="acf-no-results-text">
<?php
printf(
/* translators: %s: The invalid search term */
esc_html__( "No search results for '%s'", 'acf' ),
'<span class="acf-invalid-dashicon-search-term"></span>'
);
?>
</p>
</div>
<?php
break;
case 'media_library':
?>
<div class="acf-icon-picker-tab" data-category="<?php echo esc_attr( $name ); ?>">
<div class="acf-icon-picker-media-library">
<button
aria-label="<?php esc_attr_e( 'Click to change the icon in the Media Library', 'acf' ); ?>"
class="acf-icon-picker-media-library-preview"
style="<?php echo esc_attr( 'media_library' === $field['value']['type'] || 'dashicons' === $field['value']['type'] && ! empty( $field['value']['value'] ) ? '' : 'display: none;' ); ?>"
>
<div class="acf-icon-picker-media-library-preview-img" style="<?php echo esc_attr( 'media_library' !== $field['value']['type'] ? 'display: none;' : '' ); ?>">
<?php
$img_url = wp_get_attachment_image_url( $field['value']['value'], 'thumbnail' );
// If the type is media_library, then we need to show the media library preview.
?>
<img src="<?php echo esc_url( $img_url ); ?>" alt="<?php esc_attr_e( 'The currently selected image preview', 'acf' ); ?>" />
</div>
<div class="acf-icon-picker-media-library-preview-dashicon" style="<?php echo esc_attr( 'dashicons' !== $field['value']['type'] ? 'display: none;' : '' ); ?>">
<div class="dashicons <?php echo esc_attr( $field['value']['value'] ); ?>">
</div>
</div>
</button>
<button class="acf-icon-picker-media-library-button">
<div class="acf-icon-picker-media-library-button-icon dashicons dashicons-admin-media"></div>
<span><?php esc_html_e( 'Browse Media Library', 'acf' ); ?></span>
</button>
</div>
</div>
<?php
break;
case 'url':
echo '<div class="acf-icon-picker-url">';
acf_text_input(
array(
'class' => 'acf-icon_url',
'value' => $field['value']['type'] === 'url' ? $field['value']['value'] : '',
)
);
// Helper Text
?>
<p class="description"><?php esc_html_e( 'The URL to the icon you\'d like to use, or svg as Data URI', 'acf' ); ?></p>
<?php
echo '</div>';
break;
default:
do_action( 'acf/fields/icon_picker/tab/' . $name, $field );
}
echo '</div>';
}
echo '</div>';
}
/**
* Renders field settings for the icon picker field.
*
* @since 6.3
*
* @param array $field The icon picker field object.
* @return void
*/
public function render_field_settings( $field ) {
acf_render_field_setting(
$field,
array(
'label' => __( 'Tabs', 'acf' ),
'instructions' => __( 'Select where content editors can choose the icon from.', 'acf' ),
'type' => 'checkbox',
'name' => 'tabs',
'choices' => $this->get_tabs(),
)
);
$return_format_doc = sprintf(
'<a href="%s" target="_blank">%s</a>',
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/icon-picker/', 'docs', 'icon-picker-return-format' ),
__( 'Learn More', 'acf' )
);
$return_format_instructions = sprintf(
/* translators: %s - link to documentation */
__( 'Specify the return format for the icon. %s', 'acf' ),
$return_format_doc
);
acf_render_field_setting(
$field,
array(
'label' => __( 'Return Format', 'acf' ),
'instructions' => $return_format_instructions,
'type' => 'radio',
'name' => 'return_format',
'choices' => array(
'string' => __( 'String', 'acf' ),
'array' => __( 'Array', 'acf' ),
),
'layout' => 'horizontal',
)
);
}
/**
* Localizes text for Icon Picker
*
* @since 6.3
*
* @return void
*/
public function input_admin_enqueue_scripts() {
acf_localize_data(
array(
'iconPickerA11yStrings' => array(
'noResultsForSearchTerm' => esc_html__( 'No results found for that search term', 'acf' ),
'newResultsFoundForSearchTerm' => esc_html__( 'The available icons matching your search query have been updated in the icon picker below.', 'acf' ),
),
'iconPickeri10n' => $this->get_dashicons(),
)
);
}
/**
* Validates the field value before it is saved into the database.
*
* @since 6.3
*
* @param integer $valid The current validation status.
* @param mixed $value The value of the field.
* @param array $field The field array holding all the field options.
* @param string $input The corresponding input name for $_POST value.
* @return boolean true If the value is valid, false if not.
*/
public function validate_value( $valid, $value, $field, $input ) {
// If the value is empty, return true. You're allowed to save nothing.
if ( empty( $value ) && empty( $field['required'] ) ) {
return true;
}
// If the value is not an array, return $valid status.
if ( ! is_array( $value ) ) {
return $valid;
}
// If the value is an array, but the type is not set, fail validation.
if ( ! isset( $value['type'] ) ) {
return __( 'Icon picker requires an icon type.', 'acf' );
}
// If the value is an array, but the value is not set, fail validation.
if ( ! isset( $value['value'] ) ) {
return __( 'Icon picker requires a value.', 'acf' );
}
return true;
}
/**
* format_value()
*
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
*
* @since 6.3
*
* @param mixed $value The value which was loaded from the database.
* @param integer $post_id The $post_id from which the value was loaded.
* @param array $field The field array holding all the field options.
* @return mixed $value The modified value.
*/
public function format_value( $value, $post_id, $field ) {
// Handle empty values.
if ( empty( $value ) ) {
// Return the default value if there is one.
if ( isset( $field['default_value'] ) ) {
return $field['default_value'];
} else {
// Otherwise return false.
return false;
}
}
// If media_library, behave the same as an image field.
if ( $value['type'] === 'media_library' ) {
// convert to int
$value['value'] = intval( $value['value'] );
// format
if ( $field['return_format'] === 'string' ) {
return wp_get_attachment_url( $value['value'] );
} elseif ( $field['return_format'] === 'array' ) {
$value['value'] = acf_get_attachment( $value['value'] );
return $value;
}
}
// If the desired return format is a string
if ( $field['return_format'] === 'string' ) {
return $value['value'];
}
// If nothing specific matched the return format, just return the value.
return $value;
}
/**
* get_dashicons()
*
* This function will return an array of dashicons.
*
* @since 6.3
*
* @return array $dashicons an array of dashicons.
*/
public function get_dashicons() {
$dashicons = array(
'dashicons-admin-generic' => esc_html__( 'Generic icon', 'acf' ),
'dashicons-admin-appearance' => esc_html__( 'Appearance icon', 'acf' ),
'dashicons-admin-collapse' => esc_html__( 'Collapse icon', 'acf' ),
'dashicons-admin-comments' => esc_html__( 'Comments icon', 'acf' ),
'dashicons-admin-customizer' => esc_html__( 'Customizer icon', 'acf' ),
'dashicons-admin-home' => esc_html__( 'Home icon', 'acf' ),
'dashicons-admin-links' => esc_html__( 'Links icon', 'acf' ),
'dashicons-admin-media' => esc_html__( 'Media icon', 'acf' ),
'dashicons-admin-multisite' => esc_html__( 'Multisite icon', 'acf' ),
'dashicons-admin-network' => esc_html__( 'Network icon', 'acf' ),
'dashicons-admin-page' => esc_html__( 'Page icon', 'acf' ),
'dashicons-admin-plugins' => esc_html__( 'Plugins icon', 'acf' ),
'dashicons-admin-post' => esc_html__( 'Post icon', 'acf' ),
'dashicons-admin-settings' => esc_html__( 'Settings icon', 'acf' ),
'dashicons-admin-site' => esc_html__( 'Site icon', 'acf' ),
'dashicons-admin-tools' => esc_html__( 'Tools icon', 'acf' ),
'dashicons-admin-users' => esc_html__( 'Users icon', 'acf' ),
'dashicons-album' => esc_html__( 'Album icon', 'acf' ),
'dashicons-align-center' => esc_html__( 'Align-center icon', 'acf' ),
'dashicons-align-left' => esc_html__( 'Align-left icon', 'acf' ),
'dashicons-align-none' => esc_html__( 'Align-none icon', 'acf' ),
'dashicons-align-right' => esc_html__( 'Align-right icon', 'acf' ),
'dashicons-analytics' => esc_html__( 'Analytics icon', 'acf' ),
'dashicons-archive' => esc_html__( 'Archive icon', 'acf' ),
'dashicons-arrow-down' => esc_html__( 'Arrow down icon', 'acf' ),
'dashicons-arrow-down-alt' => esc_html__( 'Arrow down-alt icon', 'acf' ),
'dashicons-arrow-down-alt2' => esc_html__( 'Arrow down-alt2 icon', 'acf' ),
'dashicons-arrow-left' => esc_html__( 'Arrow left icon', 'acf' ),
'dashicons-arrow-left-alt' => esc_html__( 'Arrow left-alt icon', 'acf' ),
'dashicons-arrow-left-alt2' => esc_html__( 'Arrow left-alt2 icon', 'acf' ),
'dashicons-arrow-right' => esc_html__( 'Arrow right icon', 'acf' ),
'dashicons-arrow-right-alt' => esc_html__( 'Arrow right-alt icon', 'acf' ),
'dashicons-arrow-right-alt2' => esc_html__( 'Arrow right-alt2 icon', 'acf' ),
'dashicons-arrow-up' => esc_html__( 'Arrow up icon', 'acf' ),
'dashicons-arrow-up-alt' => esc_html__( 'Arrow up-alt icon', 'acf' ),
'dashicons-arrow-up-alt2' => esc_html__( 'Arrow up-alt2 icon', 'acf' ),
'dashicons-art' => esc_html__( 'Art icon', 'acf' ),
'dashicons-awards' => esc_html__( 'Awards icon', 'acf' ),
'dashicons-backup' => esc_html__( 'Backup icon', 'acf' ),
'dashicons-book' => esc_html__( 'Book icon', 'acf' ),
'dashicons-book-alt' => esc_html__( 'Book alt icon', 'acf' ),
'dashicons-building' => esc_html__( 'Building icon', 'acf' ),
'dashicons-businessman' => esc_html__( 'Businessman icon', 'acf' ),
'dashicons-calendar' => esc_html__( 'Calendar icon', 'acf' ),
'dashicons-calendar-alt' => esc_html__( 'Calendar alt icon', 'acf' ),
'dashicons-camera' => esc_html__( 'Camera icon', 'acf' ),
'dashicons-carrot' => esc_html__( 'Carrot icon', 'acf' ),
'dashicons-cart' => esc_html__( 'Cart icon', 'acf' ),
'dashicons-category' => esc_html__( 'Category icon', 'acf' ),
'dashicons-chart-area' => esc_html__( 'Chart area icon', 'acf' ),
'dashicons-chart-bar' => esc_html__( 'Chart bar icon', 'acf' ),
'dashicons-chart-line' => esc_html__( 'Chart line icon', 'acf' ),
'dashicons-chart-pie' => esc_html__( 'Chart pie icon', 'acf' ),
'dashicons-clipboard' => esc_html__( 'Clipboard icon', 'acf' ),
'dashicons-clock' => esc_html__( 'Clock icon', 'acf' ),
'dashicons-cloud' => esc_html__( 'Cloud icon', 'acf' ),
'dashicons-controls-back' => esc_html__( 'Controls back icon', 'acf' ),
'dashicons-controls-forward' => esc_html__( 'Controls forward icon', 'acf' ),
'dashicons-controls-pause' => esc_html__( 'Controls pause icon', 'acf' ),
'dashicons-controls-play' => esc_html__( 'Controls play icon', 'acf' ),
'dashicons-controls-repeat' => esc_html__( 'Controls repeat icon', 'acf' ),
'dashicons-controls-skipback' => esc_html__( 'Controls skipback icon', 'acf' ),
'dashicons-controls-skipforward' => esc_html__( 'Controls skipforward icon', 'acf' ),
'dashicons-controls-volumeoff' => esc_html__( 'Controls volumeoff icon', 'acf' ),
'dashicons-controls-volumeon' => esc_html__( 'Controls volumeon icon', 'acf' ),
'dashicons-dashboard' => esc_html__( 'Dashboard icon', 'acf' ),
'dashicons-desktop' => esc_html__( 'Desktop icon', 'acf' ),
'dashicons-dismiss' => esc_html__( 'Dismiss icon', 'acf' ),
'dashicons-download' => esc_html__( 'Download icon', 'acf' ),
'dashicons-edit' => esc_html__( 'Edit icon', 'acf' ),
'dashicons-editor-aligncenter' => esc_html__( 'aligncenter icon', 'acf' ),
'dashicons-editor-alignleft' => esc_html__( 'alignleft icon', 'acf' ),
'dashicons-editor-alignright' => esc_html__( 'alignright icon', 'acf' ),
'dashicons-editor-bold' => esc_html__( 'Bold icon', 'acf' ),
'dashicons-editor-break' => esc_html__( 'Break icon', 'acf' ),
'dashicons-editor-code' => esc_html__( 'Code icon', 'acf' ),
'dashicons-editor-contract' => esc_html__( 'Contract icon', 'acf' ),
'dashicons-editor-customchar' => esc_html__( 'Customchar icon', 'acf' ),
'dashicons-editor-expand' => esc_html__( 'Expand icon', 'acf' ),
'dashicons-editor-help' => esc_html__( 'Help icon', 'acf' ),
'dashicons-editor-indent' => esc_html__( 'Indent icon', 'acf' ),
'dashicons-editor-insertmore' => esc_html__( 'Insertmore icon', 'acf' ),
'dashicons-editor-italic' => esc_html__( 'Italic icon', 'acf' ),
'dashicons-editor-justify' => esc_html__( 'Justify icon', 'acf' ),
'dashicons-editor-kitchensink' => esc_html__( 'Kitchensink icon', 'acf' ),
'dashicons-editor-ol' => esc_html__( 'Ol icon', 'acf' ),
'dashicons-editor-outdent' => esc_html__( 'Outdent icon', 'acf' ),
'dashicons-editor-paragraph' => esc_html__( 'Paragraph icon', 'acf' ),
'dashicons-editor-paste-text' => esc_html__( 'Paste text icon', 'acf' ),
'dashicons-editor-paste-word' => esc_html__( 'Paste word icon', 'acf' ),
'dashicons-editor-quote' => esc_html__( 'Quote icon', 'acf' ),
'dashicons-editor-removeformatting' => esc_html__( 'Removeformatting icon', 'acf' ),
'dashicons-editor-rtl' => esc_html__( 'Rtl icon', 'acf' ),
'dashicons-editor-spellcheck' => esc_html__( 'Spellcheck icon', 'acf' ),
'dashicons-editor-strikethrough' => esc_html__( 'Strikethrough icon', 'acf' ),
'dashicons-editor-table' => esc_html__( 'Table icon', 'acf' ),
'dashicons-editor-textcolor' => esc_html__( 'Textcolor icon', 'acf' ),
'dashicons-editor-ul' => esc_html__( 'Ul icon', 'acf' ),
'dashicons-editor-underline' => esc_html__( 'Underline icon', 'acf' ),
'dashicons-editor-unlink' => esc_html__( 'Unlink icon', 'acf' ),
'dashicons-editor-video' => esc_html__( 'Video icon', 'acf' ),
'dashicons-email' => esc_html__( 'Email icon', 'acf' ),
'dashicons-email-alt' => esc_html__( 'Email alt icon', 'acf' ),
'dashicons-exerpt-view' => esc_html__( 'Exerpt-view icon', 'acf' ),
'dashicons-external' => esc_html__( 'External icon', 'acf' ),
'dashicons-facebook' => esc_html__( 'Facebook icon', 'acf' ),
'dashicons-facebook-alt' => esc_html__( 'Facebook alt icon', 'acf' ),
'dashicons-feedback' => esc_html__( 'Feedback icon', 'acf' ),
'dashicons-filter' => esc_html__( 'Filter icon', 'acf' ),
'dashicons-flag' => esc_html__( 'Flag icon', 'acf' ),
'dashicons-format-aside' => esc_html__( 'Format aside icon', 'acf' ),
'dashicons-format-audio' => esc_html__( 'Format audio icon', 'acf' ),
'dashicons-format-chat' => esc_html__( 'Format chat icon', 'acf' ),
'dashicons-format-gallery' => esc_html__( 'Format gallery icon', 'acf' ),
'dashicons-format-image' => esc_html__( 'Format image icon', 'acf' ),
'dashicons-format-quote' => esc_html__( 'Format quote icon', 'acf' ),
'dashicons-format-status' => esc_html__( 'Format status icon', 'acf' ),
'dashicons-format-video' => esc_html__( 'Format video icon', 'acf' ),
'dashicons-forms' => esc_html__( 'Forms icon', 'acf' ),
'dashicons-googleplus' => esc_html__( 'Googleplus icon', 'acf' ),
'dashicons-grid-view' => esc_html__( 'Grid-view icon', 'acf' ),
'dashicons-groups' => esc_html__( 'Groups icon', 'acf' ),
'dashicons-hammer' => esc_html__( 'Hammer icon', 'acf' ),
'dashicons-heart' => esc_html__( 'Heart icon', 'acf' ),
'dashicons-hidden' => esc_html__( 'Hidden icon', 'acf' ),
'dashicons-id' => esc_html__( 'Id icon', 'acf' ),
'dashicons-id-alt' => esc_html__( 'Id-alt icon', 'acf' ),
'dashicons-image-crop' => esc_html__( 'Image crop icon', 'acf' ),
'dashicons-image-filter' => esc_html__( 'Image filter icon', 'acf' ),
'dashicons-image-flip-horizontal' => esc_html__( 'Image flip-horizontal icon', 'acf' ),
'dashicons-image-flip-vertical' => esc_html__( 'Image flip-vertical icon', 'acf' ),
'dashicons-image-rotate' => esc_html__( 'Image rotate icon', 'acf' ),
'dashicons-image-rotate-left' => esc_html__( 'Image rotate-left icon', 'acf' ),
'dashicons-image-rotate-right' => esc_html__( 'Image rotate-right icon', 'acf' ),
'dashicons-images-alt' => esc_html__( 'Images-alt icon', 'acf' ),
'dashicons-images-alt2' => esc_html__( 'Images-alt2 icon', 'acf' ),
'dashicons-index-card' => esc_html__( 'Index-card icon', 'acf' ),
'dashicons-info' => esc_html__( 'Info icon', 'acf' ),
'dashicons-laptop' => esc_html__( 'Laptop icon', 'acf' ),
'dashicons-layout' => esc_html__( 'Layout icon', 'acf' ),
'dashicons-leftright' => esc_html__( 'Leftright icon', 'acf' ),
'dashicons-lightbulb' => esc_html__( 'Lightbulb icon', 'acf' ),
'dashicons-list-view' => esc_html__( 'List-view icon', 'acf' ),
'dashicons-location' => esc_html__( 'Location icon', 'acf' ),
'dashicons-location-alt' => esc_html__( 'Location-alt icon', 'acf' ),
'dashicons-lock' => esc_html__( 'Lock icon', 'acf' ),
'dashicons-marker' => esc_html__( 'Marker icon', 'acf' ),
'dashicons-media-archive' => esc_html__( 'Media archive icon', 'acf' ),
'dashicons-media-audio' => esc_html__( 'Media audio icon', 'acf' ),
'dashicons-media-code' => esc_html__( 'Media code icon', 'acf' ),
'dashicons-media-default' => esc_html__( 'Media default icon', 'acf' ),
'dashicons-media-document' => esc_html__( 'Media document icon', 'acf' ),
'dashicons-media-interactive' => esc_html__( 'Media interactive icon', 'acf' ),
'dashicons-media-spreadsheet' => esc_html__( 'Media spreadsheet icon', 'acf' ),
'dashicons-media-text' => esc_html__( 'Media text icon', 'acf' ),
'dashicons-media-video' => esc_html__( 'Media video icon', 'acf' ),
'dashicons-megaphone' => esc_html__( 'Megaphone icon', 'acf' ),
'dashicons-menu' => esc_html__( 'Menu icon', 'acf' ),
'dashicons-microphone' => esc_html__( 'Microphone icon', 'acf' ),
'dashicons-migrate' => esc_html__( 'Migrate icon', 'acf' ),
'dashicons-minus' => esc_html__( 'Minus icon', 'acf' ),
'dashicons-money' => esc_html__( 'Money icon', 'acf' ),
'dashicons-move' => esc_html__( 'Move icon', 'acf' ),
'dashicons-nametag' => esc_html__( 'Nametag icon', 'acf' ),
'dashicons-networking' => esc_html__( 'Networking icon', 'acf' ),
'dashicons-no' => esc_html__( 'No icon', 'acf' ),
'dashicons-no-alt' => esc_html__( 'No alternative icon', 'acf' ),
'dashicons-palmtree' => esc_html__( 'Palmtree icon', 'acf' ),
'dashicons-paperclip' => esc_html__( 'Paperclip icon', 'acf' ),
'dashicons-performance' => esc_html__( 'Performance icon', 'acf' ),
'dashicons-phone' => esc_html__( 'Phone icon', 'acf' ),
'dashicons-playlist-audio' => esc_html__( 'Playlist-audio icon', 'acf' ),
'dashicons-playlist-video' => esc_html__( 'Playlist-video icon', 'acf' ),
'dashicons-plus' => esc_html__( 'Plus icon', 'acf' ),
'dashicons-plus-alt' => esc_html__( 'Plus-alt icon', 'acf' ),
'dashicons-portfolio' => esc_html__( 'Portfolio icon', 'acf' ),
'dashicons-post-status' => esc_html__( 'Post-status icon', 'acf' ),
'dashicons-pressthis' => esc_html__( 'Pressthis icon', 'acf' ),
'dashicons-products' => esc_html__( 'Products icon', 'acf' ),
'dashicons-randomize' => esc_html__( 'Randomize icon', 'acf' ),
'dashicons-redo' => esc_html__( 'Redo icon', 'acf' ),
'dashicons-rss' => esc_html__( 'Rss icon', 'acf' ),
'dashicons-schedule' => esc_html__( 'Schedule icon', 'acf' ),
'dashicons-screenoptions' => esc_html__( 'Screenoptions icon', 'acf' ),
'dashicons-search' => esc_html__( 'Search icon', 'acf' ),
'dashicons-share' => esc_html__( 'Share icon', 'acf' ),
'dashicons-share-alt' => esc_html__( 'Share-alt icon', 'acf' ),
'dashicons-share-alt2' => esc_html__( 'Share-alt2 icon', 'acf' ),
'dashicons-shield' => esc_html__( 'Shield icon', 'acf' ),
'dashicons-shield-alt' => esc_html__( 'Shield-alt icon', 'acf' ),
'dashicons-slides' => esc_html__( 'Slides icon', 'acf' ),
'dashicons-smartphone' => esc_html__( 'Smartphone icon', 'acf' ),
'dashicons-smiley' => esc_html__( 'Smiley icon', 'acf' ),
'dashicons-sort' => esc_html__( 'Sort icon', 'acf' ),
'dashicons-sos' => esc_html__( 'Sos icon', 'acf' ),
'dashicons-star-empty' => esc_html__( 'Star-empty icon', 'acf' ),
'dashicons-star-filled' => esc_html__( 'Star-filled icon', 'acf' ),
'dashicons-star-half' => esc_html__( 'Star-half icon', 'acf' ),
'dashicons-sticky' => esc_html__( 'Sticky icon', 'acf' ),
'dashicons-store' => esc_html__( 'Store icon', 'acf' ),
'dashicons-tablet' => esc_html__( 'Tablet icon', 'acf' ),
'dashicons-tag' => esc_html__( 'Tag icon', 'acf' ),
'dashicons-tagcloud' => esc_html__( 'Tagcloud icon', 'acf' ),
'dashicons-testimonial' => esc_html__( 'Testimonial icon', 'acf' ),
'dashicons-text' => esc_html__( 'Text icon', 'acf' ),
'dashicons-thumbs-down' => esc_html__( 'Thumbs-down icon', 'acf' ),
'dashicons-thumbs-up' => esc_html__( 'Thumbs-up icon', 'acf' ),
'dashicons-tickets' => esc_html__( 'Tickets icon', 'acf' ),
'dashicons-tickets-alt' => esc_html__( 'Tickets alternative icon', 'acf' ),
'dashicons-translation' => esc_html__( 'Translation icon', 'acf' ),
'dashicons-trash' => esc_html__( 'Trash icon', 'acf' ),
'dashicons-twitter' => esc_html__( 'Twitter icon', 'acf' ),
'dashicons-undo' => esc_html__( 'Undo icon', 'acf' ),
'dashicons-universal-access' => esc_html__( 'Universal access icon', 'acf' ),
'dashicons-universal-access-alt' => esc_html__( 'Universal access alternative icon', 'acf' ),
'dashicons-unlock' => esc_html__( 'Unlock icon', 'acf' ),
'dashicons-update' => esc_html__( 'Update icon', 'acf' ),
'dashicons-upload' => esc_html__( 'Upload icon', 'acf' ),
'dashicons-vault' => esc_html__( 'Vault icon', 'acf' ),
'dashicons-video-alt' => esc_html__( 'Video-alt icon', 'acf' ),
'dashicons-video-alt2' => esc_html__( 'Video-alt2 icon', 'acf' ),
'dashicons-video-alt3' => esc_html__( 'Video-alt3 icon', 'acf' ),
'dashicons-visibility' => esc_html__( 'Visibility icon', 'acf' ),
'dashicons-warning' => esc_html__( 'Warning icon', 'acf' ),
'dashicons-welcome-add-page' => esc_html__( 'Welcome add-page icon', 'acf' ),
'dashicons-welcome-comments' => esc_html__( 'Welcome comments icon', 'acf' ),
'dashicons-welcome-learn-more' => esc_html__( 'Welcome learn-more icon', 'acf' ),
'dashicons-welcome-view-site' => esc_html__( 'Welcome view-site icon', 'acf' ),
'dashicons-welcome-widgets-menus' => esc_html__( 'Welcome widgets-menus icon', 'acf' ),
'dashicons-welcome-write-blog' => esc_html__( 'Welcome write-blog icon', 'acf' ),
'dashicons-wordpress' => esc_html__( 'Wordpress icon', 'acf' ),
'dashicons-wordpress-alt' => esc_html__( 'Wordpress-alt icon', 'acf' ),
'dashicons-yes' => esc_html__( 'Yes icon', 'acf' ),
);
return apply_filters( 'acf/fields/icon_picker/dashicons', $dashicons );
}
/**
* Returns the schema used by the REST API.
*
* @since 6.3
*
* @param array $field The main field array.
* @return array
*/
public function get_rest_schema( array $field ): array {
return array(
'type' => array( 'object', 'null' ),
'required' => ! empty( $field['required'] ),
'properties' => array(
'type' => array(
'description' => esc_html__( 'The type of icon to save.', 'acf' ),
'type' => array( 'string' ),
'required' => true,
'enum' => array_keys( $this->get_tabs() ),
),
'value' => array(
'description' => esc_html__( 'The value of icon to save.', 'acf' ),
'type' => array( 'string', 'int' ),
'required' => true,
),
),
);
}
/**
* Validates a value sent via the REST API.
*
* @since 6.3
*
* @param boolean $valid The current validity boolean.
* @param array|null $value The value of the field.
* @param array $field The main field array.
* @return boolean|WP_Error
*/
public function validate_rest_value( $valid, $value, $field ) {
if ( is_null( $value ) ) {
if ( ! empty( $field['required'] ) ) {
return new WP_Error(
'rest_property_required',
/* translators: %s - field name */
sprintf( __( '%s is a required property of acf.', 'acf' ), $field['name'] )
);
} else {
return $valid;
}
}
if ( ! empty( $value['type'] ) && 'media_library' === $value['type'] ) {
$param = sprintf( '%s[%s][value]', $field['prefix'], $field['name'] );
$data = array(
'param' => $param,
'value' => (int) $value['value'],
);
if ( ! is_int( $value['value'] ) || 'attachment' !== get_post_type( $value['value'] ) ) {
/* translators: %s - field/param name */
$error = sprintf( __( '%s requires a valid attachment ID when type is set to media_library.', 'acf' ), $param );
return new WP_Error( 'rest_invalid_param', $error, $data );
}
}
return $valid;
}
}
acf_register_field_type( 'acf_field_icon_picker' );
endif;

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -53,7 +52,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function input_admin_enqueue_scripts() {
// localize
@ -172,7 +170,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
*
* @param $field - an array holding all the field's data
*/
function render_field_settings( $field ) {
acf_render_field_setting(
$field,
@ -348,7 +345,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
// bail early if no value
@ -386,7 +382,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
* @param $vars (array)
* @return $vars
*/
function get_media_item_args( $vars ) {
$vars['send'] = true;
@ -407,7 +402,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
*
* @return $value - the modified value
*/
function update_value( $value, $post_id, $field ) {
return acf_get_field_type( 'file' )->update_value( $value, $post_id, $field );

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -41,7 +40,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function get_link( $value = '' ) {
// vars
@ -171,7 +169,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
// bail early if no value
@ -202,7 +199,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function validate_value( $valid, $value, $field, $input ) {
// bail early if not required
@ -233,7 +229,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
*
* @return $value - the modified value
*/
function update_value( $value, $post_id, $field ) {
// Check if value is an empty array and convert to empty string.

View File

@ -16,7 +16,6 @@ if ( ! class_exists( 'acf_field_message' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -43,7 +42,6 @@ if ( ! class_exists( 'acf_field_message' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// vars
@ -127,7 +125,6 @@ if ( ! class_exists( 'acf_field_message' ) ) :
* @param $field (array)
* @return $field
*/
function translate_field( $field ) {
// translate

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_number' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -45,7 +44,6 @@ if ( ! class_exists( 'acf_field_number' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// vars
@ -106,7 +104,6 @@ if ( ! class_exists( 'acf_field_number' ) ) :
*
* @param $field - an array holding all the field's data
*/
function render_field_settings( $field ) {
// default_value
@ -211,7 +208,6 @@ if ( ! class_exists( 'acf_field_number' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function validate_value( $valid, $value, $field, $input ) {
// remove ','
@ -262,7 +258,6 @@ if ( ! class_exists( 'acf_field_number' ) ) :
*
* @return $value - the modified value
*/
function update_value( $value, $post_id, $field ) {
// no formatting needed for empty value

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -51,7 +50,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
* @param $field (array)
* @return (int)
*/
function prepare_field( $field ) {
// defaults
@ -107,7 +105,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function ajax_query() {
// validate
@ -133,7 +130,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
* @param $options (array)
* @return (array)
*/
function get_ajax_query( $args = array() ) {
// defaults
@ -176,7 +172,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// atts

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_output' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -40,7 +39,6 @@ if ( ! class_exists( 'acf_field_output' ) ) :
* @param $field (array) the $field being edited
* @return n/a
*/
function render_field( $field ) {
// bail early if no html

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -36,8 +35,29 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// extra
add_action( 'wp_ajax_acf/fields/page_link/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/page_link/query', array( $this, 'ajax_query' ) );
add_filter( 'acf/conditional_logic/choices', array( $this, 'render_field_page_link_conditional_choices' ), 10, 3 );
}
/**
* Filters choices in page link conditions.
*
* @since 6.3
*
* @param array $choices The selected choice.
* @param array $conditional_field The conditional field settings object.
* @param string $rule_value The rule value.
* @return array
*/
public function render_field_page_link_conditional_choices( $choices, $conditional_field, $rule_value ) {
if ( ! is_array( $conditional_field ) || $conditional_field['type'] !== 'page_link' ) {
return $choices;
}
if ( ! empty( $rule_value ) ) {
$post_title = get_the_title( $rule_value );
$choices = array( $rule_value => $post_title );
}
return $choices;
}
/**
* description
@ -49,7 +69,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function ajax_query() {
// validate
@ -65,6 +84,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
's' => '',
'field_key' => '',
'paged' => 1,
'include' => '',
)
);
@ -128,6 +148,10 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
}
}
if ( ! empty( $options['include'] ) ) {
$args['include'] = $options['include'];
}
// filters
$args = apply_filters( 'acf/fields/page_link/query', $args, $field, $options['post_id'] );
$args = apply_filters( 'acf/fields/page_link/query/name=' . $field['name'], $args, $field, $options['post_id'] );
@ -166,6 +190,11 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
}
}
// If there is an include set, we will unset search to avoid attempting to further filter by the search term.
if ( isset( $args['include'] ) ) {
unset( $args['s'] );
}
// get posts grouped by post type
$groups = acf_get_grouped_posts( $args );
@ -223,7 +252,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
* @param $text (string)
* @return (array)
*/
function get_post_result( $id, $text ) {
// vars
@ -258,7 +286,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
* @param $post_id (int) the post_id to which this value is saved to
* @return (string)
*/
function get_post_title( $post, $field, $post_id = 0, $is_search = 0 ) {
// get post_id
@ -289,7 +316,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
* @param $value (array)
* @return $value
*/
function get_posts( $value, $field ) {
// force value to array
@ -352,7 +378,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// Change Field into a select
@ -505,7 +530,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
// ACF4 null
@ -559,7 +583,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
*
* @return $value - the modified value
*/
function update_value( $value, $post_id, $field ) {
// Bail early if no value.

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_password' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -41,7 +40,6 @@ if ( ! class_exists( 'acf_field_password' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
acf_get_field_type( 'text' )->render_field( $field );

View File

@ -8,8 +8,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* This function will setup the field type data
*
* @type function
* @date 5/03/2014
* @since 5.0.0
*/
public function initialize() {
@ -32,23 +30,36 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// extra
add_action( 'wp_ajax_acf/fields/post_object/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/post_object/query', array( $this, 'ajax_query' ) );
add_filter( 'acf/conditional_logic/choices', array( $this, 'render_field_post_object_conditional_choices' ), 10, 3 );
}
/**
* Filters choices in post object conditions.
*
* @since 6.3
*
* @param array $choices The selected choice.
* @param array $conditional_field The conditional field settings object.
* @param string $rule_value The rule value.
* @return array
*/
public function render_field_post_object_conditional_choices( $choices, $conditional_field, $rule_value ) {
if ( ! is_array( $conditional_field ) || $conditional_field['type'] !== 'post_object' ) {
return $choices;
}
if ( ! empty( $rule_value ) ) {
$post_title = get_the_title( $rule_value );
$choices = array( $rule_value => $post_title );
}
return $choices;
}
/**
* description
* AJAX query handler for post object fields.
*
* @type function
* @date 24/10/13
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function ajax_query() {
// validate
public function ajax_query() {
if ( ! acf_verify_ajax() ) {
die();
}
@ -64,15 +75,12 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* This function will return an array of data formatted for use in a select2 AJAX response
*
* @type function
* @date 15/10/2014
* @since 5.0.9
*
* @param $options (array)
* @return (array)
* @param array $options The options being queried for the ajax request.
* @return array The AJAX response array.
*/
function get_ajax_query( $options = array() ) {
public function get_ajax_query( $options = array() ) {
// defaults
$options = acf_parse_args(
@ -82,6 +90,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
's' => '',
'field_key' => '',
'paged' => 1,
'include' => '',
)
);
@ -112,6 +121,10 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
$is_search = true;
}
if ( ! empty( $options['include'] ) ) {
$args['include'] = $options['include'];
}
// post_type
if ( ! empty( $field['post_type'] ) ) {
$args['post_type'] = acf_get_array( $field['post_type'] );
@ -126,6 +139,11 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
$args['post_status'] = acf_get_array( $field['post_status'] );
}
// If there is an include set, we will unset search to avoid attempting to further filter by the search term.
if ( isset( $args['include'] ) ) {
unset( $args['s'] );
}
// taxonomy
if ( ! empty( $field['taxonomy'] ) ) {
@ -172,7 +190,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// convert post objects to post titles
foreach ( array_keys( $posts ) as $post_id ) {
$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'], $is_search );
$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'], $is_search, true );
}
// order posts by search
@ -209,16 +227,13 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* This function will return an array containing id, text and maybe description data
*
* @type function
* @date 7/07/2016
* @since 5.4.0
*
* @param $id (mixed)
* @param $text (string)
* @return (array)
* @param mixed $id The ID of the post result.
* @param string $text The text for the response item.
* @return array The combined result array.
*/
function get_post_result( $id, $text ) {
public function get_post_result( $id, $text ) {
// vars
$result = array(
@ -241,19 +256,18 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* This function returns the HTML for a result
* This function post object's filtered output post title
*
* @type function
* @date 1/11/2013
* @since 5.0.0
*
* @param $post (object)
* @param $field (array)
* @param $post_id (int) the post_id to which this value is saved to
* @return (string)
* @param WP_Post $post The WordPress post.
* @param array $field The field being output.
* @param integer $post_id The post_id to which this value is saved to.
* @param integer $is_search An int-as-boolean value for whether we're performing a search.
* @param boolean $unescape Should we return an unescaped post title.
* @return string A potentially user filtered post title for the post, which may contain unsafe HTML.
*/
function get_post_title( $post, $field, $post_id = 0, $is_search = 0 ) {
public function get_post_title( $post, $field, $post_id = 0, $is_search = 0, $unescape = false ) {
// get post_id
if ( ! $post_id ) {
@ -263,27 +277,29 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// vars
$title = acf_get_post_title( $post, $is_search );
// unescape for select2 output which handles the escaping.
if ( $unescape ) {
$title = html_entity_decode( $title );
}
// filters
$title = apply_filters( 'acf/fields/post_object/result', $title, $post, $field, $post_id );
$title = apply_filters( 'acf/fields/post_object/result/name=' . $field['_name'], $title, $post, $field, $post_id );
$title = apply_filters( 'acf/fields/post_object/result/key=' . $field['key'], $title, $post, $field, $post_id );
// return
// return untrusted output.
return $title;
}
/**
* Create the HTML interface for your field
* Create the HTML interface for the post object field.
*
* @param $field - an array holding all the field's data
* @since 3.6
*
* @type action
* @since 3.6
* @date 23/01/13
* @param array $field An array holding all the field's data.
*/
function render_field( $field ) {
public function render_field( $field ) {
// Change Field into a select
$field['type'] = 'select';
@ -311,16 +327,14 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* Create extra options for your field. This is rendered when editing a field.
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
* Create extra options for post object field. This is rendered when editing.
* The value of $field['name'] can be used (like below) to save extra data to the $field.
*
* @type action
* @since 3.6
* @date 23/01/13
* @since 3.6
*
* @param $field - an array holding all the field's data
* @param array $field An array holding all the field's data.
*/
function render_field_settings( $field ) {
public function render_field_settings( $field ) {
acf_render_field_setting(
$field,
array(
@ -401,7 +415,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
* @param array $field The field settings array.
* @return void
*/
function render_field_validation_settings( $field ) {
public function render_field_validation_settings( $field ) {
acf_render_field_setting(
$field,
array(
@ -429,17 +443,14 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* This filter is applied to the $value after it is loaded from the db
*
* @type filter
* @since 3.6
* @date 23/01/13
*
* @param $value (mixed) the value found in the database
* @param $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options
* @return $value
* @param mixed $value The value found in the database
* @param mixed $post_id The post_id from which the value was loaded
* @param array $field The field array holding all the field options
* @return mixed $value
*/
function load_value( $value, $post_id, $field ) {
public function load_value( $value, $post_id, $field ) {
// ACF4 null
if ( $value === 'null' ) {
@ -454,20 +465,14 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
*
* @type filter
* @since 3.6
* @date 23/01/13
* @since 3.6
*
* @param $value (mixed) the value which was loaded from the database
* @param $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options
*
* @return $value (mixed) the modified value
* @param mixed $value The value found in the database
* @param mixed $post_id The post_id from which the value was loaded
* @param array $field The field array holding all the field options
* @return mixed $value
*/
function format_value( $value, $post_id, $field ) {
// numeric
public function format_value( $value, $post_id, $field ) {
$value = acf_get_numeric( $value );
// bail early if no value
@ -529,15 +534,13 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* This function will return an array of posts for a given field value
*
* @type function
* @date 13/06/2014
* @since 5.0.0
* @since 5.0
*
* @param $value (array)
* @return $value
* @param mixed $value The value of the field.
* @param array $field The field array holding all the field options.
* @return array $value An array of post objects.
*/
function get_posts( $value, $field ) {
public function get_posts( $value, $field ) {
// numeric
$value = acf_get_numeric( $value );
@ -562,6 +565,8 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* Validates post object fields updated via the REST API.
*
* @since 5.11
*
* @param boolean $valid The current validity booleean
* @param integer $value The value of the field
* @param array $field The field array
@ -662,7 +667,9 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* Return the schema array for the REST API.
*
* @param array $field
* @since 5.11
*
* @param array $field The field array.
* @return array
*/
public function get_rest_schema( array $field ) {
@ -686,10 +693,14 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
}
/**
* REST link attributes generator for this field.
*
* @since 5.11
* @see \acf_field::get_rest_links()
*
* @param mixed $value The raw (unformatted) field value.
* @param integer|string $post_id
* @param array $field
* @param integer|string $post_id The post ID being queried.
* @param array $field The field array.
* @return array
*/
public function get_rest_links( $value, $post_id, array $field ) {
@ -722,9 +733,11 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/**
* Apply basic formatting to prepare the value for default REST output.
*
* @param mixed $value
* @param string|integer $post_id
* @param array $field
* @since 5.11
*
* @param mixed $value The raw (unformatted) field value.
* @param integer|string $post_id The post ID being queried.
* @param array $field The field array.
* @return mixed
*/
public function format_value_for_rest( $value, $post_id, array $field ) {

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -49,7 +48,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
* @param $field (array) the $field being edited
* @return n/a
*/
function render_field( $field ) {
// vars
@ -174,7 +172,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
*
* @param $field - an array holding all the field's data
*/
function render_field_settings( $field ) {
// Encode choices (convert from array).
$field['choices'] = acf_encode_choices( $field['choices'] );
@ -301,7 +298,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
*
* @return $field - the modified field
*/
function update_field( $field ) {
// decode choices (convert to array)
@ -326,7 +322,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
*
* @return $value - the modified value
*/
function update_value( $value, $post_id, $field ) {
// bail early if no value (allow 0 to be saved)
@ -382,7 +377,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
*
* @return $value - the value to be saved in te database
*/
function load_value( $value, $post_id, $field ) {
// must be single value
@ -405,7 +399,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
* @param $field (array)
* @return $field
*/
function translate_field( $field ) {
return acf_get_field_type( 'select' )->translate_field( $field );
@ -425,7 +418,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
return acf_get_field_type( 'select' )->format_value( $value, $post_id, $field );

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_range' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -44,7 +43,6 @@ if ( ! class_exists( 'acf_field_range' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// vars
@ -148,7 +146,6 @@ if ( ! class_exists( 'acf_field_range' ) ) :
*
* @param $field - an array holding all the field's data
*/
function render_field_settings( $field ) {
acf_render_field_setting(
$field,

View File

@ -29,12 +29,33 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
'return_format' => 'object',
'bidirectional_target' => array(),
);
add_filter( 'acf/conditional_logic/choices', array( $this, 'render_field_relation_conditional_choices' ), 10, 3 );
// extra
add_action( 'wp_ajax_acf/fields/relationship/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/relationship/query', array( $this, 'ajax_query' ) );
}
/**
* Filters choices in relation conditions.
*
* @since 6.3
*
* @param array $choices The selected choice.
* @param array $conditional_field The conditional field settings object.
* @param string $rule_value The rule value.
* @return array
*/
public function render_field_relation_conditional_choices( $choices, $conditional_field, $rule_value ) {
if ( ! is_array( $conditional_field ) || $conditional_field['type'] !== 'relationship' ) {
return $choices;
}
if ( ! empty( $rule_value ) ) {
$post_title = get_the_title( $rule_value );
$choices = array( $rule_value => $post_title );
}
return $choices;
}
/**
* description
@ -46,7 +67,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function input_admin_enqueue_scripts() {
// localize
@ -71,7 +91,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function ajax_query() {
// validate
@ -97,7 +116,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
* @param $options (array)
* @return (array)
*/
function get_ajax_query( $options = array() ) {
// defaults
@ -109,6 +127,7 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
'field_key' => '',
'paged' => 1,
'post_type' => '',
'include' => '',
'taxonomy' => '',
)
);
@ -130,8 +149,7 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
$args['paged'] = intval( $options['paged'] );
// search
if ( $options['s'] !== '' ) {
if ( $options['s'] !== '' && empty( $options['include'] ) ) {
// strip slashes (search may be integer)
$s = wp_unslash( strval( $options['s'] ) );
@ -191,6 +209,11 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
}
}
if ( ! empty( $options['include'] ) ) {
// If we have an include, we need to return only the selected posts.
$args['post__in'] = array( $options['include'] );
}
// filters
$args = apply_filters( 'acf/fields/relationship/query', $args, $field, $options['post_id'] );
$args = apply_filters( 'acf/fields/relationship/query/name=' . $field['name'], $args, $field, $options['post_id'] );
@ -262,7 +285,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
* @param $text (string)
* @return (array)
*/
function get_post_result( $id, $text ) {
// vars
@ -288,7 +310,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
* @param $post_id (int) the post_id to which this value is saved to
* @return (string)
*/
function get_post_title( $post, $field, $post_id = 0, $is_search = 0 ) {
// get post_id
@ -334,7 +355,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// vars
@ -681,7 +701,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
// bail early if no value
@ -722,7 +741,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function validate_value( $valid, $value, $field, $input ) {
// default

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -52,7 +51,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function input_admin_enqueue_scripts() {
// bail early if no enqueue
@ -125,7 +123,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function ajax_query() {
// validate
@ -223,7 +220,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// convert
@ -334,7 +330,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
*
* @param $field - an array holding all the field's data
*/
function render_field_settings( $field ) {
// encode choices (convert from array)
@ -490,7 +485,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
*
* @return $field - the modified field
*/
function update_field( $field ) {
// decode choices (convert to array)
@ -520,7 +514,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
*
* @return $value - the modified value
*/
function update_value( $value, $post_id, $field ) {
// Bail early if no value.
@ -549,7 +542,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
* @param $field (array)
* @return $field
*/
function translate_field( $field ) {
// translate

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_separator' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -36,7 +35,6 @@ if ( ! class_exists( 'acf_field_separator' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
/* do nothing */
@ -54,7 +52,6 @@ if ( ! class_exists( 'acf_field_separator' ) ) :
*
* @return $field - the field array holding all the field options
*/
function load_field( $field ) {
// remove name to avoid caching issue

View File

@ -16,7 +16,6 @@ if ( ! class_exists( 'acf_field_tab' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -30,42 +29,45 @@ if ( ! class_exists( 'acf_field_tab' ) ) :
$this->defaults = array(
'placement' => 'top',
'endpoint' => 0, // added in 5.2.8
'selected' => 0, // added in 6.3
);
}
/**
* Create the HTML interface for your field
* Output the HTML required for a tab.
*
* @param $field - an array holding all the field's data
* @since 3.6
*
* @type action
* @since 3.6
* @date 23/01/13
* @param array $field An array of the field data.
*/
function render_field( $field ) {
// vars
public function render_field( $field ) {
$atts = array(
'href' => '',
'class' => 'acf-tab-button',
'data-placement' => $field['placement'],
'data-endpoint' => $field['endpoint'],
'data-key' => $field['key'],
'data-selected' => $field['selected'],
);
if ( isset( $field['unique_tab_key'] ) && ! empty( $field['unique_tab_key'] ) ) {
$atts['data-unique-tab-key'] = $field['unique_tab_key'];
}
if ( isset( $field['settings-type'] ) ) {
$atts['class'] .= ' acf-settings-type-' . acf_slugify( $field['settings-type'] );
$atts['data-settings-type'] = acf_slugify( $field['settings-type'] );
$atts['class'] .= ' acf-settings-type-' . acf_slugify( $field['settings-type'] );
}
if ( isset( $field['class'] ) && ! empty( $field['class'] ) ) {
$atts['class'] .= ' ' . $field['class'];
}
?>
<a <?php echo acf_esc_attrs( $atts ); ?>><?php echo acf_esc_html( $field['label'] ); ?></a>
<a <?php echo acf_esc_attrs( $atts ); ?>><?php echo acf_esc_html( $field['label'] ); ?></a>
<?php
}
/**
* Create extra options for your field. This is rendered when editing a field.
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
@ -76,7 +78,6 @@ if ( ! class_exists( 'acf_field_tab' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field_settings( $field ) {
/*

View File

@ -42,6 +42,7 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
add_action( 'wp_ajax_acf/fields/taxonomy/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/taxonomy/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_acf/fields/taxonomy/add_term', array( $this, 'ajax_add_term' ) );
add_filter( 'acf/conditional_logic/choices', array( $this, 'render_field_taxonomy_conditional_choices' ), 10, 3 );
// actions
add_action( 'acf/save_post', array( $this, 'save_post' ), 15, 1 );
@ -58,7 +59,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function ajax_query() {
// validate
@ -84,32 +84,36 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
* @param $options (array)
* @return (array)
*/
function get_ajax_query( $options = array() ) {
// defaults
$options = acf_parse_args(
$options,
array(
'post_id' => 0,
's' => '',
'field_key' => '',
'paged' => 0,
'term_id' => '',
'include' => '',
'paged' => 1,
)
);
// load field
$field = acf_get_field( $options['field_key'] );
if ( ! $field ) {
return false;
}
// bail early if taxonomy does not exist
// if options include isset, then we are loading a specific term.
if ( ! empty( $options['include'] ) ) {
$options['term_id'] = $options['include'];
// paged should be 1.
$options['paged'] = 1;
}
// Bail early if taxonomy does not exist.
if ( ! taxonomy_exists( $field['taxonomy'] ) ) {
return false;
}
// vars
$results = array();
$is_hierarchical = is_taxonomy_hierarchical( $field['taxonomy'] );
$is_pagination = ( $options['paged'] > 0 );
@ -117,14 +121,12 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
$limit = 20;
$offset = 20 * ( $options['paged'] - 1 );
// args
$args = array(
'taxonomy' => $field['taxonomy'],
'hide_empty' => false,
);
// pagination
// - don't bother for hierarchial terms, we will need to load all terms anyway
// Don't bother for hierarchial terms, we will need to load all terms anyway.
if ( $is_pagination && ! $is_hierarchical ) {
$args['number'] = $limit;
$args['offset'] = $offset;
@ -136,63 +138,57 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// strip slashes (search may be integer)
$s = wp_unslash( strval( $options['s'] ) );
// update vars
$args['search'] = $s;
$args['search'] = isset( $options['term_id'] ) && $options['term_id'] ? '' : $s;
$is_search = true;
}
// filters
$args = apply_filters( 'acf/fields/taxonomy/query', $args, $field, $options['post_id'] );
// get terms
if ( ! empty( $options['include'] ) ) {
// Limit search to a specific id if one is provided.
$args['include'] = $options['include'];
}
$terms = acf_get_terms( $args );
// sort into hierachial order!
// Sort hierachial.
if ( $is_hierarchical ) {
// update vars
$limit = acf_maybe_get( $args, 'number', $limit );
$offset = acf_maybe_get( $args, 'offset', $offset );
// get parent
$parent = acf_maybe_get( $args, 'parent', 0 );
$parent = acf_maybe_get( $args, 'child_of', $parent );
// this will fail if a search has taken place because parents wont exist
// This will fail if a search has taken place because parents wont exist.
if ( ! $is_search ) {
// order terms
$ordered_terms = _get_term_children( $parent, $terms, $field['taxonomy'] );
// check for empty array (possible if parent did not exist within original data)
// Check for empty array. Possible if parent did not exist within original data.
if ( ! empty( $ordered_terms ) ) {
$terms = $ordered_terms;
}
}
// fake pagination
if ( $is_pagination ) {
// Fake pagination.
if ( $is_pagination && ! $options['include'] ) {
$terms = array_slice( $terms, $offset, $limit );
}
}
// append to r
// Append to r.
foreach ( $terms as $term ) {
// add to json
// Add to json.
$results[] = array(
'id' => $term->term_id,
'text' => $this->get_term_title( $term, $field, $options['post_id'] ),
);
}
// vars
$response = array(
'results' => $results,
'limit' => $limit,
);
// return
return $response;
}
@ -238,7 +234,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
* @param $value (array)
* @return $value
*/
function get_terms( $value, $taxonomy = 'category' ) {
// load terms in 1 query to save multiple DB calls from following code
@ -278,7 +273,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
*
* @return $value - the value to be saved in te database
*/
function load_value( $value, $post_id, $field ) {
// get valid terms
@ -430,7 +424,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
// bail early if no value
@ -467,7 +460,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
*
* @param $field - an array holding all the field's data
*/
function render_field( $field ) {
// force value to array
@ -481,7 +473,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
'data-taxonomy' => $field['taxonomy'],
'data-allow_null' => $field['allow_null'],
);
// get taxonomy
$taxonomy = get_taxonomy( $field['taxonomy'] );
@ -528,7 +519,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
*
* @param $field - an array holding all the field's data
*/
function render_field_select( $field ) {
// Change Field into a select
@ -734,16 +724,36 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
}
/**
* description
* Filters choices in taxonomy conditions.
*
* @type function
* @date 17/04/2015
* @since 5.2.3
* @since 6.3
*
* @param $post_id (int)
* @return $post_id (int)
* @param array $choices The selected choice.
* @param array $conditional_field The conditional field settings object.
* @param string $rule_value The rule value.
* @return mixed
*/
public function render_field_taxonomy_conditional_choices( $choices, $conditional_field, $rule_value ) {
if ( is_array( $conditional_field ) && $conditional_field['type'] === 'taxonomy' ) {
if ( ! empty( $rule_value ) ) {
$term = get_term( $rule_value );
$choices = array( $rule_value => $term->name );
}
}
return $choices;
}
/**
* ajax_add_term
*
* @since 5.2.3
*
* @type function
* @date 17/04/2015
*
* @return void
*/
function ajax_add_term() {
// verify nonce

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_text' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -43,7 +42,6 @@ if ( ! class_exists( 'acf_field_text' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
$html = '';

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -43,7 +42,6 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// vars
@ -180,7 +178,6 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
// bail early if no value or not for template

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_time_picker' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -41,7 +40,6 @@ if ( ! class_exists( 'acf_field_time_picker' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// Set value.

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -44,7 +43,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
* @since 3.6
* @date 23/01/13
*/
function render_field( $field ) {
// vars
@ -209,7 +207,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
*
* @return $value (mixed) the modified value
*/
function format_value( $value, $post_id, $field ) {
return empty( $value ) ? false : true;
@ -226,7 +223,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function validate_value( $valid, $value, $field, $input ) {
// bail early if not required
@ -254,7 +250,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
* @param $field (array)
* @return $field
*/
function translate_field( $field ) {
// translate

View File

@ -29,12 +29,41 @@ if ( ! class_exists( 'ACF_Field_User' ) ) :
acf_add_filter_variations( 'acf/fields/user/query', array( 'name', 'key' ), 1 );
acf_add_filter_variations( 'acf/fields/user/result', array( 'name', 'key' ), 2 );
acf_add_filter_variations( 'acf/fields/user/search_columns', array( 'name', 'key' ), 3 );
add_filter( 'acf/conditional_logic/choices', array( $this, 'render_field_user_conditional_choices' ), 10, 3 );
// Add AJAX query.
add_action( 'wp_ajax_acf/fields/user/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/user/query', array( $this, 'ajax_query' ) );
}
/**
* Filters choices in user conditions.
*
* @since 6.3
*
* @param array $choices The selected choice.
* @param array $conditional_field The conditional field settings object.
* @param string $rule_value The rule value.
* @return array
*/
public function render_field_user_conditional_choices( $choices, $conditional_field, $rule_value ) {
if ( ! is_array( $conditional_field ) || $conditional_field['type'] !== 'user' ) {
return $choices;
}
if ( ! empty( $rule_value ) ) {
$user = acf_get_users(
array(
'include' => array( $rule_value ),
)
);
$user_result = acf_get_user_result( $user[0] );
$choices = array( $user_result['id'] => $user_result['text'] );
}
return $choices;
}
/**
* Renders the field settings HTML.
*
@ -165,7 +194,7 @@ if ( ! class_exists( 'ACF_Field_User' ) ) :
}
/**
* Returns the result text for a fiven WP_User object.
* Returns the result text for a given WP_User object.
*
* @date 1/11/2013
* @since 5.0.0
@ -353,7 +382,6 @@ if ( ! class_exists( 'ACF_Field_User' ) ) :
add_filter( 'acf/ajax/query_users/args', array( $this, 'ajax_query_args' ), 10, 3 );
add_filter( 'acf/ajax/query_users/result', array( $this, 'ajax_query_result' ), 10, 3 );
add_filter( 'acf/ajax/query_users/search_columns', array( $this, 'ajax_query_search_columns' ), 10, 4 );
// Simulate AJAX request.
acf_get_instance( 'ACF_Ajax_Query_Users' )->request();
}

View File

@ -15,7 +15,6 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
* @param n/a
* @return n/a
*/
function initialize() {
// vars
@ -54,7 +53,6 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
* @param n/a
* @return n/a
*/
function add_filters() {
// WordPress 5.5 introduced new function for applying image tags.
@ -89,7 +87,6 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
* @param n/a
* @return (array)
*/
function get_toolbars() {
// vars
@ -134,7 +131,6 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
* @param void
* @return void
*/
function acf_enqueue_uploader() {
// vars

View File

@ -24,7 +24,6 @@ if ( ! class_exists( 'acf_form_attachment' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// actions
@ -49,7 +48,6 @@ if ( ! class_exists( 'acf_form_attachment' ) ) :
* @param N/A
* @return N/A
*/
function admin_enqueue_scripts() {
// bail early if not valid screen
@ -81,7 +79,6 @@ if ( ! class_exists( 'acf_form_attachment' ) ) :
* @param n/a
* @return n/a
*/
function admin_footer() {
// render post data
@ -113,7 +110,6 @@ acf.unload.active = 0;
* @param $post_id (int)
* @return $post_id (int)
*/
function edit_attachment( $form_fields, $post ) {
// vars
@ -189,7 +185,6 @@ acf.unload.active = 0;
* @param $post_id (int)
* @return $post_id (int)
*/
function save_attachment( $post, $attachment ) {
// bail early if not valid nonce

View File

@ -24,7 +24,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// actions
@ -51,7 +50,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
* @param n/a
* @return (boolean)
*/
function validate_page() {
// global
@ -78,7 +76,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
* @param n/a
* @return n/a
*/
function admin_enqueue_scripts() {
// validate page
@ -105,7 +102,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
* @param $comment (object)
* @return n/a
*/
function edit_comment( $comment ) {
// vars
@ -177,7 +173,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function comment_form_field_comment( $html ) {
// global
@ -241,7 +236,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
* @param comment_id (int)
* @return n/a
*/
function save_comment( $comment_id ) {
// bail early if not valid nonce
@ -271,7 +265,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function admin_footer() {
?>

View File

@ -19,7 +19,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// vars
@ -48,7 +47,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
* @param N/A
* @return N/A
*/
function customize_controls_init() {
// load acf scripts
@ -76,7 +74,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
* @param $widget (object) widget info
* @return $instance
*/
function save_widget( $instance, $new_instance, $old_instance, $widget ) {
// bail early if not valid (customize + acf values + nonce)
@ -128,7 +125,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
* @param $customizer (object)
* @return $value (mixed)
*/
function settings( $customizer ) {
// vars
@ -188,7 +184,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
* @param $customizer (object)
* @return n/a
*/
function customize_preview_init( $customizer ) {
// get customizer settings (widgets)
@ -231,7 +226,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
* @param type $var Description. Default.
* @return type Description.
*/
function pre_load_value( $value, $post_id, $field ) {
// check
@ -254,7 +248,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
* @param type $var Description. Default.
* @return type Description.
*/
function pre_load_reference( $field_key, $field_name, $post_id ) {
// check
@ -279,7 +272,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
* @param $customizer (object)
* @return n/a
*/
function customize_save( $customizer ) {
// get customizer settings (widgets)
@ -316,7 +308,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function pre_update_option( $value, $option, $old_value ) {
// bail early if no value
@ -352,7 +343,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
* @param n/a
* @return n/a
*/
function admin_footer() {
?>

View File

@ -25,7 +25,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// vars
@ -78,7 +77,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function validate_form( $args ) {
// defaults
@ -154,7 +152,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function add_form( $args = array() ) {
// validate
@ -175,7 +172,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function get_form( $id = '' ) {
// bail early if not set
@ -187,6 +183,9 @@ if ( ! class_exists( 'acf_form_front' ) ) :
return $this->forms[ $id ];
}
function get_forms() {
return $this->forms;
}
/**
* This function will validate fields from the above array
@ -198,7 +197,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function validate_save_post() {
// register field if isset in $_POST
@ -231,7 +229,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function pre_save_post( $post_id, $form ) {
// vars
@ -298,7 +295,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function enqueue_form() {
// check
@ -319,7 +315,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
* @param n/a
* @return n/a
*/
function check_submit_form() {
// Verify nonce.
@ -367,7 +362,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
* @param n/a
* @return n/a
*/
function submit_form( $form ) {
// filter
@ -418,7 +412,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function render_form( $args = array() ) {
// Vars.
@ -581,6 +574,10 @@ function acf_get_form( $id = '' ) {
return acf()->form_front->get_form( $id );
}
function acf_get_forms() {
return acf()->form_front->get_forms();
}
function acf_register_form( $args ) {
acf()->form_front->add_form( $args );

View File

@ -19,7 +19,6 @@ if ( ! class_exists( 'ACF_Form_Gutenberg' ) ) :
* @param void
* @return void
*/
function __construct() {
// Add actions.

View File

@ -18,7 +18,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// actions
@ -44,7 +43,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
* @param N/A
* @return N/A
*/
function admin_enqueue_scripts() {
// validate screen
@ -71,7 +69,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
* @param type $var Description. Default.
* @return type Description.
*/
function wp_nav_menu_item_custom_fields( $item_id, $item, $depth, $args, $id = '' ) {
// vars
@ -136,7 +133,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function update_nav_menu( $menu_id ) {
// vars
@ -168,7 +164,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function update_nav_menu_items( $menu_id ) {
// phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified elsewhere.
@ -198,7 +193,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
* @param type $var Description. Default.
* @return type Description.
*/
function wp_get_nav_menu_items( $items, $menu, $args ) {
acf_set_data( 'nav_menu_id', $menu->term_id );
return $items;
@ -235,7 +229,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
* @param n/a
* @return n/a
*/
function acf_validate_save_post() {
// phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified elsewhere.
@ -266,7 +259,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
* @param n/a
* @return n/a
*/
function admin_footer() {
// vars

View File

@ -26,7 +26,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// actions
@ -51,7 +50,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
* @param n/a
* @return (boolean)
*/
function validate_page() {
// global
@ -78,7 +76,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
* @param N/A
* @return N/A
*/
function admin_enqueue_scripts() {
// validate page
@ -110,7 +107,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function add_term( $taxonomy ) {
// vars
@ -162,7 +158,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function edit_term( $term, $taxonomy ) {
// vars
@ -214,7 +209,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function admin_footer() {
?>
@ -309,7 +303,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function save_term( $term_id, $tt_id, $taxonomy ) {
// vars
@ -338,7 +331,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function delete_term( $term, $tt_id, $taxonomy, $deleted_term ) {
// bail early if termmeta table exists

View File

@ -22,7 +22,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// enqueue
@ -55,7 +54,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
* @param void
* @return void
*/
function admin_enqueue_scripts() {
// bail early if not valid screen
@ -79,7 +77,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
* @param void
* @return void
*/
function login_form_register() {
// customize action prefix so that "admin_head" = "login_head"
@ -101,7 +98,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
* @param void
* @return void
*/
function render_register() {
// render
@ -125,7 +121,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
* @param void
* @return void
*/
function render_edit( $user ) {
// add compatibility with front-end user profile edit forms such as bbPress
@ -154,7 +149,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function render_new() {
// Multisite uses a different 'user-new.php' form. Don't render fields here
@ -184,7 +178,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
* @param $el (string)
* @return n/a
*/
function render( $args = array() ) {
// Allow $_POST data to persist across form submission attempts.
@ -268,7 +261,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function admin_footer() {
// script
@ -301,7 +293,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function save_user( $user_id ) {
// verify nonce

View File

@ -24,7 +24,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// vars
@ -53,7 +52,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
* @param N/A
* @return N/A
*/
function admin_enqueue_scripts() {
// validate screen
@ -109,7 +107,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
* @param $instance (object)
* @return $post_id (int)
*/
function edit_widget( $widget, $return, $instance ) {
// vars
@ -195,7 +192,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
* @param $widget (object) widget info
* @return $instance
*/
function save_widget( $instance, $new_instance, $old_instance, $widget ) {
// validate nonce if we're not a REST API request.
@ -229,7 +225,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
* @param n/a
* @return n/a
*/
function admin_footer() {
?>
<script type="text/javascript">

View File

@ -365,20 +365,16 @@ if ( ! class_exists( 'ACF_Local_JSON' ) ) :
}
/**
* Saves an ACF JSON file.
* Gets the filename for an ACF JSON file.
*
* @date 17/4/20
* @since 5.9.0
* @since 6.3
*
* @param string $key The ACF post key.
* @param array $post The main ACF post array.
* @return boolean
* @return string|boolean
*/
public function save_file( $key, $post ) {
$paths = $this->get_save_paths( $key, $post );
$file = false;
$first_writable = false;
$load_path = '';
public function get_filename( $key, $post ) {
$load_path = '';
if ( is_array( $this->files ) && isset( $this->files[ $key ] ) ) {
$load_path = $this->files[ $key ];
@ -406,6 +402,29 @@ if ( ! class_exists( 'ACF_Local_JSON' ) ) :
return false;
}
return $filename;
}
/**
* Saves an ACF JSON file.
*
* @date 17/4/20
* @since 5.9.0
*
* @param string $key The ACF post key.
* @param array $post The main ACF post array.
* @return boolean
*/
public function save_file( $key, $post ) {
$paths = $this->get_save_paths( $key, $post );
$filename = $this->get_filename( $key, $post );
$file = false;
$first_writable = false;
if ( ! $filename ) {
return false;
}
foreach ( $paths as $path ) {
if ( ! is_writable( $path ) ) { //phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_is_writable -- non-compatible function for this purpose.
continue;
@ -462,12 +481,17 @@ if ( ! class_exists( 'ACF_Local_JSON' ) ) :
* @return boolean
*/
public function delete_file( $key, $post = array() ) {
$paths = $this->get_save_paths( $key, $post );
$paths = $this->get_save_paths( $key, $post );
$filename = $this->get_filename( $key, $post );
if ( ! $filename ) {
return false;
}
foreach ( $paths as $path_to_check ) {
$file = untrailingslashit( $path_to_check ) . '/' . $key . '.json';
$file = untrailingslashit( $path_to_check ) . '/' . $filename;
if ( wp_is_writable( $file ) ) {
if ( is_writable( $file ) ) { //phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_is_writable -- non-compatible function for this purpose.
wp_delete_file( $file );
}
}

View File

@ -19,7 +19,6 @@ if ( ! class_exists( 'acf_loop' ) ) :
* @param n/a
* @return n/a
*/
function __construct() {
// vars
@ -37,7 +36,6 @@ if ( ! class_exists( 'acf_loop' ) ) :
* @param n/a
* @return (boolean)
*/
function is_empty() {
return empty( $this->loops );
@ -54,7 +52,6 @@ if ( ! class_exists( 'acf_loop' ) ) :
* @param $i (int)
* @return (boolean)
*/
function is_loop( $i = 0 ) {
return isset( $this->loops[ $i ] );
@ -71,7 +68,6 @@ if ( ! class_exists( 'acf_loop' ) ) :
* @param $i (mixed)
* @return (int)
*/
function get_i( $i = 0 ) {
// 'active'
@ -104,7 +100,6 @@ if ( ! class_exists( 'acf_loop' ) ) :
* @param $loop (array)
* @return n/a
*/
function add_loop( $loop = array() ) {
// defaults
@ -150,7 +145,6 @@ if ( ! class_exists( 'acf_loop' ) ) :
* @param $value (mixed) the loop setting value
* @return (boolean) true on success
*/
function update_loop( $i = 'active', $key = null, $value = null ) {
// i
@ -180,7 +174,6 @@ if ( ! class_exists( 'acf_loop' ) ) :
* @param $key (string) the loop setting name
* @return (mixed) false on failure
*/
function get_loop( $i = 'active', $key = null ) {
// i
@ -211,7 +204,6 @@ if ( ! class_exists( 'acf_loop' ) ) :
* @param $i (mixed)
* @return (boolean) true on success
*/
function remove_loop( $i = 'active' ) {
// i

View File

@ -233,7 +233,7 @@ if ( ! class_exists( 'ACF_Post_Type' ) ) {
'rename_capabilities' => false,
'singular_capability_name' => 'post',
'plural_capability_name' => 'posts',
'supports' => array( 'title', 'editor', 'thumbnail' ),
'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields' ),
'taxonomies' => array(),
'has_archive' => false,
'has_archive_slug' => '',
@ -481,10 +481,21 @@ if ( ! class_exists( 'ACF_Post_Type' ) ) {
$args['menu_position'] = $menu_position;
}
// WordPress defaults to the same icon as the posts icon.
$menu_icon = (string) $post['menu_icon'];
if ( ! empty( $menu_icon ) ) {
$args['menu_icon'] = $menu_icon;
// Set the default for the icon.
$args['menu_icon'] = 'dashicons-admin-post';
// Override that default if a value is provided.
if ( ! empty( $post['menu_icon'] ) ) {
if ( is_string( $post['menu_icon'] ) ) {
$args['menu_icon'] = $post['menu_icon'];
}
if ( is_array( $post['menu_icon'] ) ) {
if ( $post['menu_icon']['type'] === 'media_library' ) {
$args['menu_icon'] = wp_get_attachment_image_url( $post['menu_icon']['value'] );
} else {
$args['menu_icon'] = $post['menu_icon']['value'];
}
}
}
// WordPress defaults to "post" for `$args['capability_type']`, but can also take an array.

View File

@ -107,6 +107,11 @@ if ( ! class_exists( 'acf_revisions' ) ) :
return;
}
// Bail if this is an autosave in Classic Editor, it already has the field values.
if ( acf_maybe_get_POST( '_acf_changed' ) && wp_is_post_autosave( $revision_id ) ) {
return;
}
// Copy the saved meta from the main post to the latest revision.
acf_save_post_revision( $post_id );
}
@ -123,7 +128,6 @@ if ( ! class_exists( 'acf_revisions' ) ) :
* @param $fields (array)
* @return $fields
*/
function wp_preview_post_fields( $fields ) {
// bail early if not previewing a post
@ -148,12 +152,11 @@ if ( ! class_exists( 'acf_revisions' ) ) :
* @type filter
* @date 19/09/13
*
* @param $return (boolean) defaults to true
* @param $last_revision (object) the last revision that WP will compare against
* @param $post (object) the $post object that WP will compare against
* @return $return (boolean)
* @param boolean $return defaults to true
* @param object $last_revision the last revision that WP will compare against
* @param object $post the $post object that WP will compare against
* @return boolean $return
*/
function wp_save_post_revision_check_for_changes( $return, $last_revision, $post ) {
// if acf has changed, return false and prevent WP from performing 'compare' logic
@ -177,7 +180,6 @@ if ( ! class_exists( 'acf_revisions' ) ) :
* @param $post_id (int)
* @return $post_id (int)
*/
function wp_post_revision_fields( $fields, $post = null ) {
// validate page
@ -284,22 +286,17 @@ if ( ! class_exists( 'acf_revisions' ) ) :
return $fields;
}
/**
* This filter will load the value for the given field and return it for rendering
* Load the value for the given field and return it for rendering.
*
* @type filter
* @date 11/08/13
*
* @param $value (mixed) should be false as it has not yet been loaded
* @param $field_name (string) The name of the field
* @param post (mixed) Holds the $post object to load from - in WP 3.5, this is not passed!
* @param $direction (string) to / from - not used
* @return $value (string)
* @param mixed $value Should be false as it has not yet been loaded.
* @param string $field_name The name of the field
* @param mixed $post Holds the $post object to load from - in WP 3.5, this is not passed!
* @param string $direction To / from - not used.
* @return string $value
*/
function wp_post_revision_field( $value, $field_name, $post = null, $direction = false ) {
// bail early if is empty.
public function wp_post_revision_field( $value, $field_name, $post = null, $direction = false ) {
// Bail early if is empty.
if ( empty( $value ) ) {
return '';
}
@ -326,7 +323,6 @@ if ( ! class_exists( 'acf_revisions' ) ) :
return $value;
}
/**
* This action will copy and paste the metadata from a revision to the post
*
@ -336,7 +332,6 @@ if ( ! class_exists( 'acf_revisions' ) ) :
* @param $parent_id (int) the destination post
* @return $revision_id (int) the source post
*/
function wp_restore_post_revision( $post_id, $revision_id ) {
// copy postmeta from revision to post (restore from revision)
@ -366,7 +361,6 @@ if ( ! class_exists( 'acf_revisions' ) ) :
* @param $_post_id (int)
* @return $post_id (int)
*/
function acf_validate_post_id( $post_id, $_post_id ) {
// phpcs:disable WordPress.Security.NonceVerification.Recommended

Some files were not shown because too many files have changed in this diff Show More