
The articles on this page are ComputerMinds' contribution to the Planet Drupal aggregated article feed. Planet Drupal is intended to collate interesting and useful Drupal content from around the web.
We've been getting stuck into Drupal 8 development and have been grappling with the concepts of services, dependency injection and containers. One question that's come up has been: > When should I define a service? Sometimes it's really obvious, suppose you are defining a new way to connect to some 'resource' a bit like a database, yeah that should be a service so that I can swap it out etc. Maybe you are providing a...
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...
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. Workflows like that provided by Workbench Moderation give previews that work nicely, but that involves a lot of complexity with revisions and workflow. It really changes the way you (and your nodes, for...
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: My homepage, originally in French, has had an English translation added, but whilst editing in English, I had to search with the French title in order for the page to come up... with the English title! Here's how to solve this... My...
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 specific audience. Our classic examples are 'Euro English' and 'British English' - in either case, these are special cases of regular English. A more traditional example would be Canadian French - where most content would be the same as French, but some pages would want different spellings or customisations. We came across Amazee Labs' work on language fallback which inspired us to work on the Language Hierarchy project.
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?