How to invoke a new hook in a Drupal module (and add yourself to a round of beer)

So, you want to allow other modules to hook into your own module. You may have implemented hooks that other modules provide, but does invoking your own hook for a module seem like a dark art? It is as simple as calling one function in your module. All will be revealed shortly, but first, lets look at why you would want to invoke your own hook.

Warning a user when navigating away from a Drupal form without saving

Normal users are not like us. We know that if we leave a page before submitting a form, the data we have added will be lost. Normal users might be happily filling in a web form, get half way through, get distracted and then click on a link and lose their data. Ok, maybe they are exactly like us, because I have done this as well. We are all busy. We all get distracted.

A helpful reminder is in order - a simple popup with a warning, alerting the user to the fact that if they leave the current page, they will lose the data on the form.

How to add rel='nofollow' to Drupal comment links

Do you get a lot of comment spam? I do. Spam prevention services like Akismet and Mollum do a great job at stopping a lot of the spam. But what happens if a user leaves a good, on topic comment and includes a link back to their site, or another site? By default, search engines like Google will treat that link as a vote towards the target site. As far as it is concerned, you added the link. This can be bad for a couple of reasons, the main one being what is known as a bad neighbourhood.

DrupalCamp London - a weekend without tents

I had the privilege of attending DrupalCamp London on the weekend of March 2nd and 3rd. I wasn't really sure what to expect but was hoping it would be like a mini DrupalCon. I was not disappointed one little bit. It was very well organised, the talks and BoFs were fantasic and there was a great atmosphere. The best bit for me was that it was more intimate than a DrupalCon and I found it easier to get chatting to a variety of people.

DrupalCamp London 2013

Practice makes perfect

You may feel like me in that you know you need to keep learning and mastering to stay on top of your game, but are busy all the time and don't know where to find the time to keep learning. It is not enough to just do your day job to get better. But when you are rushed by deadlines, do you really learn enough about what you are doing? Or are you just trying to get the job done?

How to validate a single Drupal form element

You may be used to adding validation functions for an entire form, but what if you just want to validate an individual form element? Do you really need a form wide validation function for a single field? What if you just want to check that a user submits a number in a field?

Start writing custom Drupal modules today!

I am really excited to announce the alpha launch of my digital book/course, Master Drupal 7 Module Development!

Are you building Drupal sites and itching to get to the next level? Are you a developer who is new to Drupal and want to start writing modules asap? Or have you already tried learning module development and spent too long going around in circles?

It doesn’t have too be hard. You can master module development without losing your hair. I have spent a lot of time researching where people struggle and my mission is to make it much easier for you to jump up the Drupal learning curve.

How Drupal returns a page request

You hit a URL and Drupal gives you a page back. Magic! But perhaps you are wondering, what is Drupal doing under the hood? You know that putting it down to magic is not going to help you to create your own custom modules.

Drupal can be a complicated beast. So at this stage, I am not going to go into every little detail. Instead, we will take a look at a simple example to illustrate the main stages in the process.

Symfony Live London Recap

My recap of Symfony Live London. It was my first Symfony event and I thoroughly enjoyed it. Great talks and workshop and full of nice people.

DrupalCon Munich 2012 Recap

My recap of DrupalCon Munich. My second DrupalCon did not disappoint. Great sessions, great people and great venue!

Pages

Hello!

I am Blair Wadman and this where I share tutorials and trouble shooting guides.

My latest project is writing Master Drupal 7 Module Development, a book to help you conquer the sometimes baffling world of Drupal development.

You might like to sign up to my mailing list for tips on getting started with Drupal module development. Includes free Starting Drupal Module Development series (coming soon).

Master Drupal Module Development - 20% off

Sick of all the Googling? Climb the learning curve faster and start module developing today.

Currently 20% off!

Find out more