From cd2626f88f9aa19f79f1729751d4597b49d55510 Mon Sep 17 00:00:00 2001 From: Dennis Ploetner Date: Sun, 7 Jan 2024 12:28:56 +0100 Subject: [PATCH] Using another action for Admin CSS and Scripts --- includes/MslsPlugin.php | 4 ++-- tests/test-mslsplugin.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/MslsPlugin.php b/includes/MslsPlugin.php index a0b0e9e2..3c3f89d9 100644 --- a/includes/MslsPlugin.php +++ b/includes/MslsPlugin.php @@ -62,7 +62,7 @@ public static function init() { \lloc\Msls\ContentImport\Service::instance()->register(); if ( is_admin() ) { - add_action( 'admin_menu', [ $obj, 'admin_menu' ] ); + add_action( 'admin_enqueue_scripts', [ $obj, 'custom_enqueue' ] ); add_action( 'admin_menu', [ MslsAdmin::class, 'init' ] ); add_action( 'load-post.php', [ MslsMetaBox::class, 'init' ] ); @@ -265,7 +265,7 @@ public function admin_bar_init() { * * @return boolean */ - public function admin_menu() { + public function custom_enqueue() { $ver = defined( 'MSLS_PLUGIN_VERSION' ) ? constant( 'MSLS_PLUGIN_VERSION' ) : false; $postfix = defined( 'SCRIPT_DEBUG' ) && constant( 'SCRIPT_DEBUG' ) ? '' : '.min'; diff --git a/tests/test-mslsplugin.php b/tests/test-mslsplugin.php index ebe7aaf0..d3acdc2b 100644 --- a/tests/test-mslsplugin.php +++ b/tests/test-mslsplugin.php @@ -23,7 +23,7 @@ function test_admin_menu(): void { Functions\when( 'wp_enqueue_style' )->returnArg(); Functions\when( 'plugins_url' )->justReturn( 'https://lloc.de/wp-content/plugins' ); - $this->assertIsBool( $this->get_test()->admin_menu() ); + $this->assertIsBool( $this->get_test()->custom_enqueue() ); } /**