Tutorials

No, not "Claro", but "Klaro" (Cookie & Consent Management)

Published December 30, 2024
In our previous Inside Drupal CMS blog post , we mentioned that the Klaro Cookie & Consent Management module was being used for privacy functionality. What exactly is "privacy functionality" and how does Klaro help with it? That's the question that this article aims to answer. The absolute basics The Drupal Klaro module implements the open-source Klaro Privacy Manager Javascript library . The library provides web sites an easy way to be transparent about the third-party applications on the site, as well as provide a mechanism for users to opt-in or -out of said services. It is designed to help

Inside Drupal CMS

Published December 12, 2024
There's been more than a few articles written over the past year about the promise of Drupal CMS , but not a whole lot of articles about what Drupal CMS will specifically include. This article will attempt to fill in the gaps, by providing a bit of a high-level synopsis of what the 1.0 version of Drupal CMS will currently include. It is meant to provide an overview of most of the specific modules, information architecture, and functionality that you can expect out-of-the-box. Note: This article is based on a pre-release version of Drupal CMS from December 8, 2024. Drupal

First look: Drupal CMS AI recipe

Published December 10, 2024
The initial version of the Drupal CMS AI recipe was merged into Drupal CMS on December 3 and I couldn't wait to check it out…(well, I guess I could wait just until the end of my vacation last week 😀.) Anyway, the first chance I had, I updated my local development copy of Drupal CMS and got right to it. Quick sidenote The first thing I noticed is that the installer had changed since I last updated my local copy (about three weeks ago.) It has a much cleaner look, but it also appears that the AI recipe hasn't been

Handling Drupal core's oEmbed warning

Published November 29, 2024
If you manage a modern Drupal site with the Media module enabled, then you're probably not a stranger to the "potentially insecure to display oEmbed content" warning that greets you whenever you visit your site's Status Report . In this article, I'll tell you what this means, and what you can do to update your site to remove this warning. What does it mean? When you enable the Drupal core Media module, one of the media types that is automatically created is Remote Video . This media type allows you to add a link to a YouTube or Vimeo video

Why Drupal module developers should be excited about object-oriented hooks

Published October 29, 2024
It's not super-often that a Drupal core change record stops me in my tracks, but recently, one did exactly that. With so much of Drupal core written using modern, object-oriented PHP, there was still one place where we needed to use plain-old PHP functions: hook implementations. Drupal hooks have been with us since before I started with Drupal (over 18 years ago,) and I had long hoped that with the advent of "modern" Drupal (Drupal 8+,) eventually hooks would be converted over to Symfony events. Much to my surprise, a recent change record for Drupal 11.x-dev (to be included in

How to step down successfully as a Drupal leader

Published September 5, 2024
In my 15+ years in the Drupal community, I've been fortunate to have been able to lead a few Drupal-related groups and I sometimes find myself in the position of encouraging other leaders - who are experiencing burnout - on how to gracefully step down from leadership positions after multiple years of service. When I say "groups," I'm talking about things like: Drupal event organizers Drupal module/theme/project maintainers Drupal initiative leaders Drupal working group leaders It seems counter-intuitive to encourage folks to step away from things they have successfully led, but I'm very fond of the concept that the true

Using ECA to pre-populate a form field from a query string variable

Published August 8, 2024
There's no doubt that the ECA module is changing the way Drupal sites are built - at least for those of us that use it regularly. I recently used it to pre-populate a form field on a node add page and it turned out to be easier than I figured it would be. The task was to pass the value I wanted to pre-populate into the form via a query string variable. Something like: https://mysite.ddev.site/node/add/article?myvalue=1 On the node add page, there exists an entity reference field whose value I'd like to pre populate with a value of 1 ( myvalue

Getting ready to run your first migration

Published July 23, 2024
Migrating content into Drupal is an extremely useful skill for most Drupal developers. Often, the most difficult step in learning to do migrations is the first one - that of getting everything set up and running your first migration to ensure that everything is working as expected. Most Drupal migration-related blog posts and documentation that I've seen either completely ignore the setup process or gloss over it before diving into the details of writing migrations. I like to ensure, both here, and when working with participants in our Professional Module Development course , that we ensure a solid understanding of

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 I

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 have the

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 went

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 DDEV

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 plan

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