Recent Blog Posts

Reviving an old dresser by rebuilding the wooden drawer rails

My wife and I needed an extra dresser to keep up with the growing family (third baby is on the way in a few months!), and since we would rather buy things that last—but not buy new if we can save a bundle of money—we bought a used wood dresser on Craigslist:

Craigslist wood dresser

First lesson: always inspect every last bit of furniture before loading it up and hauling it away! Most of the rails were in not-great condition, and the guides on the drawers weren't in great shape either:

Craigslist dresser with old broken wood drawer rail guide

We decided to make the best of the situation and make as good a repair as possible, resulting in much improved (like new!) rails:

The Crêpe I made in honor of Juno's mission to Jupiter

I forgot to post here, after posting to different social networks—when NASA's Juno orbiter was placed in Jupiter's orbit, it just so happened to coincide with my family's Sunday night crêpe tradition (see how to make gluten/dairy/egg-free crepes, or how to make normal crepes).

So what did I do? I used some peanut butter, cream cheese, and nutella to try to depict a tasty food version of Jupiter:

A Jupiter crepe in honor of Juno's mission milestone today

Migrating Link fields with multiple properties with Drupal 8

Today I needed to migrate a URL/Link into a Drupal 8 site, and I was scratching my head over how to migrate it so there were distinct values for the URL (the actual link) and the Label (the 'title' that displays to end users and is clickable). Drupal 8's Link field type allows you to set a URL in addition to an optional (or required) label, but by default, if you just migrate the URL, the label will be blank.

I first set up the migration config like so:

  field_url: source_url

And source_url was defined in the migration's source.fields configuration.

In my case, the source data didn't have a label, but I wanted to set a default label so the Drupal 8 site could display that as the clickable link (instead of an ugly long URL). To do that, it's similar to migrating a formatted text field, where you can migrate individual components of the field using the syntax [field_name]/[component]. In a Link field's case, it looks like:

Poor Man's XHProf profiling of Drupal 8 Migrations and Drush commands

On a recent project, there was a Migration run that took a very long time, and I couldn't pinpoint why; there were multiple migrations, and none of the others took very long at all (usually processing at least hundreds if not thousands of nodes per minute). In Drupal 7, if you enabled the XHProf module, then you'd get a checkbox on the configuration page that would turn on profiling for all page requests and Drush commands.

In Drupal 8, the XHProf module was completely rewritten, and as a side effect, the Drush/CLI profiling functionality is not yet present (see: Profile drush/CLI with XHProf in Drupal 8).

Since I don't have the time right now to help figure out how to get things working through the official XHProf module, I decided to use a 'poor man's profiling' method to profile a Migration run:

Getting Emoji and multibyte characters on your Drupal 7 site with 7.50

Almost exactly a year ago, I wrote a blog post titled Solving the Emoji/character encoding problem in Drupal 7.

Since writing that post, Drupal 7 bugfixes and improvements have started to pick up steam as (a) many members of the community who were focused on launching Drupal 8 had time to take a breather and fix up some long-standing Drupal 7 bugs and improvements that hadn't yet been backported, and (b) there are two new D7 core maintainers. One of the patches I've been applying to many sites and hoping would get pulled into core for a long time was adding support for full UTF-8, which allows the entry of emojis, Asian symbols, and mathematical symbols that would break Drupal 7 sites running on MySQL previously.

My old blog post had a few steps that you could follow to make your Drupal 7 site 'mostly' support UTF-8, but there were some rough edges. Now that support is in core, the process for converting your existing site's database is more straightforward:


Subscribe to Jeff Geerling's Blog