Sunday, November 9, 2014

Improving the Moodle Folder resource by making the folder description appear bold

Image from:

This post is about how to make the Moodle 2.7.2's Folder resource more aesthetic. By default, the Moodle Folder resource's description is shown in the same font as the filename contents. This happens when you choose to display a folder's contents as "inline on a course page".

Here's what it looks like.

As you can see there is no font differentiation between the "My Files" folder description and the filenames which are the contents of the folder.

To solve this, you need to do two things:
(1) hack the mod/folder/renderer.php file

In Moodle 2.7.2, remark line 107.
Then add this line below it:

html_writer::tag('span', s($subdir['dirname']), array('class' => 'fp-filename-bold'));

(2) add this piece of CSS to your theme's general.css file.

.fp-filename-bold {font-weight:bold; font-size: 15px;}

Here's the end-result:

Hope you like this hack. If you find this useful, please spread the word. As I type this words, Carlsen-Anand World Chess Championship Match 2014 is taking place in Sochi, India. I am personally rooting for the 'old man' to win the championship, but the youthful model/soccer player may yet retain his World title. Either way it turns out, let's hope for some great battles over the board!

Frankie Kam

Ratings and Recommendations by outbrain