Skip to content

Commit b670f80

Browse files
committed
Formatting: PHPCS fixes.
1 parent 531d7b2 commit b670f80

17 files changed

+74
-73
lines changed

experimental/gpnf-parent-form-field-values-in-child-form-filters.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*
66
* This demonstrates a proof-of-concept for storing and retrieving parent form field values for use in the
77
* `gform_pre_render` filter when modifying the child form.
8-
*
8+
*
99
* NOTE: The parent form must not have AJAX-enabled for this snippet to work.
1010
*/
1111
// Update "123" to your parent form ID.
1212
add_filter( 'gpnf_init_script_args_123', function( $args ) {
1313
if ( ! empty( $_POST ) ) {
14-
// Update "1", "2", and "3" to the field IDs of parent form fields for which you would like to store the value.
15-
$keys = array( 'input_1', 'input_2', 'input_3' );
14+
// Update "1", "2", and "3" to the field IDs of parent form fields for which you would like to store the value.
15+
$keys = array( 'input_1', 'input_2', 'input_3' );
1616
$args['ajaxContext']['parent_form_values'] = array_intersect_key( $_POST, array_flip( $keys ) );
1717
}
1818
return $args;
@@ -22,8 +22,8 @@
2222
add_filter( 'gform_pre_render_124', function ( $form ) {
2323
if ( in_array( rgar( $_REQUEST, 'action' ), array( 'gpnf_refresh_markup', 'gpnf_edit_entry' ) ) ) {
2424
$parent_form_values = $_REQUEST['gpnf_context']['parent_form_values'];
25-
// Update "3" to the ID of the parent form field for which you would like to fetch the stored value.
26-
$field_value = rgar( $parent_form_values, 'input_3' );
25+
// Update "3" to the ID of the parent form field for which you would like to fetch the stored value.
26+
$field_value = rgar( $parent_form_values, 'input_3' );
2727
}
2828
return $form;
2929
} );

gp-advanced-phone-field/gpapf-validation-only.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,42 @@
1111

1212
/**
1313
* Enable GPAPF for all Phone fields during validation to allow GPAPF to handle validating the phone number's validity
14-
* without interfering with the Phone field's default UX.
14+
* without interfering with the Phone field's default UX.
1515
*/
1616
add_filter( 'gform_field_validation', function( $result, $value, $form, $field ) {
1717
if ( $field->get_input_type() === 'phone'
18-
&& $field->phoneFormat === 'standard'
19-
&& ! $field->gpapfEnable
20-
&& ! rgblank( $value )
18+
&& $field->phoneFormat === 'standard'
19+
&& ! $field->gpapfEnable
20+
&& ! rgblank( $value )
2121
) {
2222
$cloned_field = clone $field;
2323
$cloned_field->gpapfEnable = true;
2424
$parsed_phone_number = '+1' . preg_replace( '/[^0-9]/', '', $value );
2525
$result = gp_advanced_phone_field()->validation( $result, $parsed_phone_number, $form, $cloned_field );
26-
}
26+
}
2727
return $result;
2828
}, 10, 4 );
2929

3030
/**
3131
* Remove the format-specific validation message that is added by Gravity Forms when a Phone field is marked as having
32-
* failed validation. See the more detailed comment above the setting of the `origPhoneFormat` property above.
32+
* failed validation. See the more detailed comment above the setting of the `origPhoneFormat` property above.
3333
*/
34-
add_filter( 'gform_field_content', function( $content, $field ) {
34+
add_filter( 'gform_field_content', function( $content, $field ) {
3535

36-
if ( $field->is_form_editor() || $field->get_input_type() !== 'phone' || $field->phoneFormat !== 'standard' || $field->gpapfEnable ) {
37-
return $content;
38-
}
36+
if ( $field->is_form_editor() || $field->get_input_type() !== 'phone' || $field->phoneFormat !== 'standard' || $field->gpapfEnable ) {
37+
return $content;
38+
}
3939

40-
$dom = new DOMDocument();
41-
$dom->loadHTML( $content );
40+
$dom = new DOMDocument();
41+
$dom->loadHTML( $content );
4242

43-
foreach ( $dom->getElementsByTagName( 'div' ) as $div ) {
44-
if ( strpos( $div->nodeValue, 'Phone format:' ) === 0 && in_array( 'instruction', explode( ' ', $div->getAttribute( 'class' ) ) ) ) {
45-
$div->parentNode->removeChild( $div );
46-
}
47-
}
43+
foreach ( $dom->getElementsByTagName( 'div' ) as $div ) {
44+
if ( strpos( $div->nodeValue, 'Phone format:' ) === 0 && in_array( 'instruction', explode( ' ', $div->getAttribute( 'class' ) ) ) ) {
45+
$div->parentNode->removeChild( $div );
46+
}
47+
}
4848

49-
return $dom->saveHTML();
50-
}, 10, 2 );
49+
return $dom->saveHTML();
50+
}, 10, 2 );
5151

5252
} );

