Feature Friday: Mobile support for plugins

March 16, 2018

Have you used our Moodle Mobile App as an educator or a learner?

If you haven’t it may only be a matter of time until you do as there is a growing requirement to take learning outside of the classroom and to make your learning accessible everywhere and anytime.

In keeping with this trend and our mission to empower educators to improve our world, we are always looking for new ways to improve mobile learning with Moodle.

For example, think back to Moodle 3.1 when we released a new feature ‘remote add-in functionality’, making it possible to support Moodle plugins in our Moodle Mobile App.

Although this feature benefited Moodle mobile users as it allowed developers to add plugins to their Moodle Mobile App, it also had disadvantages such as:

Although this feature benefited Moodle mobile users as it allowed developers to add plugins to their Moodle Mobile App, it also had disadvantages such as:

  • Remote add-ons are not easy to develop and test since they are required to be developed as an AngularJS/Ionic module.
  • A zip file containing the plugin must be downloaded from the server to be lazy-loaded.
  • It is not easy to maintain or upgrade them.
  • Developers had to set up a local Mobile development environment

Now, true to our commitment to enhance usability in Moodle and make the experience of using our platform seamless across all devices, our Moodle Mobile team have been thinking of new ways to extend the mobile app features and overcome the disadvantages of the remote add-on functionality.

Guiding their work are the following principles:

  • It has to be easy to develop
  • It should work without developing Angular/Ionic code
  • It has to be easy to maintain
  • It has to be supported since Moodle 3.1 at least
  • Should support all the different types of Moodle plugins supported by the app
  • Should work in any type of device
  • Should not require javascript at all, although in some cases it will be needed. In the latter case, we’ll try to simplify the required javascript

So, if you are interested in Moodle Mobile development, you might want to read on as we share the new spec (beta version) for supporting Moodle plugins in the Moodle Mobile App!

What did our Moodle Mobile team come up with?

Taking onboard the feedback from our community, the mobile team decided to work on improving support for Moodle plugins and published an initial draft specification.

The overall idea is to allow Moodle plugins to extend different areas in the app with just PHP server side code and Ionic 3 markup (custom html elements that are called components) using a set of custom Ionic directives and components.

It is the aim of the team that this will ensure remote add-on won’t be necessary any longer, that usability of the mobile app will be improved and developers will no longer have to learn Ionic 3 / Angular or set up a new mobile development environment to migrate them.

All of which were highlighted as usability issues of the remote add-ons functionality.

As a bonus, this improvement doesn’t need a local mobile environment, instead developers can use the Chrome or Chromium browser to add mobile support to plugins.

How does it work?

Developers will have to:

  1. Create a db/mobile.php file in their plugins. In this file developers will be able to indicate which areas of the app they want to extend, for example, adding a new option in the main menu, implementing an activity module not supported, including a new option in the course menu, including a new option in the user profile, etc. All the areas supported are described further in this document.
  2. Create new functions in a reserved namespace that will return the content of the new options. The content should be returned rendered (html). The template should use Ionic components so that it looks native (custom html elements) but it can be generated using mustache templates.

For a more detailed step-by step example, please read our documentation (soon to be part of official documentation in moodle.org)

Now the only question left to ask is, ‘when can I start using mobile support for plugins?’

This will be released in our upcoming Moodle update Moodle 3.5, so stay tuned!

In the meantime you can check out our recent blog post to see what other features and improvements you can look forward to in Moodle 3.5.

Alternatively, join in the conversation on our Moodle for Mobile forum.