Theme selector block
Introduction
Have you ever wanted to compare themes easily? In “What’s in a screenshot” (March 2018), I briefly mentioned my ‘Theme selector’ block that I took over from John Syrinek. It gives you the ability to switch between themes quickly so that you can make the comparisons you want.
Disclaimers and license
Firefox® is a registered trademark of the Mozilla Foundation – www.mozilla.org/en-US/foundation/trademarks/policy/.
Ubuntu® is a registered trademark of Canonical Ltd – ubuntu.com/legal/intellectual-property-policy.
Moodle™ is a registered trademark of ‘Martin Dougiamas’ – moodle.com/trademarks.
Other names / logos can be trademarks of their respective owners. Please review their website for details.
I am independent from the organisations listed above and am in no way writing for or endorsed by them.
The information presented in this article is written according to my own understanding, there could be technical inaccuracies, so please do undertake your own research.
References
- docs.moodle.org/en/Installing_plugins
- docs.moodle.org/en/Standard_themes#Theme_selector
- moodle.org/plugins/block_theme_selector
- moodle.org/plugins/theme_foundation
Installing
As an administrator, you install the block like any other plugin using the method of your choice, docs.moodle.org/en/Installing_plugins, with reference to moodle.org/plugins/block_theme_selector:
You’ll then get the option of excluding themes and making aliases for them:
Along with the ‘URL switching’, which I’ll describe in a moment, and the ‘Window information’ that I wrote about in ‘What’s in a Screen shot?’.
The best place to put the block is on the home page as that’s the top level, and then make it available on all pages, so after adding the block and selecting the ‘Configure Theme selector block’ from the block editing cog (just like any other block):
We set the block to appear throughout the entire site. After saving changes, you’ll notice that there is a message (if you’ve kept the default setting value for ‘theme_selector_url_switch’):
This is the fastest means of switching theme and also does not change the theme set in the core ‘Theme selector’ (docs.moodle.org/en/Standard_themes#Theme_selector). Search for ‘allowthemechangeonurl’ (which is a core setting) and set it:
Which you can see under ‘Theme settings’ in the screen shot. And that’s it for installation.
Use
Using it is now really easy, simply select the theme you want using the drop down menu:
And the code will detect the change in the selected theme and refresh the page.
You’ll also see a button ‘Reset theme cache’ (along with ‘Window information’ if you’ve enabled ‘block_theme_selector_window’), that is a quick way of resetting the theme cache:
These options are to help theme developers and documentation writers with their work.
Conclusion
I believe that the block is a really useful tool, which is why I maintain it. What do you think please?
- Settings transfer – 16th October 2024
- Added value – 16th September 2024
- What is a developer? – 16th August 2024
Such a useful Block !
I think many organisations could use this, to allow users to change to a Theme that suits them – instead of everyone using the Theme that the marketing department or the Moodle admin thinks is best 😉