Skip to content

Commit

Permalink
MDL-80043 grade: editingmode_title support for grade report plugins
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
junpataleta committed Dec 1, 2023
1 parent 3f75abc commit 4b4ced2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions grade/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 4b4ced2

Please sign in to comment.