mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-72287 theme_boost: Remove the breadcrumb for course context.
This commit is contained in:
parent
5ee0b620ae
commit
b9d1aaaa3e
@ -27,14 +27,17 @@ class boostnavbar implements \renderable {
|
||||
|
||||
/** @var array The individual items of the navbar. */
|
||||
protected $items = [];
|
||||
/** @var moodle_page The current moodle page. */
|
||||
protected $page;
|
||||
|
||||
/**
|
||||
* Takes a navbar object and picks the necessary parts for display.
|
||||
*
|
||||
* @param \navbar $navbar The navigation bar.
|
||||
* @param \moodle_page $page The current moodle page.
|
||||
*/
|
||||
public function __construct(\navbar $navbar) {
|
||||
foreach ($navbar->get_items() as $item) {
|
||||
public function __construct(\moodle_page $page) {
|
||||
$this->page = $page;
|
||||
foreach ($this->page->navbar->get_items() as $item) {
|
||||
$this->items[] = $item;
|
||||
}
|
||||
$this->prepare_nodes_for_boost();
|
||||
@ -46,6 +49,12 @@ class boostnavbar implements \renderable {
|
||||
protected function prepare_nodes_for_boost(): void {
|
||||
global $PAGE;
|
||||
|
||||
// Don't show the navigation if we are in the course context.
|
||||
if ($this->page->context->contextlevel == CONTEXT_COURSE) {
|
||||
$this->clear_items();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->remove('myhome'); // Dashboard.
|
||||
$this->remove('home');
|
||||
|
||||
|
@ -53,7 +53,7 @@ class core_renderer extends \core_renderer {
|
||||
* @return string the HTML for the navbar.
|
||||
*/
|
||||
public function navbar(): string {
|
||||
$newnav = new \theme_boost\boostnavbar($this->page->navbar);
|
||||
$newnav = new \theme_boost\boostnavbar($this->page);
|
||||
return $this->render_from_template('core/navbar', $newnav);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user