Changeset 1965853
- Timestamp:
- 10/30/2018 01:27:17 PM (7 years ago)
- Location:
- gf-fields-persistence/trunk
- Files:
-
- 5 edited
-
assets/js/gf-field-persistence.js (modified) (2 diffs)
-
classes/class-admin.php (modified) (2 diffs)
-
classes/class-persistence.php (modified) (3 diffs)
-
gravityforms-fields-persistence.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gf-fields-persistence/trunk/assets/js/gf-field-persistence.js
r1955348 r1965853 12 12 // Read data on page load and prefill the form. 13 13 $formWrapper.each(function () { 14 rcgfp.post_render($(this)); 14 var $form = $(this); 15 var formId = $form.attr('id').replace('gform_wrapper_', ''); 16 17 if( $.inArray( formId, rcgfp_data.exclude_forms ) >= -1 ) { 18 rcgfp.post_render($form); 19 } 15 20 }); 16 21 … … 20 25 var $this = $(this); 21 26 var $form = $this.parents('form'); 27 var formId = $(this).attr('id').replace('gform_wrapper_', ''); 22 28 var dataToSave = []; 29 30 if( $.inArray( formId, rcgfp_data.exclude_forms ) >= -1 ) { 31 return true; 32 } 23 33 24 34 $('[data-inputname]', $form).each(function () { -
gf-fields-persistence/trunk/classes/class-admin.php
r1949566 r1965853 53 53 add_settings_section( 54 54 'general_section', 55 __( 'Exclude variables', $this->textdomain ),55 __( 'Exclude options', $this->textdomain ), 56 56 function () { 57 echo '<div class="description">' . __( 'In this section s you can addvariable names, which should be excluded from persistence. ', $this->textdomain ) . '</div>';57 echo '<div class="description">' . __( 'In this section you can enter complete forms or specific variable names, which should be excluded from persistence. ', $this->textdomain ) . '</div>'; 58 58 }, 59 59 self::$option_name 60 ); 61 62 add_settings_field( 63 'excluded_forms', 64 __( 'Exclude forms', $this->textdomain ), 65 array( $this, 'add_field_exclude_forms' ), 66 self::$option_name, 67 'general_section' 60 68 ); 61 69 … … 74 82 echo '<input type="text" name="' . self::$option_name . '[exclude_variables]" id="' . self::$option_name . '-exclude_variables" class="regular-text" value="' . $exclude_variables . '">'; 75 83 echo '<br><small>' . __( 'Enter, comma-separated, the names of the variables you want to exclude.', $this->textdomain ) . '</small>'; 84 } 85 86 public function add_field_exclude_forms() { 87 if( ! class_exists( 'RGFormsModel' ) ) { 88 return false; 89 } 90 91 $exclude_forms = self::get_option( 'exclude_forms' ); 92 $forms = \RGFormsModel::get_forms( $active, 'title' ); 93 94 echo '<pre>'; 95 print_r( $exclude_forms ); 96 echo'</pre>'; 97 98 echo '<select name="' . self::$option_name . '[exclude_forms][]" id="' . self::$option_name . '-exclude_forms" class="regular-text widefat" multiple>'; 99 foreach ( $forms as $form ) { 100 echo '<option value="' . esc_attr( $form->id ) . '" ' . ( in_array( $form->id, $exclude_forms ) ? ' selected="selected"' : '' ) . '>' . esc_html( $form->title ) . '</option>'; 101 } 102 echo '</select>'; 76 103 } 77 104 -
gf-fields-persistence/trunk/classes/class-persistence.php
r1955348 r1965853 6 6 7 7 private static $instance; 8 private $_version = '1.0. 7';8 private $_version = '1.0.8'; 9 9 private $load_js_in_footer = true; 10 10 … … 38 38 public function enqueue_scripts() { 39 39 // Get options to include in JS. 40 $exclude_forms = Admin::get_option( 'exclude_forms' ); 40 41 $exclude_variables = Admin::get_option( 'exclude_variables' ); 41 42 if( ! empty( $exclude_variables ) ) { … … 46 47 wp_enqueue_script( 'rcgfp_script', RCGFP_PLUGIN_URI . 'assets/js/gf-field-persistence.js', array( 'jquery' ), $this->_version, $this->load_js_in_footer ); 47 48 wp_localize_script( 'rcgfp_script', 'rcgfp_data', array( 49 'exclude_forms' => $exclude_forms, 48 50 'exclude_variables' => $exclude_variables, 49 51 ) ); -
gf-fields-persistence/trunk/gravityforms-fields-persistence.php
r1955348 r1965853 4 4 Plugin URI: https://github.com/radishconcepts/gravityforms-field-persistence/ 5 5 Description: Adds persistence to the Gravity Forms fields, so inputs will be saved in order to use it in other forms. This will improve user experience and boost your goals! 6 Version: 1.0. 76 Version: 1.0.8 7 7 Author: Radish Concepts <info@radishconcepts.com> 8 8 Author URI: https://www.radishconcepts.com -
gf-fields-persistence/trunk/readme.txt
r1955348 r1965853 28 28 == Changelog == 29 29 30 = 1.0.8 = 31 * Add option to exclude complete forms from persistance. 32 30 33 = 1.0.7 = 31 34 * Cookie name change.
Note: See TracChangeset
for help on using the changeset viewer.