The line of code that could

--- a/theme/styles.php
+++ b/theme/styles.php

@@ -116,7 +116,7 @@ $files = array();
 // here can be overridden by theme CSS.
 if ($pluginsheets) {
     foreach ($THEME->pluginsheets as $plugintype) {
-        $files += get_sheets_for_plugin_type($plugintype);
+        $files = array_merge($files, get_sheets_for_plugin_type($plugintype));
     }
 }

That’s the one-line patch I submitted to the Moodle tracker last week. It fixes a bug that was preventing plugins in the upcoming Moodle 2 from being able to include their own stylesheets.

Having been on holiday for a few days, I came back in to work today to find that the patch had been accepted and committed to the core Moodle CVS. This is a first for me, so rather chuffed with myself, I tweeted about it.
This was picked up upon by Steve Lee from OSS Watch who provide advice on the use of Open Source in education. He decided that it provided a good enough example of the benefits of the open development model to be worthy of a post in the OSS Watch blog. All because of one little line of code!

To pick up on some of they key points from Steve’s post, the Open Source model really does prove advantageous when developing software. I’ve been working to update our moodle plugins to use the Moodle 2.0 APIs over the last few weeks, when I hit this bug. The open nature of the code not only helped me find and fix the bug quickly (Tim Hunt, who maintains this code, was on holiday), but being able to submit the patch for inclusion in Moodle’s CVS repository makes it a lot easier for me to maintain the code at my end, rather than having to re-apply the fix every time I pull updates from moodle.org.
The opportunity to interact with the Moodle community is also invaluable, as it has allowed me to discuss various methods of solving the problems I’ve come across, giving me the knowledge to help others with similar problems. I’ve also contributed to discussions on future Moodle developments, such as the formation of the User Interface guidelines. When I studied HCI at university I thought it was a pain, but now I’m in the “real world” it turns out I can put my knowledge to good use!

This is also a prime example of what Jono Bacon posted recently about validation, so thanks to Steve, Tim and Tony for the encouragement!.

Bookmark the permalink.

2 Responses to The line of code that could

  1. Anonymous says:

    Had no idea you were into moodle!!!

    I’m working in implementing a learning platform at the school I work for. I’m the one responsible to installing, testing and managing all moodle issues. I’m really looking forward to version 2.0. We’re running 1.9 now. Would you recommend me to install version 2 already, even though it’s still in beta mode?

    Cheers

    Nando

  2. mark says:

    No, I wouldn’t recommend using version 2 at the moment. It’s in heavy development, certainly not in beta yet.

    I have the luxury of being able to run a testing server alongside our live and development server, so I’ve got it installed to give us a head start at porting our code (plugins we developed and local customisations) across to the new APIs (and reporting any bugs I find along the way), but it’s not ready for a production environment yet. If you’ve got the spare server capacity, it’s certainly worth a look from a developer’s point of view – some very sexy new stuff going on behind the scenes!

    Good to hear you’re using Moodle too, we’ll have to share war stories at some point!

Leave a Reply to mark Cancel reply

Your email address will not be published. Required fields are marked *

Unable to load the Are You a Human PlayThru™. Please contact the site owner to report the problem.