Customize 2.0 $PAGE->navbar

Customize 2.0 $PAGE->navbar

by Joseph Rézeau -
Number of replies: 3
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi all,

My lesson_essay_feedback block displays to the student the content of his lesson essays, together with teacher comments and score. In the 2.0 version, the navbar (automatically generated) displays as attached. I would like to remove the link to the lesson in the lesson title, so that the student could not access the lesson by mistake in that context. I do not want to remove the lesson title itself, only the link inside it.

How is $PAGE->navbar "automatically" constructed? How can I construct it manully instead?

$PAGE->navbar->ignore_active() does work but it removes too much items from navbar.

Thanks,

Joseph

Average of ratings: -
In reply to Joseph Rézeau

Re: Customize 2.0 $PAGE->navbar

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

This is what I tried, but it does not work because apparently $PAGE->navbar->add strips all links that are passed to it.sad and I want the link to current course to work.

$PAGE->navbar->ignore_active();
$courselink = '<a title="'.$course->fullname.'" href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->fullname.'</a>';
$PAGE->navbar->add($courselink);
$PAGE->navbar->add(get_string('graderscomments', 'block_lesson_essay_feedback'));

Any help welcome!

Joseph

In reply to Joseph Rézeau

Re: Customize 2.0 $PAGE->navbar

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Look at the PHPdoc for navbar::add.

I think you need something like

$PAGE->navbar->add($course->fullname, new moodle_url('/course/view.php', array('id' => $course->id)));

Average of ratings: Useful (1)