Re-usable UI widgets

Re-usable UI widgets

by Phil Lello -
Number of replies: 0
One thing I've found myself doing more than once over the past few clients is writing common UI code (PHP & JS) that I utilise in various plugins. Whilst dropping code into local/XXX and introducing a dependency works, I can't help feeling there should be a better way.

So, where do people think reusable UI code should live? Renderers almost feel right, although ideally a plugin should not have a dependency on customised theme functionality. 'local' doesn't feel right, because I envisage re-usable UI components, and local always suggests site-specific plugins to me. Would a new module 'widgets' be appropriate here?

I think we should come up with a standard for this, supporting widgets as both generic HTML generators (perhaps implementing renderable), and as form components - the most re-used/re-implemented component is variations on a tree with checkable leaves and/or nodes, which is usually on a moodle form.

Average of ratings: -