How to write a RadiantCMS extension

If you're looking for the short description that boils down the answer: start. Just start writing an extension and you'll know more after that than you do now.

Radiant is a great system for setting up a website. Many developers who contribute to the core or contribute extensions to the community might forget that there may be plenty of users of Radiant who want to do many things with it, but they just don't know how.

That is part of the reason I wrote the Help Extension. Sure, regular users need help understanding how the system works , but people who provide Radiant to their clients could make the entire community better if they could just get past the point where they begin to understand. "Help" is an apt name for the extension, but there may be a downside in that many Radiant developers may not realize that there's plenty of info in there about how to interact with Radiant through an extension.

I do my best to help new developers. I once was a new developer. Scratch that; I still am a new developer.

Start small

Many of our extensions are small in scope. That's a great way to learn and a great way to pave the path to write something more substantial. You can ask for Radiant help on the email lists. Sometimes the community may come to your aid or sometimes the help doesn't come. That may be because of timing (and everyone is busy with other things when you ask for help) or because no one else particularly cares about what you want to do.

Well how do I get help if nobody cares!? Easy. Ask a technical question. But in order to do that, you need to start.

Start building your extension and when you get an error or arrive at an impasse in your code, you'll have plenty of info to either solve the problem yourself or get help from someone else. If nobody cares about your desire to list widgets on your site, someone may be interested in solving a technical problem with you. Developers are like that.

Throw away your code

One of the things I learned in a Drawing class in college was to be willing to throw something away. So many aspiring artists hold on to every piece of work they've done. They might spend hours upon hours on their work and feel like they have reached a pinnacle when the work is done. But they should always be willing to lose the final piece. You should learn something by doing. You should be able to do it again, even if you do it differently the second (or third, or fourth) time around. The same goes for development when you are learning. The benefit of writing code is that you can put it into source control and all those ideas that you first had and threw away, are safe for you to find again.

If you allow yourself to be willing to throw your code away, you'll be helping yourself learn.

Begin again

Solve the same problem twice and you might discover something you hadn't realized the first time around. While this is not an article about the mechanics of writing extensions for Radiant it is about writing extensions and in order to do that, you must first begin.

After all that, this post isn't really about Radiant, it's about not fearing errors, and about not feeling that editing mere code is a daunting task. I want to encourage any would-be developers to be.

Look for saturnflyer in the #radiantcms IRC channel or on the mailing list. Not every experienced developer may help, but most are happy to help. Just come armed with your info: code, error messages, ideas, etc.

Get a FREE sample chapter

Get a sample chapter of Clean Ruby and you'll be added to my periodic newsletter of helpful Ruby tips.