gp-advanced-select/gpadvs-position-dropdown-statically.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
* https://gravitywiz.com/documentation/gravity-forms-advanced-select/
44
*
55
* If your form container is configured to hide overflowing content and your Advanced-Select-enabled field
6-
* is near the bottom of the form, the dropdown can be cutoff when the field is selected.
7-
*
6+
* is near the bottom of the form, the dropdown can be cutoff when the field is selected.
7+
*
88
* This snippet positions the dropdown statically (default is absolute) so that it pushes the form content
99
* down instead of floating above it.
1010
*
1111
* Instructions:
1212
*
1313
* 1. Include this CSS snippet in your theme's stylesheet or wherever you include custom CSS code.
14-
* 2. Add the "gpadvs-static" class to the Custom CSS Class field setting to enable this for a field.
14+
* 2. Add the "gpadvs-static" class to the Custom CSS Class field setting to enable this for a field.
1515
*/
1616
.gpadvs-static .ts-wrapper {
17-
flex-wrap: wrap;
17+
flex-wrap: wrap;
1818
}
1919

2020
.gpadvs-static .ts-dropdown {
21-
position: static !important;
22-
transform: none !important;
21+
position: static !important;
22+
transform: none !important;
2323
}

gp-easy-passthrough/gpep-update-other-form-entry-by-ep-token.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
/**
33
* Gravity Perks // Easy Passthrough // Update Other Entry on Submission
44
* https://gravitywiz.com/documentation/gravity-forms-easy-passthrough/
5-
*
5+
*
66
* Instruction Video: https://www.loom.com/share/65fad5b264e640ab94dca058d6ba83f4
7-
*
7+
*
88
* Update a field value of an entry on Form A when Form B is submitted based on populated
99
* Easy Passthrough token.
1010
*
@@ -20,10 +20,10 @@
2020
* Instructions
2121
*
2222
* 1. Add a Hidden field to Form B that will be used to capture an Easy Passthrough token.
23-
*
23+
*
2424
* 2. Configure an Easy Passthrough feed on Form B to map data from Form A.
25-
*
26-
* 3. In the "Map Entry Meta" section, map the "Easy Passthrough Token" from Form A to the
25+
*
26+
* 3. In the "Map Entry Meta" section, map the "Easy Passthrough Token" from Form A to the
2727
* field you've created to capture it on Form B.
2828
*
2929
* 4. Install and configure this snippet per the inline instructions.
@@ -32,13 +32,13 @@
3232
add_action( 'gform_after_submission_123', function( $entry, $form ) {
3333

3434
// Update "4" to the ID of the field that is populated with the EP token.
35-
$token_field_id = 4;
35+
$token_field_id = 4;
3636

3737
// Update "5" to the ID of the field that should be updated on the other form's entry.
3838
$target_field_id = 5;
3939

4040
// Update "Canceled" to the value that should be updated on the other form's entry.
41-
$update_value = 'Canceled';
41+
$update_value = 'Canceled';
4242

4343
$token = $entry[ $token_field_id ];
4444
$source_entry = gp_easy_passthrough()->get_entry_for_token( $token );

gp-entry-blocks/gpeb-display-form-title-description-on-edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414
}
1515

16-
$form_args['display_title'] = true;
16+
$form_args['display_title'] = true;
1717
$form_args['display_description'] = true;
1818

1919
return $form_args;

gp-inventory/gpi-capture-resource-name.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Gravity Perks // Inventory // Capture Resource Name (as Field Value)
44
* https://gravitywiz.com/documentation/gravity-forms-inventory/
5-
*
5+
*
66
* Instruction Video: https://www.loom.com/share/064577f9491a487d84e6bb594d3fd578
77
*
88
* If you intend to map different Resources to different fields throughout the life of your form, you may wish to capture
@@ -18,7 +18,7 @@
1818
$resource_field_id = 5;
1919

2020
$product_field = GFAPI::get_field( $form, $product_field_id );
21-
$resource = get_post( $product_field->gpiResource );
21+
$resource = get_post( $product_field->gpiResource );
2222

2323
GFAPI::update_entry_field( $entry['id'], $resource_field_id, $resource->post_title );
2424

gp-inventory/gpi-limit-by-gravity-flow-approved-entries-only.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
add_filter( 'gpi_query_123', function( $query ) {
1010
global $wpdb;
1111

12-
$query['join'] .= ' INNER JOIN wp_gf_entry_meta emgflow ON emgflow.entry_id = em.entry_id ';
13-
// Update "4" to the ID of your Gravity Flow Approval step feed.
12+
$query['join'] .= ' INNER JOIN wp_gf_entry_meta emgflow ON emgflow.entry_id = em.entry_id ';
13+
// Update "4" to the ID of your Gravity Flow Approval step feed.
1414
$query['where'] .= ' AND emgflow.meta_key = "workflow_step_status_4" AND emgflow.meta_value = "approved" ';
1515

1616
return $query;

gp-limit-submissions/gpls-evaluate-feed-conditional-logic-on-render.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Gravity Perks // Limit Submissions // Evaluate Feed Conditional Logic on Render
44
* https://gravitywiz.com/documentation/gravity-forms-limit-submissions/
5-
*
5+
*
66
* Use this snippet to evaluate a feed's conditional logic on render. This is useful if you're prepopulating a field
77
* value that is used in the feed's conditional logic.
88
*

gp-populate-anything/gppa-dynamic-quantity-choices.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
* a capacity of 2 people while a pontoon may have a capacity of 8 people. If you populate the raw capacity as a choice
1010
* in the Quantity field, this snippet will then convert that single choice into a dynamic list of choices from 1 to the
1111
* specified capacity of the selected boat.
12-
*
12+
*
1313
* Instructions
14-
*
14+
*
1515
* 1. Install the snippet.
1616
* https://gravitywiz.com/documentation/how-do-i-install-a-snippet/
17-
*
17+
*
1818
* 2. Add the `gppa-dynamic-quantity-chocies` class to the desired field(s) "CSS Class Name" field setting.
1919
*/
2020
add_filter( 'gppa_input_choices', function( $choices, $field, $objects ) {
@@ -29,13 +29,13 @@
2929
}
3030

3131
$choices = array();
32-
while( $capacity > 0 ) {
32+
while ( $capacity > 0 ) {
3333
$choices[] = array(
3434
'text' => $capacity,
3535
'value' => $capacity,
3636
);
3737
$capacity--;
3838
}
3939

40-
return array_reverse( $choices);
40+
return array_reverse( $choices );
4141
}, 10, 3 );

