drupal

6 tips for auditing Drupal contrib modules

4 comments

One of the biggest tasks when building a Drupal site is selecting, configuring, and integrating contrib modules into your site. For almost everything you need to do "there's a module for that", but whether you should be using that module is an entirely different question.

For every new module I choose for a site, I go through some quick steps and questions (mostly unconsciously now) to determine whether I should risk a module.

Enabling multiple themes in Aegir install profiles

4 comments

Couples using wedful.com can select from a variety of themes for their wedding website. So when building the install profile we wanted to have all of these themes enabled by default. Enabling multiple themes in an install profile should be something simple to do. In fact, the install profile api even has a function just for this: install_enable_theme(array('theme1', 'theme2')).

However, due to the issues I discussed previously with static variables, enabling multiple themes from within an install profile is actually extremely difficult.

Hooking into Drush and Aegir

2 comments

(Disclaimer: I'm still just learning this stuff, so please let me know if you notice anything wrong in here)

If you build and maintain Drupal sites and haven't used Drush yet, it's time you take a look at it. Even if you only use it for very basic things such as downloading and updating modules it can still be a big time saver.

One of the things that makes Drush so powerful is it's flexibility with hooks. Each Drush command can be hooked in at three different levels; before, during, and after it runs. The hooks are pre, validate, and post, respectively. It works slightly differently than the Drupal hook system but the concept is the same.

Static variables and Drupal install profiles

2 comments

I believe that this is not an issue with Drupal 7 as it handles variables differently than D5/D6. However, if you want to make an install profiles for anything earlier than D7 static variables can pose a huge problem. Static varibles are used for caching within a function in PHP. Generally the first time the function is called during a page load the static will be set. The second time it's called there's no need to execute most of the code and the value stored in the static will be returned.

While statics can be convenient and help improve performance, they become a huge problem when the relevant data has been altered partway through a page load and you need to reset the cache. Since the install profile is executed in what's effectively a single page load, static variables become problematic.

Creating nodes in Drupal install profiles

5 comments

One of the toughest things for me personally is coming up content for a new website. Specifically things that resemble an "about" page. I find it significantly easier if I'm given a starting point and something to work from. Once I get started I have no problem writing some decent content.

To make things a bit simpler for couples using Wedful wedding websites we decided to create default nodes with example content. This way users aren't given a blank slate when starting out. We've set up eight default pages to give them a bit of a starting point with the content on their site. Each page contains some example text or questions to give the users an idea of what to write.