Charles Tanton, specialist in professional Drupal development (based in Cape Town, South Africa)

Charles Tanton (Park Road Web Development) specialises in professional Drupal web development. I develop, build and maintain Drupal websites that add value to organisations and businesses. I have been working with Drupal for more than 13 years. Currently I am open to working on existing or building new Drupal 8 sites, as well as migrations to Drupal 8. I am particularly interested in working on projects that have a measurable positive environmental impact.

Park Road Web Development is based in Cape Town, South Africa, but I can work with you no matter where you are in South Africa, Europe, the USA or anywhere in the world.

Contact me if you need help with your existing or new Drupal 8 site, or Drupal 8 migration.

Charles.

Most recent work

Tag1 Consulting Drupal 10 backend and frontend work

Tag1 consulting

Since July 2019, I've been contracted by Tag1 Consulting, and am currently working as part of a team doing Drupal 10 frontend and backend work for one of their clients, a US based, Fortune 10 tech company (I'm not allowed to say who). We've been prototyping a number of potential new sites, and helping some of their in-house teams maintain and add features to existing sites.

Read more...

The Internet Advertising Bureau (IAB) UK Drupal 7 to Drupal 8 Migration

IABUK Drupal 8 website home page

I was contracted by LAB to manage the migration of content from the old IAB website (Drupal 7) to an under construction, Drupal 8, IAB UK website. I successfully set up and ran migrations for 16 Drupal 7 content types (including some with field collections), to some fairly complex, paragraph based, new Drupal 8 content types. This included document and image migration, as well as taxonomy migration. Some custom migration plugins had to be created to convert data from the old site into the correct format that the new site required.

Read more...

Most recent blog posts

Using filter_var for boolean environment variables

Submitted by charles on

Someone on my team added the following setting to check whether an environment variable was true or false:

$settings['x_menu_admin_enable'] = strtolower(getenv('X_MENU_ADMIN_ENABLE')) === 'true' ? getenv('X_MENU_ADMIN_ENABLE') : FALSE;

I find that using PHPs filter_var makes this code a bit easier to parse and only calls getenv once:

Custom validation on a views field plugin options form

Submitted by charles on

When validating an options form for a views field plugin class that extends FieldPluginBase, you need to add a `validateOptionsForm()` function and use an array for getting the value although when setting the error you don't need to include 'options':

/**
 * {@inheritdoc}
 */
public function validateOptionsForm(&$form, FormStateInterface $form_state): void {

Get the full message from your Guzzle Response exception object

Submitted by charles on

I was trying to debug a Guzzle response error but the error message was fairly long and some crucial information about which specific API fields were unauthorized was missing. The Guzzle Client Exception object has some handy methods to allow reading the full message contents:

$exception->getResponse()->getBody()->getContents();

The drush "entity:save" command in Drupal

Submitted by charles on

In Drupal, there's a drush entity:save (alias esav) command which is useful when you want to save entities in bulk.

I needed to use this command the other day to save some entities that update a field value on the entity during a presave hook. Instead of running a database update to change the data, I just triggered the update by saving the entities, e.g

drush esav your_entity_type_id 12167,12168,12169,12170,12171,12172

To save all entities of a type, you can use: