How I Learned Drupal Module Development
When I started out with Drupal over a year and a half ago, I knew nothing about web design, CSS, HTML or anything. I was completely a blank slate. I knew I wanted to eventually develop Drupal modules and get into the programming side of things but the problem was I had no idea where to start. I posted in forums, talked with people and heard a bunch of different recommendations, most of which I didn't follow because they didn't make sense for someone just starting out. It was just the same answer was just handed down from person to person without any thought. Therefore, this post is going to show you how to learn Drupal module development the easiest way (I found) possible.
Step 1: Watch some PHP videos
You aren't going to be able to program in Drupal if you don't know any PHP. If you don't know any PHP right now, DO NOT stop reading. I didn't either but PHP is a very friendly language and you don't have to have a computer science degree or thousands of dollars to get started. Search for free PHP video tutorials, like my Drupal video tutorials. Here is a good site I like http://www.phpvideotutorials.com/.
Basically, you should be familiar with variables, functions, operations, loops, if statements and arrays. Once you have a good handle on these concepts, you are ready to get going to step two.
Step 2: Learn to use the Views Module
This might seem a bit weird but when I asked everyone the best way to get started with drupal module development, everyone kept saying, create patches, look at existing issues and try to solve help, talk with module developers on what patches you can create, etc. It wasn't helpful to look at behemoth modules and try to solve minor issues. So, enter Views.
If you aren't already familiar with thew views module, you should be. Essentially it allows you to create custom database queries from a clean user interface, no programming required. That said, once you start getting into views, you'll realize how dependent you become on it. At the same time, it is a great tool for finding different queries you need to run that you could be programming yourself!
That's right, instead of using the views module, create a custom module and run the query yourself.
Step 3: Put your query in a block or the node body
Querying the database repeatedly can only teach you so much. While you will learn the basics of getting data, parsing it, and returning it back as content, this can get boring fast. So start hooking into Drupal to create cool content. Start out with hook_block and create your own block. I have a good drupal video tutorial here showing you how to do that. Now you're getting past plain querying and into if statements, using PHP logic to decide when to return something etc.
To take it a step further, try to append your content to the bottom of a node using hook_nodeapi. Try to do it only for a certain content type. Additionally, you could be doing this at the theme layer and using hook_form_alter and changing how your forms are rendered. Try to remove parts of the form and render them out of order. Really, the key here is to start trying to do things on your own instead of relying on the usual tools (time permitting of course).
Step 4: Keep Going
So many times I got frustrated and wanted to give up. It's natural. Drupal is tough to learn but that is changing. If you have problems, look through the forms, use Drupal IRC chat, post on twitter using #drupal, just don't give up.
An Extra Step:
I know I learn well with video tutorials, that's why I create my Drupal Video Tutorials, however some learn better out of a book. If you prefer to read, the #1 book I recommend is Drupal Pro Development.
This book is awesome and really beginner friendly. It provides a number of different examples and I found it most effective when I worked at the computer while reading it. I would follow the examples along and program them simultaneously. And to be completely transparent, if you follow this product link, I do make a commission off of all sales.
Well, that's it. I hope this helps. Happy Development!
pete

Comments
Post new comment