MDL-73169 contentbank: Update the breadcrumb nodes and nav highlighting

This commit is contained in:
Mihail Geshoski 2022-02-22 17:02:32 +08:00
parent bcec96f952
commit c427883cb7
3 changed files with 18 additions and 1 deletions

View File

@ -48,10 +48,12 @@ if (!empty($id)) {
$heading = $content->get_name();
// The content type of the content overwrites the pluginname param value.
$contenttypename = $content->get_content_type();
$breadcrumbtitle = get_string('edit');
} else {
$contenttypename = "contenttype_$pluginname";
$heading = get_string('addinganew', 'moodle', get_string('description', $contenttypename));
$content = null;
$breadcrumbtitle = get_string('add');
}
// Check plugin is enabled.
@ -86,14 +88,19 @@ if ($PAGE->course) {
require_login($PAGE->course->id);
}
if ($context->contextlevel == CONTEXT_COURSECAT) {
$PAGE->set_primary_active_tab('home');
}
$PAGE->set_url(new \moodle_url('/contentbank/edit.php', $values));
$PAGE->set_context($context);
if ($content) {
$PAGE->navbar->add($content->get_name(), new \moodle_url('/contentbank/view.php', ['id' => $id]));
}
$PAGE->navbar->add(get_string('edit'));
$PAGE->navbar->add($breadcrumbtitle);
$PAGE->set_title($title);
$PAGE->set_pagelayout('incourse');
$PAGE->set_secondary_active_tab('contentbank');
// Instantiate the content type form.
$editorclass = "$contenttypename\\form\\editor";

View File

@ -51,6 +51,11 @@ if ($contextid == \context_system::instance()->id) {
} else {
$PAGE->set_context($context);
}
if ($context->contextlevel == CONTEXT_COURSECAT) {
$PAGE->set_primary_active_tab('home');
}
$PAGE->set_title($title);
$PAGE->add_body_class('limitedwidth');
$PAGE->set_pagetype('contentbank');

View File

@ -61,6 +61,10 @@ if (!$content->is_view_allowed()) {
redirect($cburl);
}
if ($context->contextlevel == CONTEXT_COURSECAT) {
$PAGE->set_primary_active_tab('home');
}
$PAGE->set_url(new \moodle_url('/contentbank/view.php', ['id' => $id]));
$PAGE->set_context($context);
$PAGE->navbar->add($record->name);
@ -68,6 +72,7 @@ $title .= ": ".$record->name;
$PAGE->set_title($title);
$PAGE->set_pagetype('contentbank');
$PAGE->set_pagelayout('incourse');
$PAGE->set_secondary_active_tab('contentbank');
echo $OUTPUT->header();