mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 21:45:37 +02:00
MDL-76362 core: Test coursealias before using
This commit is contained in:
parent
6ae3f79c1e
commit
eceb3c49fd
@ -4560,7 +4560,7 @@ function role_get_name(stdClass $role, $context = null, $rolenamedisplay = ROLEN
|
||||
}
|
||||
|
||||
if ($rolenamedisplay == ROLENAME_ALIAS) {
|
||||
if ($coursecontext and trim($role->coursealias ?? '') !== '') {
|
||||
if ($coursecontext && $role->coursealias && trim($role->coursealias) !== '') {
|
||||
return format_string($role->coursealias, true, array('context'=>$coursecontext));
|
||||
} else {
|
||||
return $original;
|
||||
@ -4568,7 +4568,7 @@ function role_get_name(stdClass $role, $context = null, $rolenamedisplay = ROLEN
|
||||
}
|
||||
|
||||
if ($rolenamedisplay == ROLENAME_BOTH) {
|
||||
if ($coursecontext and trim($role->coursealias ?? '') !== '') {
|
||||
if ($coursecontext && $role->coursealias && trim($role->coursealias) !== '') {
|
||||
return format_string($role->coursealias, true, array('context'=>$coursecontext)) . " ($original)";
|
||||
} else {
|
||||
return $original;
|
||||
|
Loading…
x
Reference in New Issue
Block a user