c35162d4 by Jeff Balicki

advanced-custom-fields-pro

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 6b24bcf6
Showing 188 changed files with 442 additions and 251 deletions
......@@ -9,7 +9,7 @@
* Plugin Name: Advanced Custom Fields PRO
* Plugin URI: https://www.advancedcustomfields.com
* Description: Customize WordPress with powerful, professional and intuitive fields.
* Version: 6.1.3
* Version: 6.1.6
* 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
......@@ -34,7 +34,7 @@ if ( ! class_exists( 'ACF' ) ) {
*
* @var string
*/
public $version = '6.1.3';
public $version = '6.1.6';
/**
* The plugin settings array.
......
......@@ -1171,6 +1171,12 @@ html[dir=rtl] .acf-field-object.open > .handle {
width: 18px;
height: 18px;
}
.acf-admin-page .acf-field-setting-type .select2-container.-acf,
.acf-admin-page .acf-field-permalink-rewrite .select2-container.-acf,
.acf-admin-page .acf-field-query-var .select2-container.-acf,
.acf-admin-page .acf-field-meta-box .select2-container.-acf {
min-height: 40px;
}
.acf-admin-page .acf-field-setting-type .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .acf-field-permalink-rewrite .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .acf-field-query-var .select2-container--default .select2-selection--single .select2-selection__rendered,
......@@ -1287,7 +1293,7 @@ html[dir=rtl] .acf-field-object.open > .handle {
.acf-admin-page .field-type-select-results {
position: relative;
top: 4px;
z-index: 600;
z-index: 1002;
border-radius: 0 0 6px 6px;
box-shadow: 0px 8px 24px 4px rgba(16, 24, 40, 0.12);
}
......@@ -1926,11 +1932,11 @@ html[dir=rtl] .acf-field-object.open > .handle {
border-bottom-width: 3px;
}
.acf-field-editor .acf-field-settings-tab-bar {
.acf-admin-page.acf-internal-post-type .acf-field-editor .acf-field-settings-tab-bar {
padding-left: 72px;
}
@media screen and (max-width: 600px) {
.acf-field-editor .acf-field-settings-tab-bar {
.acf-admin-page.acf-internal-post-type .acf-field-editor .acf-field-settings-tab-bar {
padding-left: 12px;
}
}
......@@ -2429,8 +2435,9 @@ html[dir=rtl] .acf-field-object.open > .handle {
min-height: 88px;
margin-right: -24px;
margin-left: -24px;
padding-right: 48px;
padding-left: 48px;
margin-bottom: -24px;
padding-right: 24px;
padding-left: 24px;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #EAECF0;
......
......@@ -2872,6 +2872,12 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
width: 18px;
height: 18px;
}
.acf-admin-page .acf-field-setting-type .select2-container.-acf,
.acf-admin-page .acf-field-permalink-rewrite .select2-container.-acf,
.acf-admin-page .acf-field-query-var .select2-container.-acf,
.acf-admin-page .acf-field-meta-box .select2-container.-acf {
min-height: 40px;
}
.acf-admin-page .acf-field-setting-type .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .acf-field-permalink-rewrite .select2-container--default .select2-selection--single .select2-selection__rendered,
.acf-admin-page .acf-field-query-var .select2-container--default .select2-selection--single .select2-selection__rendered,
......@@ -2988,7 +2994,7 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-admin-page .field-type-select-results {
position: relative;
top: 4px;
z-index: 600;
z-index: 1002;
border-radius: 0 0 6px 6px;
box-shadow: 0px 8px 24px 4px rgba(16, 24, 40, 0.12);
}
......@@ -3224,6 +3230,10 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
font-size: 10px;
color: #475467;
}
.acf-internal-post-type .wp-list-table th .acf-emdash,
.acf-internal-post-type .wp-list-table td .acf-emdash {
color: #D0D5DD;
}
.acf-internal-post-type .wp-list-table thead th, .acf-internal-post-type .wp-list-table thead td,
.acf-internal-post-type .wp-list-table tfoot th, .acf-internal-post-type .wp-list-table tfoot td {
height: 48px;
......@@ -3454,6 +3464,9 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
display: flex;
align-items: center;
}
.acf-internal-post-type .tablenav-pages.no-pages {
display: none;
}
.acf-internal-post-type .tablenav-pages .displaying-num {
margin-top: 0;
margin-right: 16px;
......@@ -3716,10 +3729,9 @@ html[dir=rtl] .acf-table > tbody > tr > td.order + td {
.acf-no-taxonomies .wp-list-table tfoot {
display: none;
}
.acf-no-field-groups .no-pages,
.acf-no-post-types .no-pages,
.acf-no-taxonomies .no-pages {
display: none;
.acf-internal-post-type #the-list .no-items td {
vertical-align: middle;
}
/*---------------------------------------------------------------------------------------------
......
......@@ -668,7 +668,6 @@ html[dir=rtl] input.acf-is-prepended.acf-is-appended {
*
*-----------------------------------------------------------------------------*/
.select2-container.-acf {
min-height: 40px;
z-index: 1001;
/* open */
/* single open */
......@@ -2224,7 +2223,8 @@ html[dir=rtl] .acf-file-uploader .file-info {
}
.acf-range-wrap input[type=number] {
display: inline-block;
min-width: 3em;
min-width: 5em;
padding-right: 4px;
margin-left: 10px;
vertical-align: middle;
}
......
/******/ (() => { // webpackBootstrap
/******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-internal-post-type.js":
/*!*********************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-internal-post-type.js ***!
\*********************************************************************************/
/***/ (() => {
/***/ (function() {
(function ($, undefined) {
/**
......@@ -17,6 +17,7 @@
*/
const internalPostTypeSettingsManager = new acf.Model({
id: 'internalPostTypeSettingsManager',
wait: 'ready',
events: {
'blur .acf_slugify_to_key': 'onChangeSlugify',
'blur .acf_singular_label': 'onChangeSingularLabel',
......@@ -25,20 +26,23 @@
'click .acf-regenerate-labels': 'onClickRegenerateLabels',
'click .acf-clear-labels': 'onClickClearLabels',
'change .rewrite_slug_field': 'onChangeURLSlug',
'keyup .rewrite_slug_field': 'onChangeURLSlug',
ready: 'ready'
'keyup .rewrite_slug_field': 'onChangeURLSlug'
},
onChangeSlugify: function (e, $el) {
const name = $el.val();
const $keyInput = $('.acf_slugified_key');
// render name
// generate field key.
if ($keyInput.val().trim() == '') {
var slug = acf.applyFilters('generate_internal_post_type_name', acf.strSanitize(name), this);
let slug = acf.strSanitize(name.trim()).replaceAll('_', '-');
slug = acf.applyFilters('generate_internal_post_type_name', slug, this);
$keyInput.val(slug.substring(0, 20));
}
},
ready: function () {
initialize: function () {
// check we should init.
if (!['taxonomy', 'post_type'].includes(acf.get('screen'))) return;
// select2
const template = function (selection) {
if ('undefined' === typeof selection.element) {
......@@ -302,49 +306,49 @@
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ !function() {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ function() { return module['default']; } :
/******/ function() { return module; };
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/ }();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ !function() {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
!function() {
"use strict";
/*!********************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/acf-internal-post-type.js ***!
......@@ -353,8 +357,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _acf_internal_post_type_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_acf-internal-post-type.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-internal-post-type.js");
/* harmony import */ var _acf_internal_post_type_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_acf_internal_post_type_js__WEBPACK_IMPORTED_MODULE_0__);
})();
}();
/******/ })()
;
//# sourceMappingURL=acf-internal-post-type.js.map
\ No newline at end of file
......
/******/ (() => { // webpackBootstrap
/******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-hooks.js":
/*!********************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-hooks.js ***!
\********************************************************************/
/***/ (() => {
/***/ (function() {
(function (window, undefined) {
'use strict';
......@@ -249,7 +249,7 @@
/*!********************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-modal.js ***!
\********************************************************************/
/***/ (() => {
/***/ (function() {
(function ($, undefined) {
acf.models.Modal = acf.Model.extend({
......@@ -360,7 +360,7 @@
/*!********************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-model.js ***!
\********************************************************************/
/***/ (() => {
/***/ (function() {
(function ($, undefined) {
// Cached regex to split keys for `addEvent`.
......@@ -1228,7 +1228,7 @@
/*!*********************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-notice.js ***!
\*********************************************************************/
/***/ (() => {
/***/ (function() {
(function ($, undefined) {
var Notice = acf.Model.extend({
......@@ -1375,7 +1375,7 @@
/*!********************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-panel.js ***!
\********************************************************************/
/***/ (() => {
/***/ (function() {
(function ($, undefined) {
var panel = new acf.Model({
......@@ -1409,7 +1409,7 @@
/*!********************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-popup.js ***!
\********************************************************************/
/***/ (() => {
/***/ (function() {
(function ($, undefined) {
acf.models.Popup = acf.Model.extend({
......@@ -1550,7 +1550,7 @@
/*!**********************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-tooltip.js ***!
\**********************************************************************/
/***/ (() => {
/***/ (function() {
(function ($, undefined) {
acf.newTooltip = function (props) {
......@@ -1853,7 +1853,7 @@
/*!**************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/_acf.js ***!
\**************************************************************/
/***/ (() => {
/***/ (function() {
(function ($, undefined) {
/**
......@@ -3193,6 +3193,18 @@
$el2.removeClass('acf-clone');
$el2.find('.ui-sortable').removeClass('ui-sortable');
// remove any initialised select2s prevent the duplicated object stealing the previous select2.
$el2.find('[data-select2-id]').removeAttr('data-select2-id');
$el2.find('.select2').remove();
// subfield select2 renames happen after init and contain a duplicated ID. force change those IDs to prevent this.
$el2.find('.acf-is-subfields select[data-ui="1"]').each(function () {
$(this).prop('id', $(this).prop('id').replace('acf_fields', acf.uniqid('duplicated_') + '_acf_fields'));
});
// remove tab wrapper to ensure proper init
$el2.find('.acf-field-settings > .acf-tab-wrap').remove();
// after
// - allow acf to modify DOM
args.after($el, $el2);
......@@ -4368,49 +4380,49 @@
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ !function() {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ function() { return module['default']; } :
/******/ function() { return module; };
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/ }();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ !function() {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
!function() {
"use strict";
/*!*************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/acf.js ***!
......@@ -4440,8 +4452,7 @@ __webpack_require__.r(__webpack_exports__);
})();
}();
/******/ })()
;
//# sourceMappingURL=acf.js.map
\ No newline at end of file
......
/******/ (() => { // webpackBootstrap
/******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-setting-clone.js":
/*!********************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-setting-clone.js ***!
\********************************************************************************/
/***/ (() => {
/***/ (function() {
(function ($) {
/**
......@@ -152,7 +152,7 @@
/*!*******************************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-setting-flexible-content.js ***!
\*******************************************************************************************/
/***/ (() => {
/***/ (function() {
(function ($) {
/**
......@@ -352,6 +352,11 @@
// wipe field
child.wipe();
// if the child is open, re-fire the open method to ensure it's initialised correctly.
if (child.isOpen()) {
child.open();
}
// update parent
child.updateParent();
});
......@@ -465,7 +470,7 @@
/*!***********************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-setting-repeater.js ***!
\***********************************************************************************/
/***/ (() => {
/***/ (function() {
(function ($) {
/*
......@@ -551,49 +556,49 @@
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ !function() {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ function() { return module['default']; } :
/******/ function() { return module; };
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/ }();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ !function() {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
!function() {
"use strict";
/*!*********************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/pro/acf-pro-field-group.js ***!
......@@ -608,8 +613,7 @@ __webpack_require__.r(__webpack_exports__);
})();
}();
/******/ })()
;
//# sourceMappingURL=acf-pro-field-group.js.map
\ No newline at end of file
......
/******/ (() => { // webpackBootstrap
/******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-field-flexible-content.js":
/*!*****************************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-field-flexible-content.js ***!
\*****************************************************************************************/
/***/ (() => {
/***/ (function() {
(function ($) {
var Field = acf.Field.extend({
......@@ -592,7 +592,7 @@
/*!********************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-field-gallery.js ***!
\********************************************************************************/
/***/ (() => {
/***/ (function() {
(function ($) {
var Field = acf.Field.extend({
......@@ -1157,7 +1157,7 @@
/*!*********************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-field-repeater.js ***!
\*********************************************************************************/
/***/ (() => {
/***/ (function() {
(function ($) {
var Field = acf.Field.extend({
......@@ -1583,7 +1583,7 @@
// vars
var min = this.get('min');
var text = acf.__('Minimum rows reached ({min} rows)');
var text = acf.__('Minimum rows not reached ({min} rows)');
// replace
text = text.replace('{min}', min);
......@@ -2038,49 +2038,49 @@
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ !function() {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ function() { return module['default']; } :
/******/ function() { return module; };
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/ }();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ !function() {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
!function() {
"use strict";
/*!***************************************************************************!*\
!*** ./src/advanced-custom-fields-pro/assets/src/js/pro/acf-pro-input.js ***!
......@@ -2095,8 +2095,7 @@ __webpack_require__.r(__webpack_exports__);
})();
}();
/******/ })()
;
//# sourceMappingURL=acf-pro-input.js.map
\ No newline at end of file
......
......@@ -584,3 +584,39 @@ function acf_add_internal_post_type_validation_error( $name, $message = '' ) {
return acf_add_validation_error( $name, $message );
}
/**
* Gets an ACF post type from request args and verifies nonce based on action.
*
* @since 6.1.5
*
* @param string $action The action being performed.
* @return array|bool
*/
function acf_get_post_type_from_request_args( $action = '' ) {
$acf_use_post_type = acf_request_arg( 'use_post_type', false );
if ( ! $acf_use_post_type || ! wp_verify_nonce( acf_request_arg( '_wpnonce' ), $action . '-' . $acf_use_post_type ) ) {
return false;
}
return acf_get_internal_post_type( (int) $acf_use_post_type, 'acf-post-type' );
}
/**
* Gets an ACF taxonomy from request args and verifies nonce based on action.
*
* @since 6.1.5
*
* @param string $action The action being performed.
* @return array|bool
*/
function acf_get_taxonomy_from_request_args( $action = '' ) {
$acf_use_taxonomy = acf_request_arg( 'use_taxonomy', false );
if ( ! $acf_use_taxonomy || ! wp_verify_nonce( acf_request_arg( '_wpnonce' ), $action . '-' . $acf_use_taxonomy ) ) {
return false;
}
return acf_get_internal_post_type( (int) $acf_use_taxonomy, 'acf-taxonomy' );
}
......
......@@ -117,7 +117,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
}
// Get the current view.
$this->view = isset( $_GET['post_status'] ) ? sanitize_text_field( $_GET['post_status'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$this->view = acf_request_arg( 'post_status', '' );
// Setup and check for custom actions.
$this->setup_sync();
......@@ -222,10 +222,10 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
* @return string
*/
public function admin_body_class( $classes ) {
$classes .= " acf-admin-page acf-internal-post-type {$this->admin_body_class}";
$classes .= ' acf-admin-page acf-internal-post-type ' . esc_attr( $this->admin_body_class );
if ( $this->view ) {
$classes .= " view-{$this->view}";
$classes .= ' view-' . esc_attr( $this->view );
}
return $classes;
......
......@@ -111,8 +111,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
* @return string
*/
public function admin_body_class( $classes ) {
$classes .= " acf-admin-page acf-internal-post-type {$this->admin_body_class}";
return $classes;
return $classes . ' acf-admin-page acf-internal-post-type ' . esc_attr( $this->admin_body_class );
}
/**
......
......@@ -70,7 +70,7 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
* @param string $classes Space-separated list of CSS classes.
* @return string
*/
function admin_body_class( $classes ) {
public function admin_body_class( $classes ) {
global $wp_version;
// Determine body class version.
......@@ -82,7 +82,7 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
}
// Add browser for specific CSS.
$classes .= ' acf-browser-' . acf_get_browser();
$classes .= ' acf-browser-' . esc_attr( acf_get_browser() );
// Return classes.
return $classes;
......
......@@ -127,6 +127,10 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
'fieldCategoriesL10n' => acf_get_field_categories_i18n(),
'PROUpgradeURL' => acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'ACF upgrade', 'field-type-selection' ),
'PROFieldTypes' => acf_get_pro_field_types(),
'PROLocationTypes' => array(
'block' => __( 'Block', 'acf' ),
'options_page' => __( 'Options Page', 'acf' ),
),
)
);
......
......@@ -81,11 +81,12 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
* @return array
*/
public function admin_table_columns( $_columns ) {
// Set the "no found" label to be our custom HTML for no results.
global $wp_post_types;
$this->not_found_label = $wp_post_types['acf-field-group']->labels->not_found;
$wp_post_types['acf-field-group']->labels->not_found = $this->get_not_found_html();
if ( empty( acf_request_arg( 's' ) ) ) {
global $wp_post_types;
$this->not_found_label = $wp_post_types['acf-field-group']->labels->not_found;
$wp_post_types['acf-field-group']->labels->not_found = $this->get_not_found_html();
}
$columns = array(
'cb' => $_columns['cb'],
......@@ -124,8 +125,11 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
// Description.
case 'acf-description':
if ( $post['description'] ) {
if ( is_string( $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>';
echo '<span class="screen-reader-text">' . esc_html__( 'No description', 'acf' ) . '</span>';
}
break;
......@@ -136,7 +140,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
// Count.
case 'acf-count':
echo esc_html( acf_get_field_count( $post ) );
$this->render_admin_table_column_num_fields( $post );
break;
// Local JSON.
......@@ -240,6 +244,36 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
}
/**
* Renders the number of fields created for the field group in the list table.
*
* @since 6.1.5
*
* @param array $field_group The main field group array.
* @return void
*/
public function render_admin_table_column_num_fields( $field_group ) {
$field_count = acf_get_field_count( $field_group );
if ( ! $field_count || ! is_numeric( $field_count ) ) {
echo '<span class="acf-emdash" aria-hidden="true">—</span>';
echo '<span class="screen-reader-text">' . esc_html__( 'No fields', 'acf' ) . '</span>';
return;
}
// If in JSON but not synced or in trash, the link won't work.
if ( empty( $field_group['ID'] ) || 'trash' === get_post_status( $field_group['ID'] ) ) {
echo esc_html( number_format_i18n( $field_count ) );
return;
}
printf(
'<a href="%s">%s</a>',
esc_url( admin_url( 'post.php?action=edit&post=' . $field_group['ID'] ) ),
esc_html( number_format_i18n( $field_count ) )
);
}
/**
* Fires when trashing a field group.
*
* @date 8/01/2014
......
......@@ -82,10 +82,13 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
$item_saved_text = sprintf( __( '%s post type created', 'acf' ), $title );
}
$add_fields_link = wp_nonce_url(
$add_fields_link = wp_nonce_url(
admin_url( 'post-new.php?post_type=acf-field-group&use_post_type=' . $post_id ),
'add-fields-' . $post_id
);
$create_post_type_link = admin_url( 'post-new.php?post_type=acf-post-type' );
$create_taxonomy_link = wp_nonce_url(
admin_url( 'post-new.php?post_type=acf-taxonomy&use_post_type=' . $post_id ),
'create-taxonomy-' . $post_id
......@@ -96,6 +99,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
<div class="acf-item-saved-links">
<a href="<?php echo esc_url( $add_fields_link ); ?>"><?php echo esc_html( $add_fields_text ); ?></a>
<a class="acf-link-field-groups" href="#"><?php esc_html_e( 'Link existing field groups', 'acf' ); ?></a>
<a href="<?php echo esc_url( $create_post_type_link ); ?>"><?php esc_html_e( 'Create new post type', 'acf' ); ?></a>
<a href="<?php echo esc_url( $create_taxonomy_link ); ?>"><?php esc_html_e( 'Create new taxonomy', 'acf' ); ?></a>
</div>
<?php
......
......@@ -90,9 +90,11 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
*/
public function admin_table_columns( $_columns ) {
// Set the "no found" label to be our custom HTML for no results.
global $wp_post_types;
$this->not_found_label = $wp_post_types[ $this->post_type ]->labels->not_found;
$wp_post_types[ $this->post_type ]->labels->not_found = $this->get_not_found_html();
if ( empty( acf_request_arg( 's' ) ) ) {
global $wp_post_types;
$this->not_found_label = $wp_post_types[ $this->post_type ]->labels->not_found;
$wp_post_types[ $this->post_type ]->labels->not_found = $this->get_not_found_html();
}
$columns = array(
'cb' => $_columns['cb'],
......@@ -130,8 +132,11 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
// Description.
case 'acf-description':
if ( $post['description'] ) {
if ( is_string( $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>';
echo '<span class="screen-reader-text">' . esc_html__( 'No description', 'acf' ) . '</span>';
}
break;
......@@ -166,6 +171,8 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
$field_groups = acf_get_field_groups( array( 'post_type' => $post_type['post_type'] ) );
if ( empty( $field_groups ) ) {
echo '<span class="acf-emdash" aria-hidden="true">—</span>';
echo '<span class="screen-reader-text">' . esc_html__( 'No field groups', 'acf' ) . '</span>';
return;
}
......@@ -218,6 +225,12 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
$labels[] = $taxonomy->label;
}
if ( empty( $labels ) ) {
echo '<span class="acf-emdash" aria-hidden="true">—</span>';
echo '<span class="screen-reader-text">' . esc_html__( 'No taxonomies', 'acf' ) . '</span>';
return;
}
$limit = 3;
$shown_labels = array_slice( $labels, 0, $limit );
$hidden_labels = array_slice( $labels, $limit );
......@@ -239,8 +252,12 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
* @return void
*/
public function render_admin_table_column_num_posts( $post_type ) {
$no_posts = '<span class="acf-emdash" aria-hidden="true">—</span>';
$no_posts .= '<span class="screen-reader-text">' . esc_html__( 'No posts', 'acf' ) . '</span>';
// WP doesn't count posts for post types that don't exist.
if ( 'trash' === get_post_status( $post_type['ID'] ) ) {
if ( empty( $post_type['active'] ) || 'trash' === get_post_status( $post_type['ID'] ) ) {
echo acf_esc_html( $no_posts );
return;
}
......@@ -249,11 +266,16 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
$num_posts = $num_posts->publish;
}
if ( ! is_numeric( $num_posts ) ) {
if ( ! $num_posts || ! is_numeric( $num_posts ) ) {
echo acf_esc_html( $no_posts );
return;
}
echo esc_html( number_format_i18n( $num_posts ) );
printf(
'<a href="%s">%s</a>',
esc_url( admin_url( 'edit.php?post_type=' . $post_type['post_type'] ) ),
esc_html( number_format_i18n( $num_posts ) )
);
}
/**
......
......@@ -90,9 +90,11 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
*/
public function admin_table_columns( $_columns ) {
// Set the "no found" label to be our custom HTML for no results.
global $wp_post_types;
$this->not_found_label = $wp_post_types[ $this->post_type ]->labels->not_found;
$wp_post_types[ $this->post_type ]->labels->not_found = $this->get_not_found_html();
if ( empty( acf_request_arg( 's' ) ) ) {
global $wp_post_types;
$this->not_found_label = $wp_post_types[ $this->post_type ]->labels->not_found;
$wp_post_types[ $this->post_type ]->labels->not_found = $this->get_not_found_html();
}
$columns = array(
'cb' => $_columns['cb'],
......@@ -130,8 +132,11 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
// Description.
case 'acf-description':
if ( $post['description'] ) {
if ( is_string( $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>';
echo '<span class="screen-reader-text">' . esc_html__( 'No description', 'acf' ) . '</span>';
}
break;
......@@ -166,6 +171,8 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
$field_groups = acf_get_field_groups( array( 'taxonomy' => $taxonomy['taxonomy'] ) );
if ( empty( $field_groups ) ) {
echo '<span class="acf-emdash" aria-hidden="true">—</span>';
echo '<span class="screen-reader-text">' . esc_html__( 'No field groups', 'acf' ) . '</span>';
return;
}
......@@ -221,6 +228,12 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
}
}
if ( empty( $labels ) ) {
echo '<span class="acf-emdash" aria-hidden="true">—</span>';
echo '<span class="screen-reader-text">' . esc_html__( 'No post types', 'acf' ) . '</span>';
return;
}
$labels = array_unique( $labels );
$limit = 3;
$shown_labels = array_slice( $labels, 0, $limit );
......@@ -243,8 +256,12 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
* @return void
*/
public function render_admin_table_column_num_terms( $taxonomy ) {
$no_terms = '<span class="acf-emdash" aria-hidden="true">—</span>';
$no_terms .= '<span class="screen-reader-text">' . esc_html__( 'No terms', 'acf' ) . '</span>';
// WP doesn't count terms for taxonomies that don't exist and instead returns WP_Error.
if ( 'trash' === get_post_status( $taxonomy['ID'] ) ) {
if ( empty( $taxonomy['active'] ) || 'trash' === get_post_status( $taxonomy['ID'] ) ) {
echo acf_esc_html( $no_terms );
return;
}
......@@ -256,11 +273,16 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
)
);
if ( ! is_numeric( $num_terms ) ) {
if ( ! $num_terms || ! is_numeric( $num_terms ) ) {
echo acf_esc_html( $no_terms );
return;
}
echo esc_html( number_format_i18n( $num_terms ) );
printf(
'<a href="%s">%s</a>',
esc_url( admin_url( 'edit-tags.php?taxonomy=' . $taxonomy['taxonomy'] ) ),
esc_html( number_format_i18n( $num_terms ) )
);
}
/**
......
......@@ -82,10 +82,13 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
$item_saved_text = sprintf( __( '%s taxonomy created', 'acf' ), $title );
}
$add_fields_link = wp_nonce_url(
$add_fields_link = wp_nonce_url(
admin_url( 'post-new.php?post_type=acf-field-group&use_taxonomy=' . $post_id ),
'add-fields-' . $post_id
);
$create_taxonomy_link = admin_url( 'post-new.php?post_type=acf-taxonomy' );
$create_post_type_link = wp_nonce_url(
admin_url( 'post-new.php?post_type=acf-post-type&use_taxonomy=' . $post_id ),
'create-post-type-' . $post_id
......@@ -96,6 +99,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
<div class="acf-item-saved-links">
<a href="<?php echo esc_url( $add_fields_link ); ?>"><?php echo esc_html( $add_fields_text ); ?></a>
<a class="acf-link-field-groups" href="#"><?php esc_html_e( 'Link existing field groups', 'acf' ); ?></a>
<a href="<?php echo esc_url( $create_taxonomy_link ); ?>"><?php esc_html_e( 'Create new taxonomy', 'acf' ); ?></a>
<a href="<?php echo esc_url( $create_post_type_link ); ?>"><?php esc_html_e( 'Create new post type', 'acf' ); ?></a>
</div>
<?php
......
......@@ -415,13 +415,41 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
// Prevent default translation and fake __() within string.
acf_update_setting( 'l10n_var_export', true );
$json = $this->get_selected();
echo '<textarea id="acf-export-textarea" readonly="true">';
$json = $this->get_selected();
$to_export = array();
// Sort by ACF post type first so we can wrap them in related functions.
foreach ( $json as $post ) {
$post_type = acf_determine_internal_post_type( $post['key'] );
echo acf_export_internal_post_type_as_php( $post, $post_type );
if ( $post_type ) {
$to_export[ $post_type ][] = $post;
}
}
echo '<textarea id="acf-export-textarea" readonly="readonly">';
foreach ( $to_export as $post_type => $posts ) {
if ( 'acf-field-group' === $post_type ) {
echo "add_action( 'acf/include_fields', function() {\r\n";
echo "\tif ( ! function_exists( 'acf_add_local_field_group' ) ) {\r\n\t\treturn;\r\n\t}\r\n\r\n";
} elseif ( 'acf-post-type' === $post_type || 'acf-taxonomy' === $post_type ) {
echo "add_action( 'init', function() {\r\n";
}
$count = 0;
foreach ( $posts as $post ) {
if ( $count !== 0 ) {
echo "\r\n";
}
echo "\t" . acf_export_internal_post_type_as_php( $post, $post_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- esc_textarea() used earlier.
$count++;
}
if ( in_array( $post_type, array( 'acf-post-type', 'acf-taxonomy', 'acf-field-group' ), true ) ) {
echo "} );\r\n\r\n";
}
}
echo '</textarea>';
......
......@@ -114,6 +114,10 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
<?php
switch ( $tab_key ) {
case 'general':
$field_type_select_class = 'field-type';
if ( ! apply_filters( 'acf/field_group/enable_field_type_select2', true ) ) {
$field_type_select_class .= ' disable-select2';
}
// type
acf_render_field_setting(
$field,
......@@ -123,7 +127,7 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
'type' => 'select',
'name' => 'type',
'choices' => acf_get_grouped_field_types(),
'class' => 'field-type',
'class' => $field_type_select_class,
),
true
);
......
......@@ -11,7 +11,6 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
// vars
$choices = acf_get_location_rule_types();
// array
if ( is_array( $choices ) ) {
......
......@@ -17,38 +17,31 @@ if ( empty( $field_group['location'] ) ) {
),
);
$acf_use_post_type = acf_request_arg( 'use_post_type', false );
if ( $acf_use_post_type && wp_verify_nonce( acf_request_arg( '_wpnonce' ), 'add-fields-' . $acf_use_post_type ) ) {
$acf_post_type = acf_get_internal_post_type( (int) $acf_use_post_type, 'acf-post-type' );
$acf_use_post_type = acf_get_post_type_from_request_args( 'add-fields' );
$acf_use_taxonomy = acf_get_taxonomy_from_request_args( 'add-fields' );
if ( $acf_post_type && isset( $acf_post_type['post_type'] ) ) {
$field_group['location'] = array(
if ( $acf_use_post_type && ! empty( $acf_use_post_type['post_type'] ) ) {
$field_group['location'] = array(
array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => $acf_post_type['post_type'],
),
'param' => 'post_type',
'operator' => '==',
'value' => $acf_use_post_type['post_type'],
),
);
}
),
);
}
$acf_use_taxonomy = acf_request_arg( 'use_taxonomy', false );
if ( $acf_use_taxonomy && wp_verify_nonce( acf_request_arg( '_wpnonce' ), 'add-fields-' . $acf_use_taxonomy ) ) {
$acf_taxonomy = acf_get_internal_post_type( (int) $acf_use_taxonomy, 'acf-taxonomy' );
if ( $acf_taxonomy && isset( $acf_taxonomy['taxonomy'] ) ) {
$field_group['location'] = array(
if ( $acf_use_taxonomy && ! empty( $acf_use_taxonomy['taxonomy'] ) ) {
$field_group['location'] = array(
array(
array(
array(
'param' => 'taxonomy',
'operator' => '==',
'value' => $acf_taxonomy['taxonomy'],
),
'param' => 'taxonomy',
'operator' => '==',
'value' => $acf_use_taxonomy['taxonomy'],
),
);
}
),
);
}
}
......@@ -248,6 +241,18 @@ foreach ( acf_get_combined_field_group_settings_tabs() as $tab_key => $tab_label
'div',
'field'
);
/* translators: 1: Post creation date 2: Post creation time */
$acf_created_on = sprintf( __( 'Created on %1$s at %2$s', 'acf' ), get_the_date(), get_the_time() );
?>
<div class="acf-field-group-settings-footer">
<span class="acf-created-on"><?php echo esc_html( $acf_created_on ); ?></span>
<a href="<?php echo get_delete_post_link(); ?>" class="acf-btn acf-btn-tertiary acf-delete-field-group">
<i class="acf-icon acf-icon-trash"></i>
<?php esc_html_e( 'Delete Field Group', 'acf' ); ?>
</a>
</div>
<?php
echo '</div>';
break;
default:
......@@ -260,17 +265,7 @@ foreach ( acf_get_combined_field_group_settings_tabs() as $tab_key => $tab_label
// 3rd party settings
do_action( 'acf/render_field_group_settings', $field_group );
/* translators: 1: Post creation date 2: Post creation time */
$acf_created_on = sprintf( __( 'Created on %1$s at %2$s', 'acf' ), get_the_date(), get_the_time() );
?>
<div class="acf-field-group-settings-footer">
<span class="acf-created-on"><?php echo esc_html( $acf_created_on ); ?></span>
<a href="<?php echo get_delete_post_link(); ?>" class="acf-btn acf-btn-tertiary acf-delete-field-group">
<i class="acf-icon acf-icon-trash"></i>
<?php esc_html_e( 'Delete Field Group', 'acf' ); ?>
</a>
</div>
<div class="acf-hidden">
<input type="hidden" name="acf_field_group[key]" value="<?php echo $field_group['key']; ?>" />
......
......@@ -2,16 +2,6 @@
global $acf_post_type;
// Allow preselecting the linked taxonomies based on previously created taxonomy.
$acf_use_taxonomy = acf_request_arg( 'use_taxonomy', false );
if ( $acf_use_taxonomy && wp_verify_nonce( acf_request_arg( '_wpnonce' ), 'create-post-type-' . $acf_use_taxonomy ) ) {
$acf_linked_taxonomy = acf_get_internal_post_type( (int) $acf_use_taxonomy, 'acf-taxonomy' );
if ( $acf_linked_taxonomy && isset( $acf_linked_taxonomy['taxonomy'] ) ) {
$acf_post_type['taxonomies'] = array( $acf_linked_taxonomy['taxonomy'] );
}
}
foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label ) {
acf_render_field_wrap(
array(
......@@ -23,26 +13,6 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
switch ( $tab_key ) {
case 'general':
acf_render_field_wrap(
array(
'type' => 'select',
'name' => 'taxonomies',
'key' => 'taxonomies',
'prefix' => 'acf_post_type',
'value' => $acf_post_type['taxonomies'],
'label' => __( 'Linked Taxonomies', 'acf' ),
'instructions' => __( 'Select existing taxonomies to classify items of the post type.', 'acf' ),
'choices' => acf_get_taxonomy_labels(),
'ui' => true,
'allow_null' => true,
'multiple' => true,
),
'div',
'field'
);
acf_render_field_wrap( array( 'type' => 'seperator' ) );
$acf_available_supports = array(
'title' => __( 'Title', 'acf' ),
'author' => __( 'Author', 'acf' ),
......@@ -1053,7 +1023,7 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
'name' => 'with_front',
'key' => 'with_front',
'prefix' => 'acf_post_type[rewrite]',
'value' => $acf_post_type['rewrite']['with_front'],
'value' => isset( $acf_post_type['rewrite']['with_front'] ) ? $acf_post_type['rewrite']['with_front'] : true,
'label' => __( 'Front URL Prefix', 'acf' ),
'instructions' => __( 'Alters the permalink structure to add the `WP_Rewrite::$front` prefix to URLs.', 'acf' ),
'ui' => true,
......@@ -1072,7 +1042,7 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
'name' => 'feeds',
'key' => 'feeds',
'prefix' => 'acf_post_type[rewrite]',
'value' => $acf_post_type['rewrite']['feeds'],
'value' => isset( $acf_post_type['rewrite']['feeds'] ) ? $acf_post_type['rewrite']['feeds'] : $acf_post_type['has_archive'],
'label' => __( 'Feed URL', 'acf' ),
'instructions' => __( 'RSS feed URL for the post type items.', 'acf' ),
'ui' => true,
......@@ -1090,7 +1060,7 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
'name' => 'pages',
'key' => 'pages',
'prefix' => 'acf_post_type[rewrite]',
'value' => $acf_post_type['rewrite']['pages'],
'value' => isset( $acf_post_type['rewrite']['pages'] ) ? $acf_post_type['rewrite']['pages'] : true,
'label' => __( 'Pagination', 'acf' ),
'instructions' => __( 'Pagination support for the items URLs such as the archives.', 'acf' ),
'ui' => true,
......
......@@ -54,6 +54,30 @@ acf_render_field_wrap(
'field'
);
// Allow preselecting the linked taxonomies based on previously created taxonomy.
$acf_use_taxonomy = acf_get_taxonomy_from_request_args( 'create-post-type' );
if ( $acf_use_taxonomy && ! empty( $acf_use_taxonomy['taxonomy'] ) ) {
$acf_post_type['taxonomies'] = array( $acf_use_taxonomy['taxonomy'] );
}
acf_render_field_wrap(
array(
'type' => 'select',
'name' => 'taxonomies',
'key' => 'taxonomies',
'prefix' => 'acf_post_type',
'value' => $acf_post_type['taxonomies'],
'label' => __( 'Taxonomies', 'acf' ),
'instructions' => __( 'Select existing taxonomies to classify items of the post type.', 'acf' ),
'choices' => acf_get_taxonomy_labels(),
'ui' => true,
'allow_null' => true,
'multiple' => true,
),
'div',
'field'
);
acf_render_field_wrap( array( 'type' => 'seperator' ) );
acf_render_field_wrap(
......
......@@ -56,13 +56,9 @@ acf_render_field_wrap(
);
// Allow preselecting the linked post types based on previously created post type.
$acf_use_post_type = acf_request_arg( 'use_post_type', false );
if ( $acf_use_post_type && wp_verify_nonce( acf_request_arg( '_wpnonce' ), 'create-taxonomy-' . $acf_use_post_type ) ) {
$acf_linked_post_type = acf_get_internal_post_type( (int) $acf_use_post_type, 'acf-post-type' );
if ( $acf_linked_post_type && isset( $acf_linked_post_type['post_type'] ) ) {
$acf_taxonomy['object_type'] = array( $acf_linked_post_type['post_type'] );
}
$acf_use_post_type = acf_get_post_type_from_request_args( 'create-taxonomy' );
if ( $acf_use_post_type && ! empty( $acf_use_post_type['post_type'] ) ) {
$acf_taxonomy['object_type'] = array( $acf_use_post_type['post_type'] );
}
acf_render_field_wrap(
......
<?php
global $title, $post_new_file, $post_type_object, $post;
$acf_title_placeholder = apply_filters( 'enter_title_here', __( 'Add title' ), $post );
$acf_title = $post->post_title;
$acf_post_type = is_object( $post_type_object ) ? $post_type_object->name : '';
$acf_publish_btn_name = 'save';
if ( 'publish' !== $post->post_status ) {
$acf_publish_btn_name = 'publish';
}
if ( 'acf-field-group' === $acf_post_type ) {
$acf_use_post_type = acf_get_post_type_from_request_args( 'add-fields' );
$acf_use_taxonomy = acf_get_taxonomy_from_request_args( 'add-fields' );
/* translators: %s - singular label of post type/taxonomy, i.e. "Movie"/"Genre" */
$acf_prefilled_title = (string) apply_filters( 'acf/field_group/prefill_title', __( '%s fields', 'acf' ) );
if ( $acf_use_post_type && ! empty( $acf_use_post_type['labels']['singular_name'] ) ) {
$acf_prefilled_title = sprintf( $acf_prefilled_title, $acf_use_post_type['labels']['singular_name'] );
} elseif ( $acf_use_taxonomy && ! empty( $acf_use_taxonomy['labels']['singular_name'] ) ) {
$acf_prefilled_title = sprintf( $acf_prefilled_title, $acf_use_taxonomy['labels']['singular_name'] );
} else {
$acf_prefilled_title = false;
}
if ( empty( $acf_title ) && $acf_prefilled_title ) {
$acf_title = $acf_prefilled_title;
}
}
?>
<div class="acf-headerbar acf-headerbar-field-editor">
<div class="acf-headerbar-inner">
......@@ -19,8 +40,8 @@ if ( 'publish' !== $post->post_status ) {
</h1>
<?php if ( 'acf-field-group' === $acf_post_type ) : ?>
<div class="acf-title-wrap">
<label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $acf_title_placeholder; ?></label>
<input form="post" type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" class="acf-headerbar-title-field" spellcheck="true" autocomplete="off" placeholder="<?php esc_attr_e( 'Field Group Title', 'acf' ); ?>" />
<label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo esc_html( $acf_title_placeholder ); ?></label>
<input form="post" type="text" name="post_title" size="30" value="<?php echo esc_attr( $acf_title ); ?>" id="title" class="acf-headerbar-title-field" spellcheck="true" autocomplete="off" placeholder="<?php esc_attr_e( 'Field Group Title', 'acf' ); ?>" />
</div>
<?php endif; ?>
</div>
......
......@@ -852,6 +852,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
}
$str_replace = array(
"\n" => "\n\t",
' ' => "\t",
"'!!__(!!\'" => "__('",
"!!\', !!\'" => "', '",
......
......@@ -461,6 +461,7 @@ function acf_get_pro_field_types() {
'doc_url' => acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/gallery/', 'docs', 'field-type-selection' ),
'preview_image' => acf_get_url() . '/assets/images/field-type-previews/field-preview-gallery.png',
'description' => __( 'This provides an interactive interface for managing a collection of attachments. Most settings are similar to the Image field type. Additional settings allow you to specify where new attachments are added in the gallery and the minimum/maximum number of attachments allowed.', 'acf' ),
'tutorial_url' => acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/how-to-use-the-gallery-field/', 'docs', 'field-type-selection' ),
'category' => 'content',
'pro' => true,
),
......
......@@ -610,10 +610,10 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
*/
public function get_rest_schema( array $field ) {
$schema = array(
'type' => array( 'string', 'array', 'null' ),
'type' => array( 'integer', 'string', 'array', 'null' ),
'required' => isset( $field['required'] ) && $field['required'],
'items' => array(
'type' => 'string',
'type' => array( 'string', 'integer' ),
),
);
......@@ -631,11 +631,17 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
* we should use the keys for the available options to POST to,
* since they are what is displayed in GET requests.
*/
$checkbox_keys = array_diff(
array_keys( $field['choices'] ),
array_values( $field['choices'] )
$checkbox_keys = array_map(
'strval',
array_diff(
array_keys( $field['choices'] ),
array_values( $field['choices'] )
)
);
// Support users passing integers for the keys as well.
$checkbox_keys = array_merge( $checkbox_keys, array_map( 'intval', array_keys( $field['choices'] ) ) );
$schema['items']['enum'] = empty( $checkbox_keys ) ? $field['choices'] : $checkbox_keys;
return $schema;
......
......@@ -121,10 +121,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
$args['post_status'] = acf_get_array( $field['post_status'] );
} else {
$args['post_status'] = 'publish';
}
// create tax queries
......@@ -485,7 +481,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
'multiple' => 1,
'ui' => 1,
'allow_null' => 1,
'placeholder' => __( 'Published', 'acf' ),
'placeholder' => __( 'Any post status', 'acf' ),
)
);
......
......@@ -146,10 +146,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
$args['post_status'] = acf_get_array( $field['post_status'] );
} else {
$args['post_status'] = 'publish';
}
// taxonomy
......@@ -397,7 +393,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
'multiple' => 1,
'ui' => 1,
'allow_null' => 1,
'placeholder' => __( 'Published', 'acf' ),
'placeholder' => __( 'Any post status', 'acf' ),
)
);
......
......@@ -180,10 +180,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
$args['post_status'] = acf_get_array( $field['post_status'] );
} else {
$args['post_status'] = acf_get_post_stati();
}
// taxonomy
......@@ -609,7 +605,7 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
'multiple' => 1,
'ui' => 1,
'allow_null' => 1,
'placeholder' => __( 'Published', 'acf' ),
'placeholder' => __( 'Any post status', 'acf' ),
)
);
......
......@@ -436,16 +436,13 @@ if ( ! class_exists( 'ACF_Field_Group' ) ) {
return $return;
}
$code = var_export( $post, true );
$code = var_export( $post, true ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions -- Used for PHP export.
if ( ! $code ) {
return $return;
}
$code = $this->format_code_for_export( $code );
$return .= "if ( function_exists('acf_add_local_field_group') ):\r\n\r\n";
$return .= "acf_add_local_field_group({$code});\r\n\r\n";
$return .= "endif;\r\n\r\n";
$code = $this->format_code_for_export( $code );
$return .= "acf_add_local_field_group( {$code} );\r\n";
return esc_textarea( $return );
}
......
......@@ -383,7 +383,7 @@ if ( ! class_exists( 'ACF_Post_Type' ) ) {
// WordPress defaults to the opposite of $args['public'].
$exclude_from_search = (bool) $post['exclude_from_search'];
if ( $exclude_from_search !== $args['public'] ) {
if ( $exclude_from_search === $args['public'] ) {
$args['exclude_from_search'] = $exclude_from_search;
}
......@@ -597,7 +597,7 @@ if ( ! class_exists( 'ACF_Post_Type' ) ) {
// Validate and prepare the post for export.
$post = $this->validate_post( $post );
$args = $this->get_post_type_args( $post );
$code = var_export( $args, true );
$code = var_export( $args, true ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions -- Used for PHP export.
if ( ! $code ) {
return $return;
......@@ -605,7 +605,7 @@ if ( ! class_exists( 'ACF_Post_Type' ) ) {
$code = $this->format_code_for_export( $code );
$return .= "register_post_type( '{$post_type_key}', {$code} );\r\n\r\n";
$return .= "register_post_type( '{$post_type_key}', {$code} );\r\n";
return esc_textarea( $return );
}
......
......@@ -487,9 +487,9 @@ if ( ! class_exists( 'ACF_Taxonomy' ) ) {
$post = $this->validate_post( $post );
$taxonomy_key = $post['taxonomy'];
$objects = (array) $post['object_type'];
$objects = var_export( $objects, true );
$objects = var_export( $objects, true ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions -- Used for PHP export.
$args = $this->get_taxonomy_args( $post );
$args = var_export( $args, true );
$args = var_export( $args, true ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions -- Used for PHP export.
if ( ! $args ) {
return $return;
......@@ -498,7 +498,7 @@ if ( ! class_exists( 'ACF_Taxonomy' ) ) {
$args = $this->format_code_for_export( $args );
$objects = $this->format_code_for_export( $objects );
$return .= "register_taxonomy('{$taxonomy_key}', $objects, {$args} );\r\n\r\n";
$return .= "register_taxonomy( '{$taxonomy_key}', {$objects}, {$args} );\r\n";
return esc_textarea( $return );
}
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.