2025-08-01 08:00:35 +05:30
|
|
|
<?php
|
|
|
|
add_action('admin_enqueue_scripts', function ($hook) {
|
|
|
|
if ($hook !== 'toplevel_page_helix') return;
|
|
|
|
|
|
|
|
wp_enqueue_script('helix-app', plugin_dir_url(__FILE__) . 'build/index.js', [], null, true);
|
2025-08-04 13:20:11 +05:30
|
|
|
|
|
|
|
// Get the original route that was redirected
|
|
|
|
$original_route = isset($_GET['helix_route']) ? $_GET['helix_route'] : '/wp-admin/';
|
|
|
|
|
2025-08-01 08:00:35 +05:30
|
|
|
wp_localize_script('helix-app', 'helixData', [
|
|
|
|
'restUrl' => esc_url_raw(rest_url('helix/v1/')),
|
|
|
|
'nonce' => wp_create_nonce('wp_rest'),
|
|
|
|
'user' => wp_get_current_user(),
|
2025-08-04 13:20:11 +05:30
|
|
|
'originalRoute' => $original_route,
|
|
|
|
'adminUrl' => admin_url(),
|
2025-08-01 08:00:35 +05:30
|
|
|
]);
|
|
|
|
});
|