-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.php
More file actions
42 lines (38 loc) · 919 Bytes
/
Copy pathapp.php
File metadata and controls
42 lines (38 loc) · 919 Bytes
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
39
40
41
42
<?php
use Kucrut\Vite;
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( isset( $_GET['page'] ) && 'simple-gdpr-cookie-compliance' === $_GET['page'] ) { //phpcs:ignore
$handle = 'simple-gdpr-cookie-compliance-admin-app';
add_action(
'admin_enqueue_scripts',
function ( $handle ): void {
Vite\enqueue_asset(
__DIR__ . '/app/dist',
'app/src/main.tsx',
array(
'handle' => $handle,
'dependencies' => array(
'wp-api-fetch',
'lodash',
),
'css-dependencies' => array(),
'css-media' => 'all',
'css-only' => false,
'in-footer' => true,
)
);
wp_localize_script(
$handle,
'simpleGDPRCookieLocal',
array(
'adminURL' => admin_url( '/' ),
'siteURL' => site_url( '/' ),
'restNamespace' => 'sgcc/v1',
'version' => SIMPLE_GDPR_COOKIE_COMPLIANCE_VERSION,
)
);
}
);
}