Wim Leers: A dozen years of Drupal

Last week was my twelfth Drupalversary!

The first half dozen years as a volunteer contributor/student, the second half as a full-time contributor/Acquia employee. Which makes this a special Drupalversary and worth looking back on 🙂

2006–2012

The d.o highlights of the first six years were my Hierarchical Select and CDN modules. I started those in my first year or so of using Drupal (which coincides with my first year at university). They led to a summer job for Mollom, working with/for Dries remotely — vastly better than counting sandwiches or waiting tables!

It also resulted in me freelancing during the school holidays: the Hierarchical Select module gained many features thanks to agencies not just requesting but also sponsoring them. I couldn’t believe that companies thousands of kilometers away would trust a 21-year old to write code for them!

Then I did my bachelor thesis and master thesis on Drupal + WPO (Web Performance Optimization) + data mining. To my own amazement, my bachelor thesis (while now irrelevant) led to freelancing for the White House and an internship with Facebook.

Biggest lesson learned: opportunities are hiding in unexpected places! (But opportunities are more within reach to those who are privileged. I had the privilege to do university studies, to spend my free time contributing to an open source project, and to propose thesis subjects.)

2012–2018

The second half was made possible by all of the above and sheer luck.

When I was first looking for a job in early 2012, Acquia had a remote hiring freeze. It got lifted a few months later. Because I’d worked remotely with Dries before (at Mollom), I was given the opportunity to work fully remotely from day one. (This would turn out to be very valuable: since then I’ve moved three times!) Angie and Moshe thought I was a capable candidate, I think largely based on the Hierarchical Select module.
Imagine that the remote hiring freeze had not gotten lifted or I’d written a different module? I was lucky in past choices and timing.
So I joined Acquia and started working on Drupal core full-time! I was originally hired to work on the authoring experience, specifically in-place editing.
The team of four I joined in 2012 has quadrupled since then and has always been an amazing group of people — a reflection of the people in the Drupal community at large!

Getting Drupal 8 shipped was hard on everyone in the community, but definitely also on our team. We all did whatever was most important; I probably contributed to more than a dozen subsystems along the way. The Drupal 8 achievement I’m most proud of is probably the intersection of cacheability and the render pipeline: Dynamic Page Cache & BigPipe, both of which have accelerated many billions responses by now. After Drupal 8 shipped, my primary focus has been the API-First Initiative. It’s satisfying to see Drupal 8 do well.

Biggest lessons learned:

  1. code criticism is not personal criticism — not feeling the need to defend every piece of code you’ve written is not only liberating, it also makes you immensely more productive!
  2. always think about future maintainability — having to provide support and backwards compatibility made me truly understand the consequences of mistakes I’ve made.

To many more years with the Drupal community!

Jeff Geerling’s Blog: Make composer operations with Drupal way faster and easier on RAM

tl;dr: Run composer require zaporylie/composer-drupal-optimizations:^1.0 in your Drupal codebase to halve Composer’s RAM usage and make operations like require and update 3-4x faster.

A few weeks ago, I noticed Drupal VM’s PHP 5.6 automated test suite started failing on the step that runs composer require drupal/drush. (PSA: PHP 5.6 is officially dead. Don’t use it anymore. If you’re still using it, upgrade to a supported version ASAP!). This was the error message I was getting from Travis CI:

PHP Fatal error:  Allowed memory size of 2147483648 bytes exhausted (tried to allocate 32 bytes) in phar:///usr/bin/composer/src/Composer/DependencyResolver/RuleWatchNode.php on line 40

