In this article I am going to show you a technique I used recently to mock a relatively simple external service for functional tests in Drupal 8.
Inheriting from Symfony (in principle but not implementation), Drupal 8 allows us to define certain services as lazy. Why? Well why the hell not?!
Sometimes, our services get big. Not necessarily in the number of things they do (hopefully not) but in the time it takes for them to get instantiated. As you know, when we define a service and make it a dependency of something else, the service container will instantiate that service and inject it where it is needed. And this happens whether on that particular request that service is used or not.
In this article we will learn how to add entity (form) field widgets to a custom form and also process these values upon submit.
If you’ve been wondering where I’ve been and why I haven’t been writing any articles lately, I am here to put your mind at ease: i’ve been working heavily on my first book about Drupal, called Drupal 8 Module Development. And I am happy to announce that it has finally been published and available for purchase.
In this article I am going to show you how to define menu links dynamically using plugin derivatives and have them show up in a menu.
One of the great things about the taxonomy terms in Drupal has always been their hierarchical readiness. That is, how they can easily be organised in a parent-child relationship via a simple drag-and-drop interface. This feature becomes even more important in Drupal 8 where creating entities for anything you want has become easy so we no longer have to (ab)use taxonomy term entities for everything. Unless, of course, we need this kind of behaviour.
In this article we are going to see how we can store user related data such as preferences in Drupal 8.
In this article we will look at how we can use our own factory class to instantiate a service via the Symfony - Drupal 8 service container.
In this article we are going to look at how we can run some entity queries in Drupal 8 using the Date field in our conditions.
In this article we are going to look at how we can render images using image styles in Drupal 8.