ElearningWorld.org

For the online learning world

Elearning WorldLMSMoodleMoodleBitesTechnicalThemeUniversal designUX

Plugin name

Introduction

On MDL-74272, I came across a comment wanting the display of the plugin name to be optional as a setting rather than only shown whilst editing:

Plugin name on a module

This got me thinking! Looking into it, I’ve realised that at a basic level with the new Course Format API introduced in Moodle 4.0 that there would probably need to be core changes to make this happen as theme’s can’t change the data that’s used to control the template that renders the name on the page. However, themes can override the template. This I’ve discovered isn’t currently documented all that well. So here goes!

Disclaimers

Names / logos can be trademarks of their respective owners. Please review their website for details.

I am independent from the organisations mentioned 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.

The featured image is my copyright, please don’t use without my permission.

Research

Looking at:

There is nothing specific, so from MDL-73679, I already knew how to override a course format template in a theme, specifically this ‘comment‘, the order of:

  • theme/THEME/templates/FORMATPLUGIN/courseformat/local/content/section.mustache
  • theme/PARENT_THEME/templates/FORMATPLUGIN/courseformat/local/content/section.mustache
  • course/format/FORMATPLUGIN/templates/courseformat/local/content/section.mustache
  • theme/THEME/templates/core_courseformat/local/content/section.mustache
  • theme/PARENT_THEME/templates/core_courseformat/local/content/section.mustache
  • course/format/templates/local/content/section.mustache

It’s then a matter of tracking down the actual Mustache template file that displays the actual plugin name. This turned out to be ‘cmname.mustache’ in ‘course/format/templates/local/content/cm’. Now we have something to work with.

Implementation and changes

All we need to do now is copy the template to a specific folder within the theme’s template folder (if it has one or create it if it does not). Thus ensuring you have the folder structure ‘/theme/yourtheme/templates/core_courseformat/local/content/cm’ and place your copy of ‘cmname.mustache’ in that.

Then it’s a simple matter of editing the file in a suitable UTF-8 editor, such as Notepad++:

cmname.mustache changes which show where 'showpluginname' is to be removed on lines 57 and 61.

And with a bit of Mustache knowledge, removing the guard that controls the display of the plugin name to show it all of the time. Of course, you could always remove it completely and not show it at all.

But how did I know all of this? Well, I have been updating the ‘MoodleBites Theme Design Level 2’ course for Moodle 4.1, and whilst its specifically not there, but template overriding and editing is, it could be if requested. And I’ve been updating my course formats and themes too for Moodle 4.0+ too. Both of are enabling factors that have given me the knowledge to write this post.

Conclusion

What do you think please?

Gareth Barnard
Latest posts by Gareth Barnard (see all)
blank

Gareth Barnard

Gareth is a developer of numerous Moodle Themes including Essential (the most popular Moodle Theme ever), Foundation, and other plugins such as course formats, including Collapsed Topics.

3 thoughts on “Plugin name

  • Séverin TERRIER

    Thanks Gareth for this article.
    Just wanted to complete some elements, relating to the origins of all of this (for people who don’t know all of this):
    – the activity type beeing displayed, it was “in the start”, but only since Moodle 4.0, never before!
    – there was lot of discussions against that, in Moodle’s theme and UI forums. With explaination that when teacher use an activity with a “particular” use, indicating the type is nonsense (and even false relating to the use), as explained in the first comment of https://tracker.moodle.org/browse/MDL-75204
    – then displayed only for teacher since 4.0.7, 4.1.2 (by https://tracker.moodle.org/browse/MDL-77219) and 4.2 (https://tracker.moodle.org/browse/MDL-74272)

    Reply
  • How interesting. I’d never thought of the activity name being displayed – because isn’t that what the icon itself is supposed to communicate?
    I guess it’s a bit like a tool bar in a desktop application – like a browser – where you have options to display icons, text, or both.
    And I suppose there are examples where this could be effective in Moodle.
    1. For people who aren’t so visual, and would just prefer a word
    2. When the icons themselves don’t communicate clearly the activity type … what looks like a “Database” to some people might just look like some lines and dots to others !
    3. When third-party plugin icons haven’t been well designed (they are not under HQ control)
    I also think it could be useful for people who are new to Moodle – so they “learn” the Forum icon, because at first they see the word Forum next to it.
    It’s always good to re-evaluate some of the things we take for granted and seem quite basic from time to time 🙂

    Reply
    • Ah, there’s a whole lot of discussion about this on the forums (I forget where) as some people love the name being there and others hate it! At the start it was there all the time, but now only when editing. Thus, I assume for new educators to quickly identify the modules. But once they have then there is no need for it to be there. Accessibility wise, regardless of the name, then the icon’s title / alternative (as appropriate) needs describing. I think that tooltips for icons are better as that means you can find out what the icon means if you actually want to. The ‘choice’ is being handed back to the learner rather than being preached to and cluttering up the output with duplicated information, i.e. the icon is already telling you the module type.

Add a reply or comment...