Created
October 28, 2024 18:53
-
-
Save rafaehlers/047969bd5bc1e7a98f9605fea19c1e93 to your computer and use it in GitHub Desktop.
Edit Entry: Change the action of the Cancel button to close the lightbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // DO NOT COPY THIS LINE | |
function custom_cancel_onclick_js( $back_link, $form, $entry, $view_id, $update_count ) { | |
$run_on_views = [2334]; //Change this to the IDs of the Views you'd like to run this filter [100,200,300,...] | |
if( in_array( $view_id, $run_on_views ) ){ | |
return 'window.parent.postMessage({closeFancybox: true}, "*"); return false;'; | |
} | |
} | |
add_filter( 'gravityview/edit_entry/cancel_onclick', 'custom_cancel_onclick_js', 100, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment