diff --git a/additional-block-attributes.php b/additional-block-attributes.php index c8dd305..0cecd27 100644 --- a/additional-block-attributes.php +++ b/additional-block-attributes.php @@ -68,6 +68,18 @@ public function add_attributes( $block ) { $block->add_attribute( 'data-update-field-is-empty', 'true' ); } + if ( ! empty( $attrs['jfb_update_fields_cache_enabled'] ) && ! empty( $attrs['jfb_update_fields_cache_timeout'] ) ) { + $block->add_attribute( 'data-update-cache-timeout', $attrs['jfb_update_fields_cache_timeout'] ); + } + + $cache_timeout = $attrs['jfb_update_fields_cache_timeout'] ?? 60; + + if ( isset( $attrs['jfb_update_fields_cache_enabled'] ) && $attrs['jfb_update_fields_cache_enabled'] === false ) { + $cache_timeout = 0; + } + + $block->add_attribute( 'data-update-cache-timeout', $cache_timeout ); + if ( ! $this->script_enqueued ) { $this->enqueue_script(); $this->script_enqueued = true; diff --git a/assets/js/blocks.js b/assets/js/blocks.js index af0ee86..b387981 100644 --- a/assets/js/blocks.js +++ b/assets/js/blocks.js @@ -1 +1 @@ -(()=>{"use strict";var e="jfb_update_fields_options_enabled",t="jfb_update_fields_value_enabled",n="jfb_update_fields_update_on_button",r="jfb_update_fields_button_name",l="jfb_update_fields_field_to_listen",o="jfb_update_fields_callback",a="jfb_update_fields_listen_all",i={"jet-forms/select-field":"options","jet-forms/radio-field":"options","jet-forms/checkbox-field":"options","jet-forms/text-field":"value","jet-forms/number-field":"value","jet-forms/textarea-field":"value","jet-forms/hidden-field":"value","jet-forms/submit-field":"update_other"};function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t{"use strict";var e="jfb_update_fields_options_enabled",t="jfb_update_fields_value_enabled",n="jfb_update_fields_update_on_button",l="jfb_update_fields_button_name",r="jfb_update_fields_field_to_listen",o="jfb_update_fields_callback",a="jfb_update_fields_listen_all",i="jfb_update_fields_cache_enabled",u="jfb_update_fields_cache_timeout",c={"jet-forms/select-field":"options","jet-forms/radio-field":"options","jet-forms/checkbox-field":"options","jet-forms/text-field":"value","jet-forms/number-field":"value","jet-forms/textarea-field":"value","jet-forms/hidden-field":"value","jet-forms/submit-field":"update_other"};function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function f(e){for(var t=1;t { /> } + { ( attributes[ OPTIONS_LISTENER_ENABLED ] || attributes[ VALUE_LISTENER_ENABLED ] ) && + + { + setAttributes( { [ CACHE_ENABLED ] : ! attributes[ CACHE_ENABLED ] } ); + } } + /> + + } + { ( attributes[ OPTIONS_LISTENER_ENABLED ] || attributes[ VALUE_LISTENER_ENABLED ] ) && attributes[ CACHE_ENABLED ] && + + { + setAttributes( { [ CACHE_TIMEOUT ] : newValue } ); + } } + /> + + } } diff --git a/jet-form-builder-update-field.php b/jet-form-builder-update-field.php index 2927b7a..3f9d848 100644 --- a/jet-form-builder-update-field.php +++ b/jet-form-builder-update-field.php @@ -3,7 +3,7 @@ * Plugin Name: JetFormBuilder - Update Fields * Plugin URI: * Description: - * Version: 1.0.1 + * Version: 1.1.1 * Author: * Author URI: * Text Domain: @@ -33,7 +33,7 @@ class Plugin { public $storage = null; - private $version = '1.1.0'; + private $version = '1.1.1'; public function __construct() { add_action( 'plugins_loaded', array( $this, 'jec_init' ) );