MDL-70196 navigation: Update to pages to add a URL.

- Part of: MDL-69588
Some pages have added an item to the end of the  navbar without a
link for it. This adds the current page as a url to this navigation
node. Doing this brings it in line with all of the other pages
around Moodle and also helps with the new navigation changes in
theme boost.
This commit is contained in:
Adrian Greeve 2021-03-30 10:28:56 +08:00 committed by Mathew May
parent 7d435fb5f2
commit c3871a9174
6 changed files with 12 additions and 9 deletions

View File

@ -61,7 +61,7 @@ $PAGE->set_context($context);
$PAGE->set_url($currenturl);
$PAGE->set_heading($badge->name);
$PAGE->set_title($badge->name);
$PAGE->navbar->add($badge->name);
$PAGE->navbar->add($badge->name, $currenturl);
$output = $PAGE->get_renderer('core', 'badges');
$msg = optional_param('msg', '', PARAM_TEXT);
@ -105,4 +105,4 @@ if ($badge->has_criteria()) {
echo $OUTPUT->box(get_string('addcriteriatext', 'badges'));
}
echo $OUTPUT->footer();
echo $OUTPUT->footer();

View File

@ -233,7 +233,7 @@ class mod_assign_renderer extends plugin_renderer_base {
$o = '';
if ($header->subpage) {
$this->page->navbar->add($header->subpage);
$this->page->navbar->add($header->subpage, $header->subpageurl);
$args = ['contextname' => $header->context->get_context_name(false, true), 'subpage' => $header->subpage];
$title = get_string('subpagetitle', 'assign', $args);
} else {

View File

@ -139,8 +139,10 @@ $strpage = get_string("page");
if (!$search || $showform) {
$PAGE->navbar->add($strforums, new moodle_url('/mod/forum/index.php', array('id'=>$course->id)));
$PAGE->navbar->add(get_string('advancedsearch', 'forum'));
$url = new moodle_url('/mod/forum/index.php', array('id' => $course->id));
$PAGE->navbar->add($strforums, $url);
$url = new moodle_url('/mod/forum/search.php', array('id' => $course->id));
$PAGE->navbar->add(get_string('advancedsearch', 'forum'), $url);
$PAGE->set_title($strsearch);
$PAGE->set_heading($course->fullname);

View File

@ -97,7 +97,7 @@ if (data_submitted()) {
}
$strsubscribers = get_string("subscribers", "forum");
$PAGE->navbar->add($strsubscribers);
$PAGE->navbar->add($strsubscribers, $url);
$PAGE->set_title($strsubscribers);
$PAGE->set_heading($COURSE->fullname);
if (has_capability('mod/forum:managesubscriptions', $context) && \mod_forum\subscriptions::is_forcesubscribed($forum) === false) {

View File

@ -46,7 +46,7 @@ require_capability('mod/workshop:allocate', $context);
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('allocation', 'workshop'));
$PAGE->navbar->add(get_string('allocation', 'workshop'), $workshop->allocation_url($method));
$allocator = $workshop->allocator_instance($method);
$initresult = $allocator->init();

View File

@ -78,7 +78,8 @@ if ($ctx && ($context = context::instance_by_id($ctx, IGNORE_MISSING)) && $conte
$tagcollid = $tag->tagcollid;
$PAGE->set_url($tag->get_view_url($exclusivemode, $fromctx, $ctx, $rec));
$pageurl = $tag->get_view_url($exclusivemode, $fromctx, $ctx, $rec);
$PAGE->set_url($pageurl);
$PAGE->set_subpage($tag->id);
$tagnode = $PAGE->navigation->find('tags', null);
$tagnode->make_active();
@ -97,7 +98,7 @@ if ($PAGE->user_allowed_editing()) {
$buttons .= $OUTPUT->edit_button(clone($PAGE->url));
}
$PAGE->navbar->add($tagname);
$PAGE->navbar->add($tagname, $pageurl);
$PAGE->set_title(get_string('tag', 'tag') .' - '. $tag->get_display_name());
$PAGE->set_heading($COURSE->fullname);
$PAGE->set_button($buttons);