I ran the test suite locally, and didn’t have the same issue (locally I have PHP’s CLI memory limit set to -1 so it never runs out of RAM unless I do insane-crazy things.

Dries Buytaert: Soft-launching your new Drupal theme

Have you ever wanted to preview your new Drupal theme in a production environment without making it the default yet?

I did when I was working on my redesign of dri.es earlier in the year. I wanted the ability to add ?preview to the end of any URL on dri.es and have that URL render in my upcoming theme.

It allowed me to easily share my new design with a few friends and ask for their feedback. I would send them a quick message like this: Hi Matt, check out an early preview of my site’s new design: https://dri.es?preview. Please let me know what you think!.

Because I use Drupal for my site, I created a custom Drupal 8 module to add this functionality. The module is probably too simple to share on Drupal.org so I figured I’d start with sharing it on my blog instead.

Like all Drupal modules, my module has a *.info.yml file. The purpose of the *.info.yml file is to let Drupal know about the existence of my module and to share some basic information about the module. My theme preview module is called Previewer so it has a *.info.yml file called previewer.info.yml:

name: Previewer
description: Allows previewing of a theme by adding '?preview' to URLs.
package: Custom
type: module
core: 8.x

The module has only one PHP class, Previewer, that implements Drupal’s ThemeNegotiatorInterface interface:

The function applies() checks if '?preview' is set as part of the current URL. If so, applies() returns TRUE to tell Drupal that it would like to specify what theme to use. If Previewer is allowed to specify the theme, its determineActiveTheme() function will be called. determineActiveTheme() returns the name of the theme. Drupal uses the specified theme to render the current page request.

Next, we have to tell Drupal about our theme negotiator class Previewer. This is done by registering it a service in previewer.services.yml:

services:
  theme.negotiator.previewer:
    class: DrupalpreviewerThemePreviewer
    tags:
      - { name: theme_negotiator, priority: 10 }

previewer.services.yml tells Drupal to call our class DrupalpreviewerThemePreviewer when it has to decide what theme to load.

A service is a common concept in Drupal (inherited from Symfony). Many of Drupal’s features are separated into a service. Each service does just one job. Structuring your application around a set of independent and reusable service classes is an object-oriented programming best-practice. To some it might feel complex, but it actually promotes reusable and decoupled code.

Note that Drupal 8 adheres to PSR-4 namespaces and autoloading. This means that files must be named in specific ways and placed in specific directories in order to be recognized and loaded. Here is what my directory structure looks like:

$ tree previewer
previewer
├── previewer.info.yml
├── previewer.services.yml
└── src
    └── Theme
        └── Previewer.php

And that’s it!

Drupal Atlanta Medium Publication: An 8-Year-Old Drupal Core Issue That the Community Needs Help to Solve

Themes improperly check renderable arrays when determining visibility

Photo by Hello I’m Nik on Unsplash

One of the many great advantages of being a part of an open source project is that there are so many smart people out there are willing to contribute their time for the betterment of the project. This ability to crowdsource bugs and feature requests that rarely stumps the community is what makes Drupal such a powerful application.

While rare, sometimes the community finds a bug that is very difficult to solve. Let me introduce you to [#953034] Themes improperly check renderable arrays when determining visibility.

[meta] Themes improperly check renderable arrays when determining visibility

I was first introduced to this bug while trying to add a view block in the left sidebar. When the view was empty I expected the block and the sidebar to not be displayed. As you can see below, while the block was empty the sidebar was still being rendered.

The sidebar is Still being displayed.

I then googled and stumbled upon another issued, Empty view causes region to be displayed and it was exactly what I was looking for, but I noticed it was marked as a duplicate issue and linked to [#953034] Themes improperly check renderable arrays when determining visibility. This bug was reported to Drupal 7 core on October 26, 2010. The issue has over 310 comments and 230 followers.

You can really tell the severity and complexity of an issue when you see some of the brightest Drupal contributors have been making suggestions and striking out. They include but are not limited to:
bleen, chx, Cottser, Crell, DamienMcKenna, EclipseGc, Fabianx, Jeff Burnz, jenlampton, joachim, joelpittet, JohnAlbin, lauriii, markcarver, mdrummond, moshe weitzman, mpotter, samuel.mortenson, tim.plunkett, webchick, Wim Leersxjm.

While I am not a backend developer, I felt like I could still help by highlighting a major issue that maybe someone either inside or outside the community could help find a solution.

Please remember to read the complete issue before commenting as so many people have suggested solutions to fix but have ran into a roadblock.

[meta] Themes improperly check renderable arrays when determining visibility

If you are interested in contributing blog post or want to get more involved with the Atlanta Drupal Users Group (ADUG) please feel free to reach out info@drupalatlanta.org


An 8-Year-Old Drupal Core Issue That the Community Needs Help to Solve was originally published in Drupal Atlanta on Medium, where people are continuing the conversation by highlighting and responding to this story.

OpenSense Labs: Lights, Camera and Action with Drupal

Lights, Camera and Action with Drupal
Vasundhra
Thu, 12/27/2018 – 11:51

Ah! those days, when copies of movies were sold in the form of DVDs, fast forwarding and rewinding through the scenes made us feel that the power is all in our hands. 

But with the evolution in technology and internet presence  (in terms of marketing a film), the need for a movie website has come a long way after witnessing a growth in streaming services.  

An image of an apple laptop in grey and black background with   chairs placed on the keyboard

Setting up a movie website means understanding the goals of building it in the very first place. Be it a teaser website, production blog, or a distribution site – depending on the demand of the audience, web development is brought into action.

And nothing does a better task than Drupal. Often preferred by brands that deal with a high volume of traffic, this  CMS platform would offer you effective features and functionalities for your website.

What Does Drupal Offer Your Website With?

Choosing a Content Management System for your website is like choosing the cast for your movie. And Drupal proves to be the CMS which give the best of “all worlds”. It would provide you with an ample number of functionalities and fulfill all your customer’s needs. 

Starting from:

Content Authoring 

While you are creating your movie website, there might be instances that would lead you to a situation in which you wish to edit your content or any particular page. It may be a change in the movie title or modification in the synopsis.

Drupal 8 features bring about an unusual power into the hands of content authors. With modules like WYSIWYG CKEditor, drafting and editing content have become a piece of cake.

The use of client-side editors to edit content, installing and integrating choice editor has been made even more simple. It includes HTML editors (i.e WYSIWYG), pseudo-editor (to insert markup into text area) and  flash based applications (for production of animation)

The WYSIWYG module also presents you with an abstraction layer for other Drupal modules to integrate with the editor which implies that Drupal modules can expose content editing functionality, indifferent of what editor has installed.

A GIF on how to add and edit content on Drupal

New Theme Engine

Just like resolutions are important for deciding the quality of a movie, a theme also plays a vital role in your website. When an individual visits your movie website, the very first thing which would attract them would be its theme. An interesting and impressive theme would never backfire when it comes to user experience.

Theme engine combines data with templates from themes and shows the final HTML result to the user 
A flowchart with orange, black and blue-colored boxes showing   how the theme engine combines data with a template and shows a substantial result page
Source: Github

Drupal 8 includes a brand new theming engine called Twig, which is PHP-based, flexible, fast, and secure. It helps in creating a beautiful and functional website that has a much simpler syntax. Offering features like template inheritance, automatic escaping, variable filters, and macros to improve the development workflow. 

Responsive Designs  

According to Statista,  52.4 percent of the global web traffic is originated from mobile devices (making it half of the population) which clearly implies the importance of responsive designs. 

Responsive Designs would improve user experience which would in return portray a positive impression for your movie website. If your fans are able to easily access your website, it would more likely to increase the numbers in terms of traffic and bring out a good number of conversion rates even in the future.

Drupal 8 is mobile first in its approach. All the built-in themes that come with Drupal 8 are responsive, along with an admin theme that adapts to different screen sizes. This would allow different users to access your website at different places on various devices. A module like Breakpoint, which comes with Drupal core, resizes the website and images according to the device.

Nordisk Film Cinema is a great example of this. They wanted a responsive and a visually engaging website with cutting-edge functionalities. This was demanded so that the current and future website users have the power to easily navigate the site regardless of the device they were using. The requirement of the responsive site was also because many visitors use their smartphones to buy tickets on the go. Thus Drupal was the best choice for them. 

Four mobile screens placed horizontally where the right part of one phone overlaps the left part of the succeeding phone

Security 

While you are funding for the construction of your movie website, you expect it to be secure and safe from hackers and potential viruses. Drupal has a very good track record when it comes to security, and has recognized process for investigation, verifying and publishing security problems. When it comes to security, Drupal vulnerability statistics clearly depicts security attacks that have considerably reduced over the years.

A bar graph of  vulnerability by year and type
Source: Etondigital

You can easily enhance the security of your website with help of Drupal security modules like captcha (response test to determine whether a user is a human or not), password policy (enforces restrictions in users passwords), security kit (protects the website from cross-scripting, cross-site requesting, click jagging etc), two-factor authentication (provides extra security with code authentication on mobile) 

Not only this but Drupal design meets all the security standard of the Open Web Application Security Project (OWASP). Hence, Drupal core, being highly secure, builds sites that can be patched within minutes. This lowers the risk of broken features or any error to a minimum.

Migration 

Entertainment Weekly was one of the sites that were stuck managing content across ten different WordPress VIP blogs and a large legacy Vignette site. They needed to incorporate their digital content and implement a rapid publishing solution to lower the time between publishing and going live.

An agency was approached to help migrate content and integrate editorial workflow onto a single Drupal-based solution. Migration of more than 20 years of content was all needed to be considered for the creation of the platform. Drupal was chosen because of the fact that its core consisted of the migrate module that provides API and base implementation for importing up of data. 

Similarly, at any instance of time, you might feel a need to migrate from one site to another, and that is the reason why Drupal is the hero for you. The core migrate module in Drupal 8 provides APIs and base implementation for importing data into Drupal.  

A screenshot of entertainment weekly website

Web Hosting 

It is important to buy a web space to build your movie website in order to get it live and active on the internet. 

This is only possible with the help of web hosting. Drupal 8 provides you with many web hosting options. Which are safe to use and efficiently handles your site traffic.

So, if you want to make a better choice when it comes to web hosting companies, you can choose:

  • Pantheon
  • Liquid Web
  • InMotion
  • Bluehost
  • Site5
  • Pair
  • Omega8.CC
  • Drupion
  • Green Geeks
  • Black Mesh  

Manages Configuration

Configuration Management is an important factor of any CMS platform. In Drupal 8 configuration data is stored in files, separated from the site database, and has configuration management built into it at the file system level. Carrying configuration elements from local development to the server has been made really easy with Drupal 8.

The contributed module in Drupal 8, i.e Config Filter helps in built-in configuration management capabilities by providing an API to support different workflow which filters out or modifies configuration changes as being pushed to the configuration. 
Config Split is an another contributed module in Drupal 8 that builds on top of Config Filter that allows a difference in configuration between various environment.  

Managing configuration would allow you to establish a consistency in terms of performance and also eliminate the time to build out additional resources without worrying about the user prone errors. 

Configuration Management System in Drupal can manage things like:

  • Modules setting and states 
  • Content Types
  • Block Types
  • Permissions
  • Views
  • Theme Settings

Content Architecture 

We have reached a point where the old drupal hymn “create content first and see it later” is not enough to succeed with the content editors. Hence, Drupal is competing and replacing other CMS when it comes to content architecture. Content Editors expect full flexibility on how to create, display, approve and publish content. Modules like panels and panelizer, a distribution like panopoly and demo framework have helped in the modification of panorama in Drupal.  

One of the most important steps of building your movie website is deciding how to structure your content architecture. There are ample numbers of ways in which you can build out complex content type in Drupal 8. Here, every piece of content is an entity that stores different types of content.

Your movie website would have entities like the cast, edition, categories, review, collection and so on.

Flow-chart on different types of entities

Drupal modules like views contribute largely to the whole structure of the content architecture. With this Drupal 8 feature firmly integrated with the core, the creation of pages, blocks, admins have been made easy.

Menu module in Drupal core is the static hierarchy of the content. This module allows the administration to customize the websites navigation menu. You can easily add new menus and edit the existing ones. Apart from these two, Entity reference field or link field explicitly allows the addition of link from one content item to another. 

Accessibility 

In addition to providing subtitles in multiple languages for a worldwide audience, understanding the need of closed captions and audio description have broadened the customer base to include hundreds and millions of people worldwide who have hearing loss and vision impairments. 

Making a movie accessible is not only a choice but a legal requirement as well.

Accessibility for the visually impaired community is a really important factor for creating any website. Drupal 8 has excellent support for industry standards like WAI ARAI, and with the help of screen readers and other assistive technology, Drupal is ensuring accessibility at a much bigger level.

 An image of a laptop where two hands are presenting it and on top of it is the diagram of settings, an eye, and ears placed horizontally

Performance 

We all are aware of the three-second rule implemented on a website. Even the smallest change in a website page results in the modification of the traffic noticeably. Hence, speed immensely contributes to the strength and the performance of the website.

Drupal 8 caches all the entities, and helps in the speed and streaming sector to optimize the performance as it is needed. With modules like varnish and redis this task is easily achievable. These modules allow the developers to optimize the site load performance for the end-user significantly.

Drupal 8 core also consists of a module which is the Big Pipe that loads the dynamic pages quickly by loading various section of the webpage in parallel. It is done so that the end users do not have to wait for the Document Object Model (DOM) to be completely ready to start an interaction with the website. Drupal allows the user to tinker with the core. A programmer can twist out a lot of performance boost from a Drupal website. It primarily caters to the enterprise market, hence the websites are well suited and handled with a large volume of data and thousands of pages. It should be noted that a well managed Drupal website rarely goes down or slows down the procedure. 

Multilingual and Multisite Capabilities 

Drupal’s multisite feature allows the user to share a single Drupal installation site core. This is specifically useful for managing the code since each upgrade only needs to be done once. Every site would have its own database and it would also have its own configurational settings. If you have a complex site or a very different site to manage then Drupal multisite is the best option. 

Drupal is also capable of supporting and managing multiple language out-of-the-box. Which means support for the translation of the content as well as for the translation of the back-end user interface of the CMS itself. Having the support of the multilingual website means more audience. With the addition of only four modules in Drupal 8 for language support, all the monolingual and non-english website are easily translated. 

A screenshot of the homepage of Turner Broadcasting General Entertainment

A great example of this would be Turner Broadcasting General Entertainment multi-site which is built on Drupal platform. The site consists of entertainment brands like Cartoon Network, Boomerang, CNN etc. Drupal was primarily used because of its multilingual and multi-site capabilities. It successfully built enterprise-level CMS websites, and scaled to a high level of traffic and maintained availability and performance.

Getting Noticed 

Once you have a website, you need to get it noticed so that people will start visiting it. In other words, if the website ranks high it would definitely get noticed. Drupal has some set of modules which does the task pretty well. Modules like Pathauto, Meta tag, Site verification, Path Redirect, and Google Analytics help in creating URL paths and optimize search engines. 

  • Pathauto

Drupal automatically operates and generate path identity for the content without asking the users to specify the path identity. These identities are based on pattern system that uses token with the administrator.

 An image of the Pathauto module saying hello world with a shade of blue on the screen

 

  • Path redirect

Drupal allows the user to redirect from one path to another path utilizing HTTP redirect status. This would prevent the user to encounter with error 404 if the path was changed or redirected at some instance. 

An image of the Drupal module known as path direct

 

  • Site verification

Drupal is such a user-friendly domain that it allows them to verify the site and domain ownership for a search engine. There are two types of methods which support verification – the addition of meta tags or uploading a particular file. 

  • Meta Tags

Drupal automatically grants the users with structured metadata or meta tags. These elements help the website with ranking and displaying of the site in the search engine outcomes. 

An image consisting of a pen with a list of meta tags in blue and red color

 

  • Google Analytics

Drupal is one such platform which supports web analysis. It presents the users with class web analytic capability, these capabilities make Google analytics an excellent tool for monitoring SEO results. 

Community 

Drupal community constantly updates and builds modules to expand the platform for compatibility and security reasons. In other words, Drupal is one of those platforms which checks for errors and makes it certain that the site is protected all the time. 

Drupal association has a team that looks after the security of Drupal and its module. Thus, your movie website is surely in good hands as there are people watching it all the time. By providing with several customer support features that are built in the service. Features like:

  • Forum

The user can post a question or a query which is answered by the professionals once it is seen by them.

  • Slack and online chat

The user can chat with the Drupal community which is maintained by them and handled by them.

  • Community documentation

The user can read the online documentation which is written and maintained by the Drupal community. 

  • Books

There is an ample number of user guide and manuals which presents the users with remedies and solutions. 

Case Study 

Cambridge film festival is one of the oldest and most prestigious cultural events in the East Anglia region. Drupal was chosen to build the website. It was selected because it maps the content-rich film data into a CMS that gave them an opportunity to build a powerful film search.

Screenshot of the homepage of Cambridge film festival

As a key part of the festival’s marketing strategy, the new website was used to raise awareness, increase audiences and attract the world’s best filmmakers.

Focusing on the user experience (UX), it was built fully to have a responsive website which can be viewed across all devices. It was also essential to make searching, sharing and booking online via the mobiles and tablets easy.

Although Drupal 8 was still in the process of development during the introduction of this project, the breadth of functionality and flexibility in the core was taken into consideration.

While building the theme for the Cambridge Film Festival, the advantage of the new Twig theming system was also taken. Individual pages were built in a more styled and modular way, the Twig debug mode did a great job of guiding them through the process, making file name suggestions that offered a range of options for theming elements either globally or individually.

The film search utilizes the View module as well. Using Views made the complex relationships easy to set up, and the also advanced caching which meant that even though the view was quite complicated, it loaded very quickly under most circumstances.

Wrapping Up 

Just like every movie has a happy ending ( if not then that’s not the ending), bringing your site to a position where the world watches it and appreciates it is what you desire for. And attaining this task is the big climax to the entire scene. 

Thus, to grab those standing ovations working smart is the key. At OpenSense Labs, we actually sense the need of you producing a user-friendly site and thus provide services that contribute highly to your journey of constructing the website. Thereby, call us at hello@opensenselabs.com to build the desired movie website. 

blog banner
An image of a clapper board placed on a wooden surface with 19 popcorns positioned at the bottom of the clapper board

blog image
An image of a black bowl with popcorn in it placed at a white surface

Blog Type
Is it a good read ?
On

fluffy.pro. Drupal Developer’s blog: Terraform: conditional operator with list values

It’s not possible to use list values in a conditional operator. For example, if you try:
resource "aws_elasticsearch_domain" "es_domain" {
...

vpc_options {
...
subnet_ids = [ "${var.es_zone_awareness_enabled ? list("subnet-1", "subnet-2") : list("subnet-1")}" ] }

...
}

it will fail with “conditional operator cannot be used with list values” message. This is because terraform cannot assert that list’s element types are consistent.

Read more »