Skip to main content

Planet Drupal

Content that's out of this world ...

Planet image
The articles on this page are ComputerMinds' contribution to the Planet Drupal aggregated article feed.  Planet Drupal is intended to collate interesting and useful Drupal content from around the web.

Language lessons: Getting started

24th Mar 2014

I recently got the chance to implement Drupal's multilingual capabilities on a major client site. Drupal has some of the best functionality around for localizing & translating a site, but it does take quite a lot to understand & configure. We will host a series of articles on this, entitled 'language lessons', starting on ... how to get started!

Getting started with multilingual Drupal 7

The first places to visit when getting started with languages in Drupal are the Drupal.org handbook page and Gábor Hojtsy's blog. Among other things, Gábor heads up the multilingual initiative for Drupal 8, which...

Read more

Where is my content coming from?

5th Mar 2014

I was asked at Drupalcamp London how to identify where parts of a panel come from. Whether you need to change something on a site you inherited, are looking to trace your steps back on something you created long ago, or need to understand how to fix a colleague's mistake, it can be helpful to have a toolkit of methods to find out what produces all sorts of mystery content - not just for panels, but also views, blocks, fields, and the like.

Read more

Drupal 8: Creating a custom field - Part 3: Field formatter

Jo Fitzgerald
Jo Fitzgerald
11th Feb 2014

This is part 3 in my series of articles about creating a custom field. I recommend reading Part 1: Field type and Part 2: Field widget first, if you have not done so already.

After creating the field type and field widget it is now time to complete the set by creating the field formatter.

##a) Create the file
The field type must be located as follows:

<module_name>/lib/Drupal/<module_name>/Plugin/field/formatter/<field_formatter_name>.php
N.B. The field formatter name should be in CamelCase.

##b) Add Contains, namespace and use
In the newly created field type file add a brief comment to explain...</field_formatter_name></module_name></module_name>

Read more

Drupal 8: Creating a custom field - Part 2: Field drupal widget

Jo Fitzgerald
Jo Fitzgerald
4th Feb 2014

This is part 2 in my series of articles about Drupal widgets, and specifically creating a custom field. I recommend reading Part 1: Field type first, if you have not done so already.

After creating the field type it is now time to create the field widget.

##a) Create the file
The field widget must be located as follows:

<module_name>/lib/Drupal/<module_name>/Plugin/field/widget/<field_widget_name>.php</field_widget_name></module_name></module_name>

N.B. The field widget name should be in CamelCase.

##b) Add Contains, namespace and use
In the newly created field type file add a brief comment to explain what it consists of:


/**
 * @file
 *...
Read more

Drupal 8: Creating a custom field - Using a custom field

Jo Fitzgerald
Jo Fitzgerald
31st Jan 2014

Having written articles on how to create a Drupal 8 field type, field widget and field formatter I thought that now is the time to explain why you might want to create a custom field type. More specifically, why I have created a custom field.

To provide some context: my pet Drupal 8 project is to produce a companion site for players of the Fantasy Football (soccer) game Fantasy Premier League (N.B. this is not my site :) ). For the uninitiated, Fantasy Football, as described by Wikipedia, is "a game in which participants assemble an imaginary team of real...

Read more

Drupal 8: Creating a custom field - Part 1: Field type

Jo Fitzgerald
Jo Fitzgerald
28th Jan 2014

I have been experimenting with the Alpha release of Drupal 8 and so I'm sharing some of my experiences so that you can avoid the pitfalls I have encountered.

First I would like to give credit to the two articles I used during the exercise:

Hopefully this article will provide a third point-of-view to make your task easier.

a) Create the file

In D8 the location of files is very important. The field type must be located as follows:...

Read more

Place blocks inside your content with EBA

13th Jan 2014

Previously on this website I have written about rendering blocks programmatically and adding things to content to be managed alongside fields. It's time to combine the two! On many projects, we find ourselves needing to render a block consistently across all content of a certain type. For example:

  • Are you trying to place advertising blocks or fixed javascript code between the fields in the content of a page, not just shoved into regions around the content?
  • Do you want to show a standard piece of content (we use the bean module for enhanced content in blocks) to be placed...
Read more

You should use Entity cache

23rd Jul 2013

If you have a Drupal 7 site, then you should be using the [Entity cache][ec] module, here's why:

Lots and lots of things in Drupal are 'entities', such as the content, the users, the taxonomy terms and if you're using contrib modules like [Field collection][fc] or [ECK][eck], then those are entities too.

Most of the time you have some fields on those entities, then every time Drupal needs to load one up, it'll also have to read the data for each field from these tables. Once you start having lots of entities, and potentially field collections on those entities, you...

Read more

Drupal Job Scheduler : Easily scheduling periodic tasks

11th Dec 2012

Sometimes as a module developer you need to have some code execute periodically, like maybe every day or even once a week. This might be to optimise an external system, or pull in some external data or to compute some statistics every day etc. Drupal provides a very simple way of doing this: hook_cron but if you want your code to only execute say once a day or after 6pm only, then you have to add extra logic to your implementation. However, the [Job Scheduler][js] module provides a nice framework for setting up and running these periodic functions.

To use...

Read more

Automated deployments using Aegir

16th Oct 2012

There are a few write-ups about using Aegir to automate your deployment process notably one from Mig5: Zero-touch Drupal deployment with Jenkins, Aegir, Git, Fabric and Drush. I recently wanted to set this up for our own project, but felt like I could make some improvements.

I don’t like deploying branches, because it can be really hard to actually find out what was deployed at a later date, and you can’t reliably re-deploy that previous code later on. I think it’s much better to deploy tags. It also gives you an easy way to flag when you do want to...

Read more