MDL-78550 grade: Avoid rendering an empty <h2> heading

This commit is contained in:
Jun Pataleta 2023-06-22 14:19:51 +08:00
parent a7a9182262
commit 00e69c97ee
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7

View File

@ -954,19 +954,15 @@ function print_grade_page_head(int $courseid, string $active_type, ?string $acti
}
}
$heading = !empty($heading) ? $heading : '';
$output = '';
// Add a help dialogue box if provided.
if (isset($headerhelpidentifier)) {
if (isset($headerhelpidentifier) && !empty($heading)) {
$output = $OUTPUT->heading_with_help($heading, $headerhelpidentifier, $headerhelpcomponent);
} else {
if (isset($user)) {
$renderer = $PAGE->get_renderer('core_grades');
$output = $OUTPUT->heading($renderer->user_heading($user, $courseid));
} else {
$output = $OUTPUT->heading($heading);
}
} else if (isset($user)) {
$renderer = $PAGE->get_renderer('core_grades');
$output = $OUTPUT->heading($renderer->user_heading($user, $courseid));
} else if (!empty($heading)) {
$output = $OUTPUT->heading($heading);
}
if ($return) {