So I want to create a “New feature” META issue in the tracker regarding local plugin hooks (or new events). Before creating it I want some feedback from other developers.
Since I’m a contrib developer (and work also for a Moodle Partner) I’m a huge fan of local plugins mainly due to the hooks and libraries that allows me to not to change Moodle core code.
I think that the current hooks for local plugin are very limited, so I want to propose a few new ones.
I’m also suggesting that instead adding new hooks for local plugins, it will be interesting check if add new “system driven” events will be plausible. The curren event system in Moodle is designed for being “user driven” (user created, user deleted, quiz graded)
Hooks or new events:
Once the initial Moodle setup is finished (afer loading config.php in every page that includes it)
New hook for local plugins or new event “setupfinished”
This can be achieved using “customscripts” but I think that using local hooks will be a best choice.
When I mean hook I mean a function in the lib.php of the local plugin called
local_pluginname_setup_finished()
that is called when the setup finishs
Before page header printing (print_header)
After page header printing
Same for page footer
These hooks will help us to easily manipulate the OUTPUT and PAGE objects before printing
Hooks for manipulating the settings tree (currently there is a hook for the navigation tree)
More ideas:
Renderes for local plugins that overwrites the themes one