commands
1 year ago
pro
1 year ago
acf-escaped-html-notice.asset.php
1 year ago
acf-escaped-html-notice.js
1 year ago
acf-escaped-html-notice.js.map
1 year ago
acf-escaped-html-notice.min.asset.php
1 year ago
acf-escaped-html-notice.min.js
1 year ago
acf-field-group.asset.php
1 year ago
acf-field-group.js
1 year ago
acf-field-group.js.map
1 year ago
acf-field-group.min.asset.php
1 year ago
acf-field-group.min.js
1 year ago
acf-input.asset.php
1 year ago
acf-input.js
1 year ago
acf-input.js.map
1 year ago
acf-input.min.asset.php
1 year ago
acf-input.min.js
1 year ago
acf-internal-post-type.asset.php
1 year ago
acf-internal-post-type.js
1 year ago
acf-internal-post-type.js.map
1 year ago
acf-internal-post-type.min.asset.php
1 year ago
acf-internal-post-type.min.js
1 year ago
acf.asset.php
1 year ago
acf.js
1 year ago
acf.js.map
1 year ago
acf.min.asset.php
1 year ago
acf.min.js
1 year ago
index.php
1 year ago
scf-bindings.asset.php
1 year ago
scf-bindings.js
1 year ago
scf-bindings.js.map
1 year ago
scf-bindings.min.asset.php
1 year ago
scf-bindings.min.js
1 year ago
scf-bindings.js
205 lines
| 1 | /******/ (() => { // webpackBootstrap |
| 2 | /******/ "use strict"; |
| 3 | /******/ var __webpack_modules__ = ({ |
| 4 | |
| 5 | /***/ "./assets/src/js/bindings/sources.js": |
| 6 | /*!*******************************************!*\ |
| 7 | !*** ./assets/src/js/bindings/sources.js ***! |
| 8 | \*******************************************/ |
| 9 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 10 | |
| 11 | __webpack_require__.r(__webpack_exports__); |
| 12 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 13 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__); |
| 14 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); |
| 15 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); |
| 16 | /* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); |
| 17 | /* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_2__); |
| 18 | /** |
| 19 | * WordPress dependencies. |
| 20 | */ |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | /** |
| 26 | * Get the value of a specific field from the ACF fields. |
| 27 | * |
| 28 | * @param {Object} fields The ACF fields object. |
| 29 | * @param {string} fieldName The name of the field to retrieve. |
| 30 | * @returns {string} The value of the specified field, or undefined if not found. |
| 31 | */ |
| 32 | const getFieldValue = (fields, fieldName) => fields?.acf?.[fieldName]; |
| 33 | const resolveImageAttribute = (imageObj, attribute) => { |
| 34 | if (!imageObj) return ''; |
| 35 | switch (attribute) { |
| 36 | case 'url': |
| 37 | case 'content': |
| 38 | return imageObj.source_url; |
| 39 | case 'alt': |
| 40 | return imageObj.alt_text || ''; |
| 41 | case 'title': |
| 42 | return imageObj.title?.rendered || ''; |
| 43 | default: |
| 44 | return ''; |
| 45 | } |
| 46 | }; |
| 47 | (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockBindingsSource)({ |
| 48 | name: 'acf/field', |
| 49 | label: 'SCF Fields', |
| 50 | getValues({ |
| 51 | context, |
| 52 | bindings, |
| 53 | select |
| 54 | }) { |
| 55 | const { |
| 56 | getEditedEntityRecord, |
| 57 | getMedia |
| 58 | } = select(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_2__.store); |
| 59 | let fields = context?.postType && context?.postId ? getEditedEntityRecord('postType', context.postType, context.postId) : undefined; |
| 60 | const result = {}; |
| 61 | Object.entries(bindings).forEach(([attribute, { |
| 62 | args |
| 63 | } = {}]) => { |
| 64 | const fieldName = args?.key; |
| 65 | const fieldValue = getFieldValue(fields, fieldName); |
| 66 | if (typeof fieldValue === 'object' && fieldValue !== null) { |
| 67 | let value = ''; |
| 68 | if (fieldValue[attribute]) { |
| 69 | value = fieldValue[attribute]; |
| 70 | } else if (attribute === 'content' && fieldValue.url) { |
| 71 | value = fieldValue.url; |
| 72 | } |
| 73 | result[attribute] = value; |
| 74 | } else if (typeof fieldValue === 'number') { |
| 75 | if (attribute === 'content') { |
| 76 | result[attribute] = fieldValue.toString() || ''; |
| 77 | } else { |
| 78 | const imageObj = getMedia(fieldValue); |
| 79 | result[attribute] = resolveImageAttribute(imageObj, attribute); |
| 80 | } |
| 81 | } else { |
| 82 | result[attribute] = fieldValue || ''; |
| 83 | } |
| 84 | }); |
| 85 | return result; |
| 86 | }, |
| 87 | canUserEditValue() { |
| 88 | return false; |
| 89 | } |
| 90 | }); |
| 91 | |
| 92 | /***/ }), |
| 93 | |
| 94 | /***/ "@wordpress/blocks": |
| 95 | /*!********************************!*\ |
| 96 | !*** external ["wp","blocks"] ***! |
| 97 | \********************************/ |
| 98 | /***/ ((module) => { |
| 99 | |
| 100 | module.exports = window["wp"]["blocks"]; |
| 101 | |
| 102 | /***/ }), |
| 103 | |
| 104 | /***/ "@wordpress/core-data": |
| 105 | /*!**********************************!*\ |
| 106 | !*** external ["wp","coreData"] ***! |
| 107 | \**********************************/ |
| 108 | /***/ ((module) => { |
| 109 | |
| 110 | module.exports = window["wp"]["coreData"]; |
| 111 | |
| 112 | /***/ }), |
| 113 | |
| 114 | /***/ "@wordpress/i18n": |
| 115 | /*!******************************!*\ |
| 116 | !*** external ["wp","i18n"] ***! |
| 117 | \******************************/ |
| 118 | /***/ ((module) => { |
| 119 | |
| 120 | module.exports = window["wp"]["i18n"]; |
| 121 | |
| 122 | /***/ }) |
| 123 | |
| 124 | /******/ }); |
| 125 | /************************************************************************/ |
| 126 | /******/ // The module cache |
| 127 | /******/ var __webpack_module_cache__ = {}; |
| 128 | /******/ |
| 129 | /******/ // The require function |
| 130 | /******/ function __webpack_require__(moduleId) { |
| 131 | /******/ // Check if module is in cache |
| 132 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 133 | /******/ if (cachedModule !== undefined) { |
| 134 | /******/ return cachedModule.exports; |
| 135 | /******/ } |
| 136 | /******/ // Create a new module (and put it into the cache) |
| 137 | /******/ var module = __webpack_module_cache__[moduleId] = { |
| 138 | /******/ // no module.id needed |
| 139 | /******/ // no module.loaded needed |
| 140 | /******/ exports: {} |
| 141 | /******/ }; |
| 142 | /******/ |
| 143 | /******/ // Execute the module function |
| 144 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 145 | /******/ |
| 146 | /******/ // Return the exports of the module |
| 147 | /******/ return module.exports; |
| 148 | /******/ } |
| 149 | /******/ |
| 150 | /************************************************************************/ |
| 151 | /******/ /* webpack/runtime/compat get default export */ |
| 152 | /******/ (() => { |
| 153 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 154 | /******/ __webpack_require__.n = (module) => { |
| 155 | /******/ var getter = module && module.__esModule ? |
| 156 | /******/ () => (module['default']) : |
| 157 | /******/ () => (module); |
| 158 | /******/ __webpack_require__.d(getter, { a: getter }); |
| 159 | /******/ return getter; |
| 160 | /******/ }; |
| 161 | /******/ })(); |
| 162 | /******/ |
| 163 | /******/ /* webpack/runtime/define property getters */ |
| 164 | /******/ (() => { |
| 165 | /******/ // define getter functions for harmony exports |
| 166 | /******/ __webpack_require__.d = (exports, definition) => { |
| 167 | /******/ for(var key in definition) { |
| 168 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 169 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 170 | /******/ } |
| 171 | /******/ } |
| 172 | /******/ }; |
| 173 | /******/ })(); |
| 174 | /******/ |
| 175 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 176 | /******/ (() => { |
| 177 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
| 178 | /******/ })(); |
| 179 | /******/ |
| 180 | /******/ /* webpack/runtime/make namespace object */ |
| 181 | /******/ (() => { |
| 182 | /******/ // define __esModule on exports |
| 183 | /******/ __webpack_require__.r = (exports) => { |
| 184 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 185 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 186 | /******/ } |
| 187 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 188 | /******/ }; |
| 189 | /******/ })(); |
| 190 | /******/ |
| 191 | /************************************************************************/ |
| 192 | var __webpack_exports__ = {}; |
| 193 | // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. |
| 194 | (() => { |
| 195 | /*!*****************************************!*\ |
| 196 | !*** ./assets/src/js/bindings/index.js ***! |
| 197 | \*****************************************/ |
| 198 | __webpack_require__.r(__webpack_exports__); |
| 199 | /* harmony import */ var _sources_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sources.js */ "./assets/src/js/bindings/sources.js"); |
| 200 | |
| 201 | })(); |
| 202 | |
| 203 | /******/ })() |
| 204 | ; |
| 205 | //# sourceMappingURL=scf-bindings.js.map |