Skip to content

Commit

Permalink
gw-cache-buster.php: Fixed an issue with Cache Buster and Expired F…
Browse files Browse the repository at this point in the history
…orms.
  • Loading branch information
saifsultanc authored Jan 28, 2025
1 parent 18e602e commit 8ebecf6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions gravity-forms/gw-cache-buster.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,18 @@ public function get_cachebuster_markup( $markup, $atts, $content ) {
// We probably don't need this since everything else should already be loaded by this point but since
// GF is using it as their standard for triggering the `gform_post_render` event, I figured we should follow suit.
gform.initializeOnLoaded( function() {
// Form has been rendered. Trigger post render to initialize scripts.
// Form has been rendered. Trigger post render to initialize scripts if form is not restricted (expired).
<?php
echo sprintf(
'gform.initializeOnLoaded(function() {%s});',
GFFormDisplay::post_render_script(
$form_id,
GFFormDisplay::get_current_page( $form_id )
)
);
$form_restriction_error = rgars( GFFormDisplay::$submission, $form_id . '/form_restriction_error' );
if ( ! $form_restriction_error ) {

Check failure on line 268 in gravity-forms/gw-cache-buster.php

View workflow job for this annotation

GitHub Actions / PHPCS

Line indented incorrectly; expected 6 tabs, found 7
echo sprintf(
'gform.initializeOnLoaded(function() {%s});',
GFFormDisplay::post_render_script(
$form_id,
GFFormDisplay::get_current_page( $form_id )
)
);
}

Check failure on line 276 in gravity-forms/gw-cache-buster.php

View workflow job for this annotation

GitHub Actions / PHPCS

Line indented incorrectly; expected 6 tabs, found 7
?>
} );
} );
Expand Down

0 comments on commit 8ebecf6

Please sign in to comment.