Skip to main content
ComputerMinds

Articles

Drupal 8

Migrating Drupal 7 Files into Drupal 8 / 9 Media entities

This article assumes a basic knowledge of the building of custom modules, the Drupal 8 / 9 Migration system, and the processes behind creating customised migrations from a previous version of Drupal.Read article →

Drupal 9, it's here!

Update: Since writing this article the EOL of Drupal 7 has been extended from November 2021 until November 2022.Read article →

A New Years Resolution for maintaining your Drupal site

So 2020 is in full swing, we are already midway through February and any new year’s resolutions you may have set yourself may have slipped … but why not set yourself a new resolution of keeping on top of your Drupal site maintenance? Even as a developer working with Drupal…Read article →

Upgrading your website to Drupal 8 or 9

Update: Since writing this article the EOL of Drupal 7 has been extended from November 2021 until November 2022.Read article →

Drupal 7, 8 and 9 - When to Migrate

Anyone familiar with the Drupal core development lifecycle will know that presently the Drupal community supports two major versions at any one time: the current major release and its immediate predecessor. This means that at ComputerMinds we are currently helping our clients…Read article →

Custom AJAX loading icon

There's nothing like Drupal's stock AJAX spinner (this: ) to make you notice that a site's design hasn't been fully customised. The code from my previous article showing how to fetch a link over AJAX to open in a Foundation reveal popup would suffer from this without some…Read article →

Open links in popups with Foundation

Let me take you on a journey. We'll pass by Drupal content renderer services, AJAX commands, javascript libraries and a popular front-end framework. If you've only heard of one or two of those things, come lean on the experience I took diving deep into Drupal. I'm pleased with…Read article →

Beware File::getFileUri()!

I'll keep this short and sweet, but we thought this would be a useful tip to share with the world as a potential security issue with the combined use of File::getFileUri() and FileSystem::realpath().Read article →

Including form values in an email

Let's say you've built a custom form for your Drupal 8 site. It contains various elements for input (name, email address, a message, that kind of thing), and you want to send the submitted values in an email to someone (perhaps a site admin). That's a pretty common thing to…Read article →

Rebranding ComputerMinds - Part 6: Migration

I volunteered to carry out the migration for the new ComputerMinds site as migration was one of the very few areas of Drupal that I hadn’t delved into thus far. With Drupal 8 becoming more and more popular, now was a great opportunity to learn the migration ropes. Luckily,…Read article →

Rebranding ComputerMinds - Part 5: Development

Let's have a quick look through our development process on this project and pick out some of the more interesting bits. As briefly mentioned in the last article we are using a composer set up and all code is version controlled using git on github. All pretty standard stuff.Read article →

Rebranding ComputerMinds - Part 4: Pattern Lab

We didn’t see this project solely as a chance to rebrand and rebuild for ourselves, it was also an opportunity to try something new and expand our collective knowledge with the potential for using with clients in the future. We had been discussing using Pattern Lab for Front…Read article →

SA-CORE-2018-004

As with every other Drupal agency on the planet, it was another fun evening of frantic patching of client sites last night due to the release of the highly critical SA-CORE-2018-004 security update for Drupal, released on 25/04/2018.Read article →

Get the entity for a route

In Drupal 7, we had menu_get_object() to get the object in code for whichever node, term, or whatever entity makes up the current page. But in Drupal 8, that has been replaced, and entities can usually be operated on in a generic way. If you know the type of entity you want,…Read article →

Help Drupal help your configuration

TL;DR: Define a schema for any bespoke configuration, it's not too hard. It's needed to make it translatable, but Drupal 8 will also validate your config against it so it's still handy on non-translatable sites. As a schema ensures your configuration is valid, your code, or…Read article →

Show elements with form #states when values do not match

I've previously written about dynamic forms in Drupal, using #states to show or hide input boxes depending on other inputs. Since then, Drupal 7 and 8 have both got the ability to combine conditions with OR and XOR operators. This makes it possible to apply changes when a form…Read article →

Loading config programmatically

In Drupal 8, there are many ways to interact with configuration from PHP. Most will allow you to write the config values, but some are read-only. Some will include 'overrides' from settings.php, or translations. There are many layers of abstraction, that each have different…Read article →

Replacing a vocabulary listing

In a recent Drupal 8 project, one of the site's vocabularies had several thousand terms in it (representing airports), which caused its admin listing page to run out of memory before it could render. I wanted to solve this without affecting any other vocabularies on the site,…Read article →

Drupal 8 Views: How to set as admin path

In Drupal 8 admin paths are now defined as part of route definitions so are no longer defined in hook_admin_paths(). In many cases, uniting routing with admin path definition makes things easier - simply add _admin_route: TRUE in a .routing.yml file, but not when it comes to…Read article →

Drupal 8 Views: How to formulate the route name

This article will explain how to formulate the route name for a view because there are very few sources for the information online.Read article →

Dependency Injection - how to access services in controllers

If you are trying to get to grips with Dependency Injection in Drupal 8 then here is a walk-through of how I applied it in one of my Drupal 8 test projects.Read article →

Drupal 8 Config Management - how should I add config to a D8 site?

For me this is the biggest unanswered question hanging over my development of Drupal 8 websites:Read article →

Drupal 8 Namespaces - class aliasing

Class Aliasing is the simple, but very useful solution to the problem of needing two classes (from different namespaces) with the same name.Read article →

How to write a PHPUnit functional test for Drupal 8

This article will talk you through the steps to follow to write a simple PHPUnit functional (Kernel) test for Drupal 8.Read article →