Visual Debugger module: a modern take on an old idea

Published June 20, 2024
If you've been a Drupal developer since before the time of modern Drupal (pre-Drupal 8,) then you probably remember the Theme Developer module . This module is/was used to figure out theme template usage and possible overrides in Drupal 7. With modern Drupal, this same information is available directly in the HTML source code of a file when Twig development mode is enabled. The Visual Debugger module by Marcos Hollanda combines the best of the present with the best of the past to surface template information directly in the user interface without having to dig into the page's HTML. Pre-impressions

cspell and drupalorg CLI: two useful tools for Drupal contrib module maintainers

Published April 23, 2024
While preparing the recent Markdown Easy 1.0.1 release, I utilized a couple of tools that I hadn't used before in order to help improve code quality as well as the quality of the release notes . cspell cspell is a Node.js spell-checker for code that was made available to the default Drupal GitLab templates in February, 2024. There is a new SKIP_CSPELL variable that can be set if you'd like your project to completely ignore cspell (it is enabled by default.) Documentation on using cspell in Drupal GitLab pipelines is available . I'd wager that most Drupal contrib maintainers will

Why you should care about using settings.local.php

Published February 6, 2024
Teaching folks why a settings.local.php file is an important part of setting up a personal development environment is so important to us here at DrupalEasy that it is a foundational part of both of our long-form Drupal training courses . While preparing for an upcoming podcast mini-series I've been invited to participate in with the Talking Drupal folks, I'll be mentoring someone who is looking to re-enter the Drupal development scene after missing out on Drupal's transition from its pre-Symfony days. One of the tasks I have outlined for this person is to set up a settings.local.php file. When I

Test-driving the Rancher Desktop Docker provider with DDEV on MacOS

Published January 8, 2024
Recently, Randy Fay of the DDEV project blogged about two new Docker providers available (and supported by DDEV) for MacOS: Rancher Desktop and OrbStack . Both of these join Colima and Docker Desktop as supported Docker providers for DDEV on MacOS. What is a Docker provider? I know that I certainly have asked this question - more times than I care to admit. As Randy explains in the blog post: All of the Docker Providers on every platform (except Linux) are actually wrappers on the open-source Docker/Moby project, which is supported by Docker, Inc. In other words, in order for

Using GitHub Copilot in Visual Studio Code to create a PhpUnit test

Published December 29, 2023
Like many folks, I've been fascinated by the incredible evolution of AI tools in 2023. At the same time, I've been working to figure out exactly where AI fits into my various roles as a Drupal developer, trainer, and business owner. In this blog post, I detail a recent exploration I made into using AI ( GitHub Copilot , to be precise) to generate a PhpUnit test in a Drupal contrib module that I maintain. tl;dr I was impressed. Prerequisites For this exercise, I used Visual Studio Code with the GitHub Copilot extension installed. I am using the Copilot Business

How best to handle "Unsafe usage of new static()" PHPStan errors

Published December 13, 2023
As a Drupal module developer, if you're as big of a fan of PHPStan as I am, then you'll no doubt have run across the Unsafe usage of new static() error that PHPStan throws when analyzing code at level 0. In this article I will describe what causes this error and provide four possible solutions, weighing the pros and cons of each.

Using DrupalPod for core and contrib development

Published December 3, 2023
DrupalPod is a browser extension and GitPod configuration that allows Drupal contributors to quickly and easily spin up a personal development environment in their browser without pre-installing anything. Before we go any further, let's break down some of these concepts a bit more… GitPod is a cloud development platform - meaning that everything necessary for development is installed in the cloud and the only thing that needs to be installed on one's local machine is a modern web browser. Developers can customize their cloud development environments virtually any way they see fit depending on the nature of their project. GitPod

Test-driving GitLab CI templates for Drupal contributed modules

Published November 20, 2023
Earlier this year, the Drupal Association (DA) and various community contributors announced the general availability of GitLab CI (Continuous Integration) for Drupal contributed modules . The goal of this project is to replace the existing, bespoke, Drupal CI for running automated tests for both Drupal core and contributed projects with GitLab's existing CI tools, thus saving community and DA resources in the long-term. For contributed module maintainers, this means being able to specify more flexible tests and code validations, depending on the module's unique needs. Much of this functionality will be made readily available to module maintainers via GitLab templates

