Articles · Page 8
Notes from the team.
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 →Commands I use when creating a patch for drupal.org
Over the past couple of years I have become more active in issues on drupal.org, in which time I have honed a selection of commands that I regularly use in the creation and application of patches. Here is a run-down of my most useful commands.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 with Composer on Apache on Bash on Windows 10!
I've recently been playing around on Windows 10's new Bash on Ubuntu feature, which provides a native bash linux shell for Windows. I thought I'd try and get a Drupal 8 site running, via composer, served from Apache, without any need for a virtual machine in Windows. Kristian…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 →Question: When should I define a service?
We've been getting stuck into Drupal 8 development and have been grappling with the concepts of services, dependency injection and containers.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 →Drupal 8 Event Subscribers - the successor to alter hooks
In Drupal 7 if you wanted to tweak the functionality of an existing function then an alter hook was your best friend, but in Drupal 8 it's "all change!"Read article →Checking if the current page is the homepage in Drupal 8 - not using drupal_is_front_page
We will keep this one short and sweet. There is quite a bit of documentation pointing to the fact that drupal_is_front_page() still exists in Drupal 8 ... it doesn't!Read article →How to write a (more useful) Drush command
Welcome to part two of our miniseries on Drush commands! Do check out part one if you haven't already. There you'll see what we've been up to with our pretend module, my_awesome_module. If you're writing a custom Drush command, it's pretty much guaranteed that you're needing to…Read article →Responsive images with srcset and sizes
Responsive design is now the norm when it comes to developing modern websites, and most of us will be all too familiar with how we use media queries to get our sites looking different on a whole range of different devices. When it comes to getting our images to resize depending…Read article →How to write your own Drush command
Occasionally there's something you need to achieve, which would be really easy if only you could have it performed via Drush - some script that could be run on the server during an update or migration process, perhaps. But it all looks a bit too scary, right? "The task is…Read article →Making an accurate, responsive node preview for Drupal 7
It's a well known fact that a large proportion of sites turn off the node preview button. It just doesn't work well. Your unsaved changes don't show and the admin theme is used in place of your site theme - not helpful.Read article →Language lessons: How can I fix my autocomplete box?
Languages make everything so complicated! I just discovered the autocomplete bit on my reference fields wasn't working - until I tried searching by another language, and then the results gave me a surprise:Read article →Language Hierarchy: More power and flexibility without extra effort
Several of our recent projects have involved setting up languages that feel like 'child' languages of other languages, for a variety of reasons. Sometimes it's for marketing, so that content can be overridden for markets using a specific currency, other times it's to target a…Read article →Saving the web with responsible websites
TL;DR: If the internet reflects society, what does your content say about you? Having flexible and accessible content will allow you to adapt to how people consume your content.Read article →Drupalcamp Bristol 2015 - a talk on build pipes and automated testing
We had a lovely time at Drupalcamp Bristol - and especially enjoyed trying to tell the world about our build pipe and automated testing setup. Sadly Mike's trusty laptop died just as he was about to demonstrate some exciting live action testing - but at least it meant everyone…Read article →Bristol Grand Prix - Bristol, bikes, banners ...
As we mentioned earlier we were extremely proud to be supporting the inaugural Bristol GP, a short course series of bike races in the centre of Bristol. We had a lovely banner at the bottom of Park Street by the start finish, and our friend Tom took some excellent photos.Read article →Creating Custom Hooks in Drupal
Anyone familiar with developing with Drupal will be very familiar with how we use hooks to leverage functionality provided by other modules and the core itself. We use them as part of the course when it comes to wanting to tweak data or even extend some core functionality, but…Read article →Let's talk
Got a Drupal problem you'd like a second opinion on?
You'll talk to a developer, not a salesperson.