diff --git a/classes/hook_callbacks.php b/classes/hook_callbacks.php index 5b65093..1b1a21f 100644 --- a/classes/hook_callbacks.php +++ b/classes/hook_callbacks.php @@ -44,6 +44,16 @@ public static function before_standard_top_of_body_html_generation(before_standa $hook->add_html(envbarlib::get_inject_code()); } + /** + * This is the hook enables the plugin to add one or more menu item. + * + * @param extend_user_menu $hook + */ + public static function extend_user_menu(extend_user_menu $hook): void { + // Get items to add. + $hook->add_navitems(envbarlib::add_menuuser()); + } + /** * Listener for the after_config hook. * diff --git a/db/hooks.php b/db/hooks.php index 6905b02..0424af6 100644 --- a/db/hooks.php +++ b/db/hooks.php @@ -35,6 +35,11 @@ 'hook' => \core\hook\after_config::class, 'callback' => [\local_envbar\hook_callbacks::class, 'after_config'], ], + [ + 'hook' => core_user\hook\extend_user_menu::class, + 'callback' => '\local_envbar\hook_callbacks::extend_user_menu', + 'priority' => 0, + ], [ 'hook' => core_user\hook\extend_user_menu::class, 'callback' => '\local_envbar\hook_callbacks::extend_user_menu',