PluginProbe
Repeater Fields for Gravity Forms / 3.2.2
Repeater Fields for Gravity Forms v3.2.2
3.2.2 3.2.1 3.2.0 3.1.1 3.1.0 3.0.4 3.0.3 3.0.2 3.0.1 3.0.0 2.5.1 2.5.0 2.4.6 trunk 2.0.5 2.0.9 2.1.0 2.3.2 2.3.7 2.4.1 2.4.3 2.4.4 2.4.5
← All changes | add_on.php +28 -3 2.4.4 → 3.2.2 View file →
@@ -71,8 +71,11 @@
71 71 add_action( 'gform_editor_js', array($this,'editor_script') );
72 72 include SUPERADDONS_GF_REPEATER_PLUGIN_PATH."fields/repeater_field.php";
73 73 include SUPERADDONS_GF_REPEATER_PLUGIN_PATH."fields/repeater_start_field.php";
74 74 add_filter( 'gform_pre_validation', array( "Superaddons_GFRepeater_Field", 'remove_validation' ) );
75 + add_filter( 'gform_admin_pre_render', array( 'Superaddons_GFRepeater_Field', 'remove_child_fields' ) );
76 + add_filter( 'gform_form_post_get_meta', array( 'Superaddons_GFRepeater_Field', 'remove_child_fields' ) );
77 + add_filter( 'gform_submission_values_pre_save', array( 'Superaddons_GFRepeater_Field', 'save_draft_submission_values' ), 10, 2 );
75 78 add_action( 'gform_enqueue_scripts', array($this,"add_data"),10,2 );
76 79 }
77 80 function gform_input_mask_script($script_str,$form_id,$field_id,$mask){
78 81 $input_mask = get_option( "yeeaddons_gf_input_mask",array());
@@ -81,11 +84,33 @@
81 84 return $script_str;
82 85 }
83 86 function add_data($form, $is_ajax ){
84 87 $input_mask = get_option( "yeeaddons_gf_input_mask",array());
85 - wp_enqueue_script( 'gf_repeater', SUPERADDONS_GF_REPEATER_PLUGIN_URL."libs/wp_repeater.js", array('jquery',"gform_masked_input"),time());
86 - $check_pro = get_option( '_redmuber_item_1540');
87 - wp_localize_script("gf_repeater","yeeaddons_gf_repeater_data",array("input_mask"=>($input_mask),"pro"=>$check_pro));
88 + if ( isset( $form['fields'] ) && is_array( $form['fields'] ) ) {
89 + foreach ( $form['fields'] as $field ) {
90 + // 1. Các trường Text / Field thường tick "Input Mask"
91 + if ( ! empty( $field->inputMask ) && ! empty( $field->inputMaskValue ) ) {
92 + $input_mask["input_" . $form['id'] . "_" . $field->id] = (string) $field->inputMaskValue;
93 + }
94 + // 2. Các trường Phone
95 + if ( isset( $field->type ) && $field->type === 'phone' ) {
96 + $phone_format = method_exists( $field, 'get_phone_format' ) ? $field->get_phone_format() : array();
97 + $mask = isset( $phone_format['mask'] ) ? $phone_format['mask'] : '';
98 + if ( empty( $mask ) && ( ! isset( $field->phoneFormat ) || $field->phoneFormat === 'standard' || empty( $field->phoneFormat ) ) ) {
99 + $mask = '(999) 999-9999';
100 + }
101 + if ( ! empty( $mask ) ) {
102 + $input_mask["input_" . $form['id'] . "_" . $field->id] = (string) $mask;
103 + }
104 + }
105 + }
106 + }
107 + if ( ! wp_script_is( 'gform_masked_input', 'registered' ) ) {
108 + wp_register_script( 'gform_masked_input', SUPERADDONS_GF_REPEATER_PLUGIN_URL . 'libs/jquery.maskedinput.min.js', array( 'jquery' ), '1.3.1', true );
109 + }
110 + wp_enqueue_script( 'gf_repeater', SUPERADDONS_GF_REPEATER_PLUGIN_URL . "libs/wp_repeater.js", array( 'jquery', 'gform_masked_input' ), time() );
111 + $check_pro = get_option( '_redmuber_item_1540' );
112 + wp_localize_script( "gf_repeater", "yeeaddons_gf_repeater_data", array( "input_mask" => ( $input_mask ), "pro" => $check_pro ) );
88 113 }
89 114 public function styles() {
90 115 $styles = array(
91 116 array(