Australia’s premium Drupal strategy, design & development experts

Since 2009, we’ve built more large scale Drupal websites in Australia for Government, Media, Education and Enterprise clients than any other company. This specialist experience, coupled with our recognition as one of the Top 5 companies contributing code to Drupal globally, means we can provide full lifecycle services for your complex Drupal websites.
Find out more
NSW Anzac Memorial
ANZAC Memorial

Commemorating 100 Years of ANZAC

A compelling Drupal website design and build by PreviousNext for the Hyde Park ANZAC Memorial promotes community interaction and reflection during the centenary.
View The Case Study

Injecting Dependencies into Drupal 8 plugins

As part of our code review process for a current project, it was suggested that rather than calling the static Drupal formBuilder function to insert a form into a custom block, we actually inject the *Form Builder service* directly into the module, and for bonus points also inject the renderer service.
 
I'd previously had exposure to dependency injection earlier on the same project but hadn’t exactly grokked the concept fully and so with a few pointers in the right direction, I set about refactoring the code I’d written using dependency injection and Drupal services.
 

Refactoring Drupal batch API callbacks to increase testability

Drupal's Batch API is great, it allows you to easily perform long running processes with feedback to the user.

But during Drupal 8's development processes it was one of the remaining systems that didn't get the full object oriented, service-based architecture.

Much of the batch API is largely unchanged from Drupal 7.

But that doesn't mean you can't write unit-testable callbacks.

Let's get started.

A quick gotcha with Drupal 8's libraries.info.yml and aggregated JavaScript

This one tripped me up on a recent Drupal 8 project.

Easy to miss when you're working in a development oriented environment with things like JavaScript preprocessing turned off.

A JavaScript file was being added just fine with aggregation turned off, but not getting added with it turned on.

 

Back to top