Skip to content

Commit

Permalink
Updated PHP Doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan0sz committed Jan 22, 2025
1 parent d60726b commit e9f55f9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Integrations/FormSubmit.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ private function init() {
*/
add_action( 'wp_enqueue_scripts', [ $this, 'add_js' ], 1 );
/**
* Contact Form 7 doesn't respect JS checkValidity() function.
* Contact Form 7 doesn't respect JS checkValidity() function, so this is a custom compatibility fix.
*/
add_filter( 'wpcf7_validate', [ $this, 'wpcf7_validate' ], 10, 2 );
add_filter( 'wpcf7_validate', [ $this, 'maybe_track_submission' ], 10, 2 );
}

/**
Expand Down Expand Up @@ -59,14 +59,14 @@ public function add_js() {
}

/**
* Tracks the form submission if form is valid.
* Tracks the form submission if CF7 says it's valid.
*
* @param \WPCF7_Validation $result Form submission result object containing validation results.
* @param array $tags Array of tags associated with the form fields.
*
* @return \WPCF7_Validation
*/
public function wpcf7_validate( $result, $tags ) {
public function maybe_track_submission( $result, $tags ) {
$invalid_fields = $result->get_invalid_fields();

if ( empty( $invalid_fields ) ) {
Expand Down

0 comments on commit e9f55f9

Please sign in to comment.