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.
This commit is contained in:
Jun Pataleta
2023-12-01 09:07:30 +08:00
parent 3f75abcb8d
commit 4b4ced22b5
+8
View File
@@ -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;
}