Drupal 8 saw a dramatic change from previous releases of Drupal. Amongst these changes is a big step towards using an object oriented approach built around the Symfony 3 framework instead of using hooks.
Other changes include a complete rethinking of how themes work with a change to use the TWIG theme engine rather than PHP template. Take a look at some of our Drupal 8 posts below...
Read some of our articles about Drupal 8
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. I have a project I have been using to investigate Drupal 8 since alpha10 which has been invaluable in my learning process. But as a result, some of my code is over 2 years old and written when I barely had a grasp...
For me this is the biggest unanswered question hanging over my development of Drupal 8 websites: How should I add config to a Drupal 8 site? This article will provide plenty of options, but unfortunately no definitive answer.
Class Aliasing is the simple, but very useful solution to the problem of needing to use two classes (from different namespaces) with the same name.
This article will talk you through the steps to follow to write a simple PHPUnit functional (Kernel) test for Drupal 8. I have been doing a lot of work on Drupal 8 migrations for the past few months so that will be the focus of the test.
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...
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! Panic not. The solution is nice and easy, the following snippet will act as a drop in replacement for drupal_is_front_page() - simply returning TRUE or FALSE. \Drupal::service('path.matcher')->isFrontPage();
I recently read the trending article The Web We Have to Save, by blogger Hossein Derakhshan ('Hoder'), who had been imprisoned in Iran for six years. In the article, he talks about how the internet had changed over that time. Quality can be drowned out; what is important is diluted in amongst the trivial. Personally, I believe any expression of culture will reflect the society it flows from. The internet is a global society, so incorporates so many different aspects of humanity - different, good, and bad. What does the internet say about our global society? I believe that we should all take responsibility to some extent -- especially those of us in the business of websites and content on the internet! Can we contribute to a more responsible internet? Are we equipped to do so?
This is part 3 in my series of articles about creating a custom field. I recommend reading Part 1: Field type and Part 2: Field widget first, if you have not done so already. After creating the field type and field widget it is now time to complete the set by creating the field formatter. ##a) Create the file The field type must be located as follows: /lib/Drupal/ /Plugin/field/formatter/ .php
N.B. The field formatter...
This is part 2 in my series of articles about Drupal widgets, and specifically creating a custom field. I recommend reading Part 1: Field type first, if you have not done so already. After creating the field type it is now time to create the field widget. ##a) Create the file The field widget must be located as follows: /lib/Drupal/ /Plugin/field/widget/ .php N.B. The field widget name should be in CamelCase. ##b) Add Contains, namespace...
Having written articles on how to create a Drupal 8 field type, field widget and field formatter I thought that now is the time to explain why you might want to create a custom field type. More specifically, why I have created a custom field. To provide some context: my pet Drupal 8 project is to produce a companion site for players of the Fantasy Football (soccer) game Fantasy Premier League (N.B. this is not...