I'm trying to build a Moodle plugin that does two things:
- Establishes a settings page for admins
- Runs a JavaScript file each time a user views a new page.
I've been able to create block plugins that run JavaScript, but I don't want my plugin to have to be added to a specific place or to take up space on the sidebar.
Can anyone point me toward a different plugin template that covers the two requirements above? Alternatively, what function can I use to hook into the page rendering and add in my code? Something like this?
local_myplugin_extend_navigation() {
global $PAGE;
$PAGE->requires->js_call_amd('local_myplugin/scriptname', 'init');
}