Drupal

Creating a custom content type & adding fields programmatically in Drupal 7

Although it's very easy to create new content types in the admin section of Drupal, sometimes it's good to do this programmatically to make your brain feel a lot more clever.

Lets pretend we are creating a module called jobs, and in that module we have an install file called jobs.install. The first thing we do is add our hook_install() function that does the following steps:

Eclipse Indigo with PHP PDT & Aptana Studio 3 for Drupal development

I've been using Eclipse for a while now and during that time have slowly compiled a large amount of Drupal related snippets and templates. Unfortunately, one day my computer crashed and all my lovely snippets just disappeared. After locking myself in a dark room and crying for a little while, I thought this would be a good opportunity to upgrade from Eclipse Helios to Indigo. Below are the steps I followed to achieve this using Windows 7.

Creating custom hooks in Drupal and passing variables by reference

The cool thing about Drupal is that it adopts a modular approach. This is great because it enables me to override functionality in a controlled way with the use of those hook thingy-ma-jigs you keep hearing about. As a result, it’s harder for me to break something, and also makes life easier when upgrading code.