Can't get a plugin to show up in navigation

Can't get a plugin to show up in navigation

by Jeroen Voortman -
Number of replies: 3

I'm currently in the process of building a plugin, but for some reason it's impossible for me to get the plugin to show up in the navigation.


In the file mod/signature/lib.php I've got the following code:

function signature_extend_navigation($navigation, $course, $module, $cm) {
global $CFG;

$target = $CFG->wwwroot.'/mod/signature/index.php';
$navigation->add('Digitaal ondertekenen', $target, navigation_node::TYPE_RESOURCE, null , null, new pix_icon('i/group' , ''));
}
But this doesn't seem to be working. According to the documentation and an example module I've downloaded, this should be the way to go, so what's wrong here? Why won't this make my plugin show up?
Average of ratings: -
In reply to Jeroen Voortman

Re: Can't get a plugin to show up in navigation

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

That should be fine. Your entry should show up in the specific instance navigation when you click on an instance of that module in a course. Are you looking in the correct navigation menu?

Also, make sure you have purged your caches.

mike

In reply to Mike Churchward

Re: Can't get a plugin to show up in navigation

by Jeroen Voortman -

I wasn't trying to display it only in courses. It has to be shown on every page for every logged in user.

In reply to Jeroen Voortman

Re: Can't get a plugin to show up in navigation

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

That function will add it to the Administration menu under the entry "Signature administration". You will only see that when you are accessing the signature activity. If you see your entry there, then the function is working correctly.

To display to every user on every page, you may want to inject into the user preferences or profile feature. Or you could use a theme that allows you to add menu entries. Or you could create a block that you then add to all pages of the site.

mike