mirror of
https://ghproxy.net/https://github.com/abhijitb/helix.git
synced 2025-08-28 00:34:34 +08:00
updated react app and API backend
1. Added API backend for settings 2. Added React components for the settings page 3. Added JS lint using @wordpress/scripts 4. Lint fixes for PHP
This commit is contained in:
parent
38067e490a
commit
e80316be89
36 changed files with 45313 additions and 1736 deletions
22
enqueue.php
22
enqueue.php
|
@ -8,7 +8,15 @@
|
|||
add_action(
|
||||
'admin_enqueue_scripts',
|
||||
function ( $hook ) {
|
||||
if ( 'toplevel_page_helix' !== $hook ) {
|
||||
// Define Helix admin pages that need the React app.
|
||||
$helix_pages = array(
|
||||
'toplevel_page_helix',
|
||||
'toplevel_page_helix-posts',
|
||||
'toplevel_page_helix-users',
|
||||
'toplevel_page_helix-settings',
|
||||
);
|
||||
|
||||
if ( ! in_array( $hook, $helix_pages, true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -20,6 +28,18 @@ add_action(
|
|||
array()
|
||||
);
|
||||
|
||||
// Enqueue the CSS file built by Vite.
|
||||
$css_files = glob( plugin_dir_path( __FILE__ ) . 'build/assets/*.css' );
|
||||
if ( ! empty( $css_files ) ) {
|
||||
$css_file = basename( $css_files[0] );
|
||||
wp_enqueue_style(
|
||||
'helix-app-styles',
|
||||
plugin_dir_url( __FILE__ ) . 'build/assets/' . $css_file,
|
||||
array(),
|
||||
'0.1.0'
|
||||
);
|
||||
}
|
||||
|
||||
// Get the original route that was redirected.
|
||||
$original_route = filter_input( INPUT_GET, 'helix_route', FILTER_SANITIZE_URL );
|
||||
$original_route = $original_route ? esc_url_raw( $original_route ) : '/wp-admin/';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue