-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgravity-pdf-bulk-generator-store.php
38 lines (31 loc) · 1.25 KB
/
gravity-pdf-bulk-generator-store.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* Plugin Name: Gravity PDF Bulk Generator Store
* Description: Sample plugin showing how to listen to the Bulk Generator store on the Gravity Forms Entry List page
* Author: Gravity PDF
* Author URI: https://gravitypdf.com
* Version: 0.2
*/
/**
* @package Gravity PDF Bulk Generator Store
* @copyright Copyright (c) 2021, Blue Liquid Designs
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 1.0
*/
/* Load a Javascript file on the Gravity Forms Entry List page */
add_action( 'admin_init', function() {
/* Don't do anything if Gravity Forms and the Bulk Generator plugin isn't active */
if ( ! class_exists( 'GFForms' ) || ! class_exists( '\GFPDF\Plugins\BulkGenerator\Bootstrap' ) ) {
return;
}
if ( \GFForms::get_page() === 'entry_list' ) {
add_action( 'admin_enqueue_scripts', function() {
wp_enqueue_script( 'gravitypdf_bulk_generator_listener', plugin_dir_url( __FILE__ ) . '/gravitypdf.js', [], false, true );
}, 5 );
}
} );
/* Allow Javascript file to be loaded when Gravity Forms No Conflict Mode is enabled */
add_filter( 'gform_noconflict_scripts', function( $scripts ) {
$scripts[] = 'gravitypdf_bulk_generator_listener';
return $scripts;
} );