Drupal Articles

Articles detailing Drupal-based web-work. There may be some overlap with other PHP-based content management systems. There may also be solid references to Linux based tools for use with DevOps and workflow management. Enjoy!
October 19, 2021

If you haven't yet set up site aliases for Drush, what are you waiting for?!?--Life is so much easier once your localhost can start communicating with your remote: bring site files and databases straight from production to local without logging into your CPanel or PHPMyAdmin; clear site cache on Production without logging into the site and navigating the admin UI. It can be tricky to set up, but once you have, you'll wonder how you ever developed without site aliases.

Background: Why Site Aliases Rock

My main client is hosted on Acquia; despite the tendency to be both pedantic and overly optimistic in regards to all things Drupal, Acquia, as a company, can be extremely considerate to the developers on its platform. One of the perks of being with Acquia is having out-of-the-box support for Drush Site Aliases.

In this post:
October 12, 2021

I don't always crack open my Drupal database... but, when I do: it always leaves me a happier person. If you're like me, perhaps you often overlook the power of your Drupal site's database. It's effectively a warehouse, and Drupal is a warehouse manager: retrieving all the items your site-visitors request and updating what sits on your warehouse shelves--all 'on the fly'. Still, there are limits to Drupal's ability. It may be good at coordinating between end-users and the proverbial warehouse, but it's not really an inventory manager. To get a really good feel for what's going on in you Drupal database, you'll need a different tool: PHPMyAdmin. Here are some simple ways I like to leverage this tool in my Drupal development workflow.

Clearing Drupal's Site Cache

I've covered this before in a post on how database cache can kill your Drupal site. It's worth mentioning again: if you don't have Drush and you're without access to Drupal, you can clear your site's cache in PHPMyAdmin by simply dropping any of the tables appended with 'cache_'.

August 24, 2021

Touching again on the complexity of making flex-box columns scalable; this time I focus on one of the design challenges with this layout. When child items are burdened with the limits of CSS, sometimes the solution is to think outside of the box, literally, and work with the parent instead.

Background: the Design

I love Flexbox--it's a fundamental in responsive design. As empowering a device as it is, though, it's not without it's limits. It just so happens that I work with a designer who has a real knack for exposing these limits. The minute I think I've got flexbox under control, she'll throw me a design that challenges my every conception of what flexbox is or how it should work.

June 22, 2021

Ever feel like you basically spend the entire day hitting your head against a wall? It happens to the best of us--particularly when it comes to elements of DevOps we don't deal with on a daily basis. I spent far longer than I care to admit today trying to assess why my Drupal site theme wasn't updating despite holding my code to a microscope, and despite any number of cache clears. The culprit: the output path on my SASS compiler was set to the wrong folder. Seems like a novice mistake... which is why I'm commemorating it with a blog post: sometimes brain farts are just part of the job.

Background: A New Computer

That's right... I got tired of lugging my laptop between home and the office, so I setup a new computer over at the coworking space. Okay, technically, it's not a new computer at all; it's a 2011 Mac Mini Server running Xubuntu 20.04--still a perfectly reasonable computer for web development in 2021. But, that means "provisioning" the computer for my workflow.

In this post:
May 22, 2021

Turning on verbose error logging in Drupal is an important tool for diagnosing any number of problems. Unless you have the PHP syntax memorized, though, it's a bit of a pain to enable. Even if you keep the $config line commented out in your settings.php file, opening a file editor every time you need to turn it on can also be a pain. Here's a short Bash script that will automatically edit your settings.php file and turn on verbose error logging..

I have a real knack for hitting the WSOD on my localhost--usually when juggling databases and code in between remote and local. As a result, I like to keep verbose error logging commented out in my settings.php. It's generally the last line in the file, somewhere after the $databases array. For privacy reasons I won't screen grab the actual file, but the commented line (for both D8 and D9) should be this:

April 14, 2021

I've had a long standing problem with flexbox--particularly with flexbox columns. The proverbial Elephant in the Room has always been this: a mechanism for automatically letting content grow in one column (i.e., adding consecutive child items) and then overflow into the next doesn't really exist. Today, I look at a fix for this problem--and, all it takes is a little JavaScript.

Outlining the Problem

Let's look at flexbox columns and see what's at stake.

March 09, 2021

Empty string passed to getElementByID()? Why you can't just duplicate javascript functions for mobile and desktop elements.

Arg!

I've got a simple JavaScript function that relies on getElementById(); for some reason, even though the element ID is 100% kosher (it exists), when I run the function my browser console give

September 24, 2020

Good news: after all the sweat and blood of getting our site ready, the upgrade took all of 30 minutes. This really may be the easiest Drupal upgrade in a decade. It's still not for the faint of heart. Here's a quick recap on the steps necessary to do this upgrade. I'll be sure to link back to my previous articles so you can see the work and challenges involved with each step in detail.

Drupal 9 Up Front

Compared to all the work that went into prepping the site, the actual upgrade is a walk in the park. I'll be sure to cover the actual upgrade process in Step 5 of this article; I'd like to do a quick recap on the entire process, though--so, if you've already read my earlier Drupal 9 Upgrade posts, feel free to skip to Step 5. Otherwise, let's reconnect with what the basic steps are for a D8 to D9 upgrade.

September 22, 2020

Not all contributed D8 modules have D9 compatibility built into their latest releases. More than a few, however, will have a patch available in their open issues that will get you there. I've had several occasions to patch a module, but it's not something I do with enough frequency to immediately recall how it's done. On the command line I often forget which is the right way to do it: git apply or patch?

Prepping for a Patch

As with all things Drupal--attention to detail is paramount. It's easy to get ahead of yourself when looking for and applying a module patch, but one of the first things you'll want to do when you find one is to ensure that the patch was built for the module version you're using. A patch is a file that applies very specific changes to an already existing file.

September 17, 2020

It seems like a no-brainer to me, but I must have missed something. Why Drush, Drupal's admin UI and Composer would install modules into different directories by default is beyond me.

Default Module Directory

Where are modules really supposed to go, anyways? Here's what Drupal.org has to say: