Local Plugins without editing core PHP

Local Plugins without editing core PHP

by Stephan L -
Number of replies: 1

Hi!

Is there a way to conveniently embed local JavaScript AMD plugins into several pages like course/view.php without actually editing the PHP core code? (e.g by adding $PAGE->requires->js_call_amd)

Whenever a new update of Moodle is deployed to the server, all core files have to be edited as well. So is there an alternative way to embed JS Code and maintain serviceability?

Average of ratings: -
In reply to Stephan L

Re: Local Plugins without editing core PHP

by Andreas Grabs -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Translators

Hi Stephan,

I'd try to implement a local plugin. This type supports different callback methods called from the moodle setup.php.

https://docs.moodle.org/dev/Callbacks

This way you can check the context, the page actually runs and inject you javascript.
I hope this helps.

Best regards
Andreas