Blog posts

Create a new webform element in Drupal 7

Sometimes the default field types within Webform don't work as we want them to or we want to do something beyond which will work beyond a few hacks in the theme. The following will show you what is required to define a new field type and the necessary functions to make it work.

webform-slider.png

Create a contact form in Drupal 7 using the Webform module

The following tutorial will show you how to create a contact form (or any form for that matter) using the Webform module in Drupal 7.

Download and enable the Webform module in the Modules interface. This tutorial will be using version 3.18.

webform-form.png

Latest Chrome dev release brings rulers to Inspect element

chrome-inspector-small.png

The recent update to Google Chrome dev (Version 23.0.1262.0 dev-m) has brought rulers to the window when using the Inspect Element feature which is becoming increasingly better with each release. Firebug usage from me has significantly dropped.

Drupal 7 - Defining rules within a module using PHP

It took a while to figure out with all information I could easily find relating to the Rules module using the UI to define rules.

But you can define some default rules within your module by using the function MODULE_NAME_default_rules_configuration() which sits within a file called MODULE_NAME.rules_defaults.inc in your module folder.

rules_ui.png

Drupal Commerce - Different prices for different customer groups

What are we looking to do?

When you have an online store, by default a product has a set price which is what everyone pays. You may have discounts through voucher codes but occasionally you want to offer a different price to shoppers i.e. wholesalers.

So what we will be doing is creating a new role called 'Wholesaler', adding a new price field to our product, then we will set up a rule which will calculate the right price for the wholesaler.

The tutorial will be focused around a basic Drupal 7 install with the Commerce module (and the other relevant modules installed).

UK Geocoding and mapping in Drupal 7

Geocoding UK addresses has always seemed to be a pain especially outside of Drupal. With Drupal 7 a few of the mapping/location modules that I have been used to using in Drupal 6 are either not available as a stable release or don't quite do what I wanted. A key example is Location which I have used on a Drupal 6 with which geocoding has never worked (I still don't know if it is something that should work out the box, it certainly seems to imply to me.)

A rash of new Drupal 7 modules has made the process a lot easier though.

Anchor CMSs custom CSS and javascript comes to Drupal through Code per Node

Anchor CMS is getting more attention as of late with one of its key features being able to add custom javascript and CSS per blog post. This allows a lot of custom design to take place which differs per page. An example of this can be found on the creators blog.

Drupal is lacking this feature, but as is the way with Drupal, "there's a module for that". Code per Node does this and more allowing you to add custom CSS and javascript to both blocks and content types as a whole rather than individual nodes.

Drupal 8 dev thoughts

Having just installed the Drupal 8 development version on to a local test site, it has raised a few thoughts.

Of course a lot of these could be fixed or the majority may disagree but either way. We have a long time before Drupal 8 will be shipping and as such have a lot of time to sort out any problems.

"Cannot redeclare class themeregistry" when trying install Drupal 7

When attempting to install Drupal 7 on a server which has a few Drupal 6 installs running without a problem I got a white screen of death after selecting the profile I want to use.

Looking in the log file were quite a few lines stating:

[Wed Feb 08 10:19:55 2012] [error] [client 78.86.177.75] PHP Fatal error: require() [function.require'>function.require]: Cannot redeclare class themeregistry in /var/www/microsites/www/includes/install.inc on line 1120

The problem turned out to be an issue with an APC configuration.

Upgrade to Drupal 7

I have finally got around to upgrading the old site to Drupal 7.

Site is very simple just using a basic view for the blog listing (which I could of just used the standard river of news, but it's nice to know that I can control it whenever I want).

The upgrade process was very simple, there were a couple of issues with modules not working properly mainly due to PHP 5.3 errors but they were easy to overcome or I just got rid of the module as it wasn't really needed.

Pages