Extending the navigation in plugins with dependencies

Extending the navigation in plugins with dependencies

by Daniel Poggenpohl -
Number of replies: 2
Picture of Core developers

Hello everyone,

I am developing a suite of plugins for Moodle 2.8.5 (Moodle 3.0 seems to have the same problem), a base plugin and multiple plugins dependent on the base plugin.

All of those plugins are local plugins. I would like for them to be specific plugin types, e.g. reports, but reports can't extend the navigation as well as I want them to, which is another problem entirely.

Anyways, the base plugin extends the settings navigation of the course administration by adding a simple container for further entries.

The other plugins depend on the base plugin and extend the settings navigation further by adding entries to their pages to the base plugin nav container.

Which is all fine and dandy until the plugin names prevent this.

When Moodle looks for navigation extension in local plugins, it looks for all plugins having lib.php containing "_extends_settings_navigation" functions. It returns a list of matching plugins and calls the functions for each plugin.

But Moodle doesn't sort those found plugins according to the plugin dependencies.

Is this done intentionally?

Average of ratings: -
In reply to Daniel Poggenpohl

Re: Extending the navigation in plugins with dependencies

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Plugin dependencies (in version.php) are used during installation to make sure that all required plugins are present (otherwise the installation is aborted).

Dependencies don't have any meaning or usage outside of the installation process.

Maybe what you should do in this case is to get just the main plugin to extend the navigation. You could then have a mechanism, within this, for looping through your other plugins to add each of them into the navigation in the order that you want them?

There may be some mileage in creating a new 'subplugin' type for each of these reports (like is done for 'assignsubmisison' plugins within 'mod_assign' or 'booktool' plugins within 'mod_book'). I have never investigated to see if subplugins are possible for plugins that are not activity types (but I guess they should be).


In reply to Daniel Poggenpohl

Re: Extending the navigation in plugins with dependencies

by dany burton -

what how. can I do this with moodle plugin development? thankyou