Debugging all the things with Xdebug, DDEV, PhpStorm, PhpUnit

Published October 9, 2023
Over the past few years, we've published a couple of blog posts about setting up Xdebug for Drupal module development. But, like all things in tech, there's always more to learn as tools and technology evolve. The setup I was recently working with one of our Professional (Drupal) Module Development students trying to determine why she wasn't able to use Xdebug to debug a PhpUnit-based functional test. To be clear, the breakpoint wasn't set in the actual test class, the breakpoint was set in some custom module code that was called by the test class. In functional tests, Guzzle is

Test driving the new DDEV Manager extension for Visual Studio Code

Published September 20, 2023
Introduction If you use Visual Studio Code and DDEV , there's a new extension that may increase your efficiency. The DDEV Manager extension provides a user interface within Visual Studio Code for just about every conceivable DDEV command. As I am a user of both tools, and I often teach and present on the topic of maximizing one's efficiency related to Drupal development when using DDEV and Visual Studio Code, a thorough review of this new extension was a no-brainer for me. Installation Installation of the extension is typical of any other Visual Studio Code extension - from the "Extensions"

Using the ECA module to replace a not-Drupal-10-ready contrib module (Termcase)

Published July 28, 2023
I've been a big fan of the Termcase module for a long time - it is my go-to module for sites that employ free-tagging taxonomies. Termcase allows site-builders to force consistency on tag names (all lowercase, all uppercase, first-letter uppercase, etc…) It's one of those modules that I was surprised that not everyone used (or had even heard of.) While working to update a Drupal 9 site that uses Termcase to Drupal 10, I became curious if free-tagging was still a commonly-used technique on modern Drupal sites. In an effort to satisfy my curiosity, I performed a 100% not scientific

Solving a local "502 Bad Gateway" Drupal issue

Published July 17, 2023
I learned a valuable lesson last week. First, some context. One of DrupalEasy's clients is a large international industry association that is currently running a large Drupal 9 site with about a dozen custom modules and well over 150 contributed modules. We were brought onto the project a couple of years ago to do some custom module development, but until recently weren't all that involved in the overall site maintenance and development. As part of a recent task we've been working on, I stumbled on an issue that was occurring only on my local, and not in a way that

Drupal's OpenAI / ChatGPT / AI Search Integration contrib module - initial impressions

Published May 25, 2023
Ever since it was announced, I've been itching to play with the new OpenAI / ChatGPT / AI Search Integration contrib module. From what I had read about it from Kevin Quillen , it was being written in a way that was going to make it flexible and with an eye toward customization. On a self-serving note, one of our clients is interested in an AI-based solution for a task we're working on for them, so I had an agenda; test-driving this module for content-related tasks. My initial impressions came from using version 1.0.0-alpha10 and within the first 20 minutes

A method for utilizing multiple authors for a single Drupal node

Published February 6, 2023
A client recently asked me to figure out how to allow additional authors to not only be listed on a single node, but also to let them have the same edit and delete permissions as the main author of the node. I thought it might be helpful to put together an article that details one potential solution to this not completely uncommon task. This is not something I have implemented in any modern version of Drupal (8, 9, or 10), so I took a fresh look at the problem by reaching out to my Drupal network via Slack and social

Easy fix for phantom duplicate custom module files (due to Composer) in popular IDEs

Published January 4, 2023
When writing Drupal custom modules, best practice dictates that the module should be written in the project root's /modules/ directory - so that composer require can be used add the custom module as a dependency to the project (with a little help from the composer/installers plugin, of course). In most cases, the module's code is then symlinked from the /modules/ directory to the /web/modules/custom/ directory. One potential pitfall of this approach is that both PhpStorm and Visual Studio Code will see both the "copies" of the files in the custom modules, leading to duplicates in IDE search results, code quality