Posts made by David Scotson

Moodle in English -> Themes -> override login_form -> Re: override login_form

by David Scotson -
That actually seems fairly straightforward.

You ask the $PAGE for a named rendererer (e.g. "core_login").

It goes looking for a class with that name, plus _renderer (i.e. "core_login_renderer") which extends plugin_renderer_base. (not sure *where* it looks though)

You make a little API of function calls in that class that you call to get HTML back.

And you override that in your theme with the usual theme-based renaming (e.g. "themename_login_renderer").

Even just cutting and pasting the whole of the login page into a single function would be a start and is slightly more forward compatible than my other thought which was to just ask people to replace that login file with the alternative.
Average of ratings: Useful (2)
> I guess my basic question to MoodleHQ has to do with why there are so few really nice looking themes in the core? Is it just priorities, or are there no coders with the inclination to do it?

The fundamental cause is the structure of the front-end code, large areas of Moodle are simply not "themeable", and the bits that can be themed are often complicated and brittle, which doesn't reward experimentation. A Bootstrap theme was achieved via a series of complicated hacks (e.g. using LESS to compile Bootstrap's CSS so that it's compatible with Moodle's often self-contradictory HTML). This is simply not feasible for average themers, the effort involved is simply not worth it, though by working together on the Bootstrap base multiple people have been able to build on that shared foundation. But even though it smooths over some of the gaps there's still plenty of things are still too hard e.g. the latest thread in this forum is about not being able to theme the login page with a renderer, and even the "easy" bits require more knowledge of how Bootstrap works than most other Bootstrap themes for other similar web applicaions, since they don't require as many technical gymnastics and can often just import the CSS direct from Bootstrap and take advantage of 3rd party themes bought from WrapBootstrap.com, or downloaded for free from Bootswatch.com etc.

I was hopeful that the Bootstrap theme would provide a good map for where these things in the front end need to be fixed and that as they were fixed, each of the workarounds could be removed until we get to the point where Moodle can be themed with relative ease, whether building on Bootstrap or not.

Unfortunately we're not there yet, even upgrading the Bootstrap theme to the latest version of Bootstrap is considered to be at the very edge of possibility, even with the combined focus of the the community and Moodle HQ, so that gives you some idea of how much work would be involved in building a theme from scratch based on a popular 3rd party framework, and I'd suggest writing a custom one for Moodle would be an order of magnitude more work (at least). You can change the headers and footer with relative ease though, to wrap Moodle in a modern look, but I think that mostly serves to mask the deeper problems.
Average of ratings: Useful (1)