Future major features

Theme widget API?

Picture of Richard Oelmann
Theme widget API?
Core developersParticularly helpful MoodlersPlugin developersTesters

One of the things that comes up periodically on the themes forum is finding an easy way to migrate features (widgets, code snippets) whatever we might want to call them from one theme to another.

Last year I did some work as part of flexibase v3.0 to make some of the features easily transferable, but it was too complex to maintain as part of the theme itself, but having done some work recently with Chris for both flexibase and pioneer, the idea arose again and I put some of these components into a separate github repository with instructions for using them in other themes (awesomebar, alerts, marketing and social and now the radial charts for grade and completion).

This restarted the discussion about how we can make this a more standardised practice and simpler to achieve without necessarily being the theme guru that is necessary to migrate some of the features at the moment, with Gareth's suggestion that we need some kind of API to achieve this and my thought (this morning, following Mary's suggestion that this is really a Moodle future feature discussion, rather than a theme specific one smile ) that this could also encompass some of the thoughts that have been expressed about how we deal with some of the current functionality of Blocks.

So, as a discussion: What would be needed for such a feature? Is it a practical way forward - is it already in the minds of anyone at HQ in line with the 'removing blocks' discussions? Is this something that mustache templating would cover?

My thoughts on what the elements are of some of the features that need dealing with:

  • the html/php required to display any feature within a layout (and/or the renderers to go with that)
  • the javascript required for some functionalities
  • the settings required for some functionalities and some appearances
  • the lib functions and classes to support the feature

I'm thinking that much of this is exactly what blocks do - except, crucially, for the way they are displayed. Blocks being limited to the block regions in effectively rectangular, well, 'blocks', while some of these features might be things like the awesomebar menu, or little display widgets that do not sit well in a block, or that designers want the flexibility to display as part of another region (eg. heading)


Average of ratings: Useful (8)
Picture of Chris Kenniburg
Re: Theme widget API?
Particularly helpful MoodlersPlugin developers

Well said!

Average of ratings: -