MDL-74386 contentbank: Set the page context to frontpage

Sets the page context to frontpage when viewing or editing site
contenbank files. This logic was already applied in
contentbank/index.php, so this change will bring consistency in
the contenbanks pages when it comes to setting the page context.
This commit is contained in:
Mihail Geshoski
2022-04-08 15:04:58 +08:00
parent 93aa5ab03e
commit d08c351701
2 changed files with 10 additions and 2 deletions
+5 -1
View File
@@ -93,7 +93,11 @@ if ($context->contextlevel == CONTEXT_COURSECAT) {
}
$PAGE->set_url(new \moodle_url('/contentbank/edit.php', $values));
$PAGE->set_context($context);
if ($context->id == \context_system::instance()->id) {
$PAGE->set_context(context_course::instance($context->id));
} else {
$PAGE->set_context($context);
}
if ($content) {
$PAGE->navbar->add($content->get_name(), new \moodle_url('/contentbank/view.php', ['id' => $id]));
}
+5 -1
View File
@@ -66,7 +66,11 @@ if ($context->contextlevel == CONTEXT_COURSECAT) {
}
$PAGE->set_url(new \moodle_url('/contentbank/view.php', ['id' => $id]));
$PAGE->set_context($context);
if ($context->id == \context_system::instance()->id) {
$PAGE->set_context(context_course::instance($context->id));
} else {
$PAGE->set_context($context);
}
$PAGE->navbar->add($record->name);
$title .= ": ".$record->name;
$PAGE->set_title($title);