Hooked into Drupal
In my last blog I mentioned how Drupal really does seem to offer more than just the ability to get a simple site up and running quickly.
Framework
When you look at Drupal more closely you realise one key thing: it’s not really a CMS, it’s a framework. Granted, nothing quite like Symfony in terms of its level of sophistication, but a framework nonetheless. Even a fairly modest PHP developer can therefore take what’s there and build on it in quite surprising ways. The vast array of Drupal modules is testament to that.
Hooks
That’s what makes Drupal so alluring as a CMS. It’s founded on a system of hooks: naming conventions which ensure that pieces of code you write will get called in certain pre-defined situations.
The simplest example of a hook is the menu hook. If you build your own module, all you need do is put a function in it called mymodule_menu and whatever code you put in that function will get called each time the core code builds the main site menu.
The real elegance of the system is that almost everything is built from hooks. Even stuff which looks like it’s part of the core code, like user management. Well, that’s actually a module built up using hooks. If you want to build your own slightly different user module, you don’t need to change the existing one. Just copy it, taking out the bits you need, adding in your own bits. Before you know it, you’ve got your own custom user module.
Community
The learning curve can be a little daunting at first, assuming you want to get your hands dirty with some module coding. Luckily, there are loads of excellent books (I can definitely recommend Pro Drupal Development by John VanDyk), web pages, blogs, etc around to help. Just google them, they’re out there! That’s another great strength of Drupal: the community. No matter how stuck you are, how bad things look. Chances are there’s someone out there who’s been in exactly your situation and come out the other end.