From e9f55f98cd3fbd92852525230f28b809b56b74b7 Mon Sep 17 00:00:00 2001 From: Dan0sz <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:49:41 +0100 Subject: [PATCH] Updated PHP Doc. --- src/Integrations/FormSubmit.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Integrations/FormSubmit.php b/src/Integrations/FormSubmit.php index 0735c0c..bb6b6f7 100644 --- a/src/Integrations/FormSubmit.php +++ b/src/Integrations/FormSubmit.php @@ -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 ); } /** @@ -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 ) ) {