Skip to main content

Articles tagged with "Event subscriber"

Replacing a vocabulary listing

29th Nov 2016

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, and improve the listing itself along the way to be more useful, with filters to make searching it much easier. The original listing is not a view, and loads much more than it needs to. Here's the customised page for airports that I wanted to head towards:

Customised airports view

Read more

Drupal 8 Event Subscribers - the successor to alter hooks

Jo Fitzgerald
Jo Fitzgerald
14th Jun 2016

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!"

With the introduction of Symfony, your new BFF is an Event Subscriber. Alter hooks still exist, but it is recommended that we all move towards Events to fall in line with Symfony.

If you are interested in the comparison between alter hooks and events then I recommend this article from PreviousNext.

Introduction

In just 4 simple steps, this article will talk you through the process of writing a custom Event...

Read more