Drupal

Drupal is a cmf developed by Dries Buytaert about 20 years ago. It has developed a rich culture of developers supporting the system, and it is a highly flexible system.
· Lars Nielsen

A Site's Entire Ad Mess Traced Back to One Unmodified Script Tag

Ad placements on this site had started looking wrong — not broken, just not deliberate: spots that clearly weren't ones I remembered choosing. My first assumption was that some old ad unit had been dropped into a template years ago and half-forgotten, so I went looking for it in the theme. There's exactly one ad-related line in the entire theme, and it isn't a placement at all:

Read article A Site's Entire Ad Mess Traced Back to One Unmodified Script Tag
· Lars Nielsen

A Presave Hook's isNew() Check Is the Exact Reason a Scheduled Publish Isn't Blocked

This site's automated publishing pipeline runs under a scoped account, api_publisher, that has no permission to touch a node's status field. That's deliberate: a hook_node_presave() in this site's custom module forces any new node owned by that role unpublished, no matter what the content type's default says or what the API client asked for:

Read article A Presave Hook's isNew() Check Is the Exact Reason a Scheduled Publish Isn't Blocked
· Lars Nielsen

I Installed drupal/redirect for Four URLs. It Redirected Every Node Path on the Site.

I had exactly four URLs I wanted redirected. Two articles had accidentally been published twice in July under different titles — a mixup during the early days of the JSON:API publishing pipeline — and once I'd settled on which copy of each to keep, the other needed to 301 somewhere instead of just disappearing. Four source paths, four targets, done.

Read article I Installed drupal/redirect for Four URLs. It Redirected Every Node Path on the Site.
· Lars Nielsen

The JSON:API Route That 403s With No Reason String

There's a specific kind of unhelpful a 403 can be. Try to set a field you don't have permission for through Drupal's JSON:API and you get a real, actionable message back — something like "The current user is not allowed to POST the selected field (status). The 'administer nodes' permission is required." That's a 403 that tells you exactly what to go fix.

Read article The JSON:API Route That 403s With No Reason String
· Lars Nielsen

A Config Entity's UUID Is Its Real Identity, Not Its Machine Name

Every Drupal config entity has a machine name and a UUID, and it's easy to go a long time treating the machine name as the entity's actual identity, because it's the one you type — id: api_publisher, right there at the top of the YAML file, human-readable and stable. The UUID sits a couple of lines above it, a string nobody reads, that looks like it shouldn't matter.

Read article A Config Entity's UUID Is Its Real Identity, Not Its Machine Name
· Lars Nielsen

The Difference Between a Config Import and a Database Migration, and Why Conflating Them Broke My Deploy

Deploying the removal of a Drupal module looks like it has an obvious order: take the module out. In practice it's two separate operations that happen to both look like "removing a module" from the outside, and doing them in the wrong order left production in a broken half-state I had to clean up by hand.

Read article The Difference Between a Config Import and a Database Migration, and Why Conflating Them Broke My Deploy
Subscribe to Drupal