gp-populate-anything/gppa-handle-new-lines.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Replace the `\n` new line terminator with an actual new line in template values. This is particularly
77
* useful in custom templates for Paragraph fields where you are outputting multiple object values.
8-
*
8+
*
99
* Example:
1010
*
1111
* ID: {post:ID}\nAuthor: {post:post_author}\nDate: {post:post_date}

gp-populate-anything/gppa-multiple-custom-fields-as-choices.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616

1717
// Add first choice.
1818
$choices[] = array(
19-
'text' => 'First Dynamic Option',
20-
'value' => 'first-dynamic-option',
21-
'price' => get_post_meta( $objects[0]->ID, 'my_first_choice', true ),
19+
'text' => 'First Dynamic Option',
20+
'value' => 'first-dynamic-option',
21+
'price' => get_post_meta( $objects[0]->ID, 'my_first_choice', true ),
2222
);
2323

2424
// Add second choice.
2525
$choices[] = array(
26-
'text' => 'Second Dynamic Option',
27-
'value' => 'second-dynamic-option',
28-
'price' => get_post_meta( $objects[0]->ID, 'my_second_choice', true ),
26+
'text' => 'Second Dynamic Option',
27+
'value' => 'second-dynamic-option',
28+
'price' => get_post_meta( $objects[0]->ID, 'my_second_choice', true ),
2929
);
3030

3131
return $choices;

gp-populate-anything/gppa-populate-checkboxes-as-choices.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ function gppa_populate_checkboxes_as_choices( $choices, $field, $objects ) {
4343
$source_choice = $source_field->get_selected_choice( $value );
4444
$choices[] = $source_choice;
4545
}
46-
4746
}
4847
}
4948
}

