From 9c409464959a8e88d768456e0caf93c8d1230492 Mon Sep 17 00:00:00 2001 From: Kim Hornung Date: Tue, 8 Nov 2022 13:15:10 +0000 Subject: [PATCH] Fix: Use add_help_tab() instead of the deprecated 'contextual_help' hook --- scormcloud/admin/scormcloudadminui.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scormcloud/admin/scormcloudadminui.php b/scormcloud/admin/scormcloudadminui.php index d3e62bf..e2c8ed0 100644 --- a/scormcloud/admin/scormcloudadminui.php +++ b/scormcloud/admin/scormcloudadminui.php @@ -51,7 +51,7 @@ public static function admin_menu_actions() 'show_settings', ]); - add_action('contextual_help', [__CLASS__, 'contextual_help'], 10, 3); + add_action('in_admin_header', [__CLASS__, 'contextual_help']); } /** @@ -72,7 +72,7 @@ public static function network_admin_menu_actions() 'show_network_settings', ]); - add_action('contextual_help', [__CLASS__, 'contextual_help'], 10, 3); + add_action('in_admin_header', [__CLASS__, 'contextual_help']); } /** @@ -140,10 +140,12 @@ public static function set_js_vars() /** * Build contextual help stubs. */ - public static function contextual_help($text, $screen_id, $screen) + public static function contextual_help() { $plugin_hooks = ScormCloudPlugin::$hooks; + $screen = get_current_screen(); + $screen_id = $screen->id; if (substr($screen_id, -8) == '-network') { $screen_id = substr_replace($screen_id, '', -8); } @@ -248,9 +250,12 @@ public static function contextual_help($text, $screen_id, $screen) $help_html .= ""; - return $help_html; - } else { - return $text; + // Add the contextual help tab + $screen->add_help_tab(array( + 'title' => 'Overview', + 'id' => 'scormcloud-help', + 'content' => $help_html, + )); } } } \ No newline at end of file