Drupal articles

Create a Drupal ajax link in Drupal 7 (it's easy)

James Silver
James Silver
14th Feb 2012

Part 1: Make the link work without javascript

In this example we have a table listing log entries of some kind. We want to put a delete link against each log entry allowing the administrator to delete the log entry:

The following code is responsible for printing out each link onto the page:


$query = array(
  'tok' => drupal_get_token('delete_log_item' . $flid),
) + drupal_get_destination();
$output[] = l(t('Delete'), 'admin/my-custom-log/delete/' . $flid, array('query' => $query));

The callback of which is defined by the following hook_menu item:


  $items['admin/my-custom-log/delete/%'] = array(
    'page callback' => 'my_custom_log_entry_delete',
    'page arguments' => array(3),
    'access arguments' => array('permission name')...
Read more

Drupal Entity Token Module

7th Feb 2012

The Entity token module is part of the Drupal Entity Module package, it provides lots of new tokens to use everywhere that tokens are currently available. It does this by being aware of the structure of fields on entities and exposing extra options for fields that reference entities. For example, it allows you to use many more tokens about taxonomy terms added to content.

Pathauto

To see this in action we'll consider a simple example.

Say that we have articles about birds on our site, suppose further that each article is about a specific species of bird. We make the...

Read more

Drupal Science Camp - The results

31st Jan 2012

[Drupal Science Camp][dsc] was the first Drupalcamp in the UK of 2012. It was wonderfully organised by [Rachel Lawson][rl] and [Euan Bayliss][eb] at a magnificent venue provided free of charge by Napp Pharmaceuticals Limited.

Computerminds had the privilege of being one of the sponsors of the event. It was great to be able to support a weekend of learning and general Drupal fun.

We'd like to say a big thank you everyone involved with the event, from organisers to attendees and even those that weren't there, but made the event possible. Thank you! It was really great, and sets a...

Read more

Using the Drupal overlay for non-admin paths

28th Jan 2012

Drupal 7 ships with a module called 'Overlay', it is installed by the standard install profile and actually is pretty great for most people. If you don't know what I'm talking about then, it's this:

image

It's basically a nice wrapper around the [jQueryUI Dialog component][jquery_ui_dialog] and has some nice features, like keeping the URL fragment up to date with the page being viewed in the overlay. This means you can create a link that goes to a page, and then opens the overlay automatically, it also means that it doesn't break the 'back button'. Using the drupal overlay it's...

Read more

Drupal Science Camp - 21st & 22nd January - Cambridge (UK)

10th Jan 2012

Drupal Science logoIf you are free on the weekend of the 21st and 22nd and are anywhere near Cambridge (the UK one!) then make your way to the Drupal Science Camp. The details on their website are a little sparse so far, but it's shaping up to be an interesting little event - plus ComputerMinds are sponsoring it, so it's got to be good :)

Tickets are a measly £10 each, and it looks like there is some deal with the local Travelodge with rooms available at £15 each - it's a bargain not to be missed ...

More details and sign...

Read more

Monitoring Varnish

3rd Jan 2012

We put almost all of our Drupal sites behind the excellent Varnish HTTP accelerator, and it gives us a massive performance boost for most site visitors. However it seems to have a tendency to crash without warning and occasionally just dies, leaving our sites down.

We workaround this issue by using another piece of useful kit, called Monit, that keeps an eye on processes on your server and restarts them if necessary.

Installing and configuring Monit is really simple (these instructions are for a Debian based server):

Install

Installation is simple:


apt-get install monit...
Read more

Migrate sites from one Aegir to another

30th Dec 2011

We recently needed to migrate all our sites on one physical server to another server, there were more than 200 sites, and they were all hosted with Aegir. The old server was to be decommissioned, so we had to move all of Aegir's data about the site to the new server import into a new Aegir master on the new server. We also needed to do this with as small amount of downtime as possible.

In the end we migrated all the sites with about 30 seconds of downtime each, here's how:

The setup before

For clarity, here's a...

Read more

Our top Drupal modules of 2011

19th Dec 2011

As the year draws to a close we thought it would be appropriate to look back at an exciting year in for Drupal modules, and to list our top 5 Drupal modules of 2011. To qualify for the list the module had to have it's first release in 2011, and have a Drupal 7 version - other than that, anything goes.

Workbench

The workbench module attempts to provide the sort of editorial interface that many other CMSs provide out of the box, with a single unified interface for content management. Workbench also comes with a couple of plugin modules that...

Read more

Rendering Drupal 7 fields (the right way)

Stephen Tweeddale
Stephen Tweeddale
7th Sep 2011

Drupal 7 brought us Entities, and with them the powerful Field API for 'storing, loading, editing, and rendering field data.' attached to them. If you're managing everything through 'manage fields' and 'manage display' tabs of your content type, then every part of that process is rather wonderfully taken care of for you.

We often, however, come across the need to render a field outside the context of it's entity. A common example might include rendering a node's author in a sidebar block. Sure, modules like Panels and CCK Blocks will do this for you, but doing it manually is actually not that hard.

Read more

Quick tips: Adding an existing project to a drupal.org sandbox

19th Jul 2011

Most projects start with you trying out something locally, getting it working and then after some initial testing you might then want to publish the project on Drupal.org. Sandboxes are a great way to throw up some code and the perfect place to pop random code that others might find useful or a project that you just don't want to maintain. If you go and create one on Drupal.org then you'll get helpful instructions for creating a new git repository and creating a basic module to go in the repository and then pushing that code to Drupal.org's servers. But what...

Read more