gp-populate-anything/gppa-set-template-by-field-value.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
/**
33
* Gravity Perks // Populate Anything // Set Template by Field Value
44
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
5-
*
5+
*
66
* Instruction Video: https://www.loom.com/share/02cb5511b5ba4cf6a051ee7038f55f16
77
*
88
* I'll take another stab at explaining this another day. For now, watch the instructional video above. 😅
99
*/
1010
// Update "123" to your form ID and "4" to the ID of the field being populated.
1111
add_filter( 'gppa_pre_populate_field_123_4', function( $return, $field, $form, $field_values, $entry, $force_use_field_value, $include_html, $run_pre_render ) {
12-
// Update "5" to the ID of the field whose value should be used in the `value` template.
12+
// Update "5" to the ID of the field whose value should be used in the `value` template.
1313
$template_value_by_field_id = 5;
1414
static $doing_it;
1515
if ( ! $doing_it ) {
16-
$doing_it = true;
16+
$doing_it = true;
1717
$field->{'gppa-values-templates'}['value'] = rgpost( "input_{$template_value_by_field_id}" );
18-
$return = gp_populate_anything()->populate_field( $field, $form, $field_values, $entry, $force_use_field_value, $include_html, $run_pre_render );
19-
$doing_it = false;
18+
$return = gp_populate_anything()->populate_field( $field, $form, $field_values, $entry, $force_use_field_value, $include_html, $run_pre_render );
19+
$doing_it = false;
2020
}
2121
return $return;
2222
}, 10, 8 );

gp-word-count/gpwc-combined-word-count-no-truncation.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
*
1515
* 1. Install and activate the JS snippet that handles combining the word counts.
1616
* https://github.com/gravitywiz/snippet-library/blob/master/gp-word-count/gpwc-combined-word-count.js
17-
*
17+
*
1818
* 2. Install and activate this snippet.
19-
*
19+
*
2020
* 3. Configure this snippet for your form and fields based on the inline instructions.
2121
*/
2222
call_user_func( function() {
2323

2424
// Update "123" to your form ID.
25-
$form_id = 123;
25+
$form_id = 123;
2626

2727
// Update "4" and "5" to the IDs of the fields that are combined to create the combined word count.
28-
$source_field_ids = array( 4, 5 );
28+
$source_field_ids = array( 4, 5 );
2929

3030
// Update "6" to the ID of the field that will capture the combined words and generate the combined word count.
3131
$combined_field_id = 6;
3232

33-
add_filter( 'gpwc_script_args', function( $args, $field ) use ( $form_id, $combined_field_id ){
33+
add_filter( 'gpwc_script_args', function( $args, $field ) use ( $form_id, $combined_field_id ) {
3434
if ( $field->formId == $form_id && $field->id == $combined_field_id ) {
3535
$args['truncate'] = false;
3636
}
@@ -46,8 +46,8 @@
4646
return $result;
4747
}
4848
foreach ( $source_field_ids as $source_field_id ) {
49-
$source_field = GFAPI::get_field( $result['form'], $source_field_id );
50-
$source_field->failed_validation = true;
49+
$source_field = GFAPI::get_field( $result['form'], $source_field_id );
50+
$source_field->failed_validation = true;
5151
$source_field->validation_message = sprintf( 'The maximum combined word count of %d has been exceeded.', $combined_field_id->gwwordcount_max_word_count );
5252
unset( $source_field );
5353
}

gravity-forms/gw-get-total-paid-by-email.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* https://gravitywiz.com/
55
*
66
* Use this helper function to get the total paid across all forms for a email address.
7-
*
7+
*
88
* Example:
99
*
1010
* $total = gw_get_total_by_email( 'dave@smiff.com' );
@@ -13,8 +13,11 @@ function gw_get_total_by_email( $email, $form_ids = null ) {
1313
$entries = gfapi::get_entries( $form_ids, array(
1414
'field_filters' => array(
1515
array( 'value' => $email ),
16-
array( 'key' => 'payment_status', 'value' => 'paid' )
17-
)
16+
array(
17+
'key' => 'payment_status',
18+
'value' => 'paid',
19+
),
20+
),
1821
) );
1922
$total = 0;
2023
foreach ( $entries as $entry ) {

gravity-forms/gw-hide-dynamically-populated-fields.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
if ( $value && ( ! isset( $has_matching_choice ) || $has_matching_choice ) ) {
3838
$field->visibility = 'hidden';
3939
}
40-
4140
}
4241

4342
return $form;

gs-product-configurator/gspc-entryless-submissions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if ( rgpost( 'gspc_product_price' ) && ! $result['is_valid'] && $result['form']['fields'][0]['validation_message'] = esc_html__( 'At least one field must be filled out', 'gravityforms' ) ) {
1313
$result['is_valid'] = true;
1414
foreach ( $result['form']['fields'] as &$field ) {
15-
$field->failed_validation = false;
15+
$field->failed_validation = false;
1616
$field->validation_message = '';
1717
}
1818
add_filter( 'gform_abort_submission_with_confirmation', '__return_true' );

0 commit comments

Comments
 (0)