From 4b4ced22b595260722273e771fa8f3876259d633 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Fri, 24 Nov 2023 00:18:03 +0800 Subject: [PATCH] MDL-80043 grade: `editingmode_title` support for grade report plugins * Add support for grade report plugins that define an `editingmode_title` lang string. If the grade report plugin defines this language string, it will be used for the page title's unique identifying information when editing mode is turned on. --- grade/lib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/grade/lib.php b/grade/lib.php index 85181351cab..436b612997e 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -930,7 +930,15 @@ function print_grade_page_head(int $courseid, string $active_type, ?string $acti // If heading is supplied, use this for the page title. $uniquetitle = $heading; } else if (in_array($active_type, ['report', 'settings'])) { + // For grade reports or settings pages of grade plugins, use the plugin name for the unique title. $uniquetitle = $stractiveplugin; + // But if editing mode is turned on, check if the report plugin has an editing mode title string and use it if present. + if ($PAGE->user_is_editing() && $active_type === 'report') { + $strcomponent = "gradereport_{$active_plugin}"; + if (get_string_manager()->string_exists('editingmode_title', $strcomponent)) { + $uniquetitle = get_string('editingmode_title', $strcomponent); + } + } } else { $uniquetitle = $stractive_type . ': ' . $stractiveplugin; }