@@ -104,7 +104,7 @@ public function get_global_header_data() {
104104 $ admin_link ->url = new \moodle_url ('/admin/search.php ' ); // Use the observed URL
105105 $ admin_link ->hasnotification = false ;
106106 $ admin_link ->notificationcount = 0 ;
107- $ admin_link ->openInNewTab = false ; // Or true, if you prefer it opens in a new tab
107+ $ admin_link ->openInNewTab = false ;
108108
109109 // Add this admin link to your customnavigation array
110110 // This ensures it gets rendered by your {{#customnavigation}} block in Mustache
@@ -180,6 +180,7 @@ public function get_global_header_data() {
180180 if (!isset ($ item ['visible ' ]) || $ item ['visible ' ] === true ) {
181181 $ processed_item = new \stdClass ();
182182 $ processed_item ->title = $ item ['title ' ] ?? 'Untitled ' ; // Default title if missing
183+ $ processed_item ->openInNewTab = $ item ['openInNewTab ' ] ?? false ;
183184 // Handle URLs - convert to moodle_url if internal, keep as string if external
184185 if (isset ($ item ['url ' ]) && !empty ($ item ['url ' ])) {
185186 $ item_url_path = $ item ['url ' ]; // Store the raw URL from the API
@@ -188,6 +189,7 @@ public function get_global_header_data() {
188189 $ admin_url = get_config ('theme_nhse ' , 'admin_url ' );
189190 if (!empty ($ admin_url )) {
190191 $ processed_item ->url = $ admin_url ;
192+ $ processed_item ->openInNewTab = true ;
191193 error_log ("theme_nhse: Overriding 'Admin' URL with theme setting: {$ processed_item ->url }" );
192194 } else {
193195 // Fallback to original logic if theme setting is not configured
@@ -216,8 +218,7 @@ public function get_global_header_data() {
216218 error_log ("theme_nhse: Item has empty or missing URL, defaulting to Moodle home. " );
217219 }
218220 $ processed_item ->hasnotification = $ item ['hasNotification ' ] ?? false ;
219- $ processed_item ->notificationcount = $ item ['notificationCount ' ] ?? 0 ;
220- $ processed_item ->openInNewTab = $ item ['openInNewTab ' ] ?? false ;
221+ $ processed_item ->notificationcount = $ item ['notificationCount ' ] ?? 0 ;
221222
222223 $ processed_links [] = $ processed_item ;
223224 } else {
0 commit comments