Skip to main content
Joachim's blog

Main navigation

  • Home
  • About
  • Hire me

Breadcrumb

  1. Home

Drupal core

By joachim, Sun, 05/07/2026 - 16:02

No data, no problem: computed fields made simple

It's often useful to let the machines do the work, and output something that's dynamically computed on an entity. By that I mean something that can't be hardcoded as a fixed value for all entities of a particular type, but that varies for each entity, in a way that allows it to be generated in code rather than laboriously entered into each entity form by humans.

For example, you might want a backlink for an entity reference, or a link to a view that has an argument for the entity's ID, or something that depends on field values on the entity.

Tags

  • Field API
  • Drupal core
By joachim, Mon, 31/01/2022 - 17:14

Defining bundle fields in code

Fields in Drupal 9 can be defined in code, or they can be defined in configuration. Both techniques have their uses and advantages. Typically code fields apply to all bundles of the entity type, as so-called base fields, while config fields apply only to a single bundle.

But there is a way to have code fields which apply only to specific bundles: these are called bundle fields. These are particularly useful for adding computed fields to specific bundles of an entity (more on computed fields in a future blog post).

Tags

  • Entity API
  • Field API
  • Drupal core
By joachim, Fri, 16/04/2021 - 13:32

A better way to work on Drupal core

Often when things seem really complicated, I think it's because I must be doing it wrong.

Working on Drupal core since dependencies were removed from git has seemed really fiddly. For a long time I thought I must have missed something, that there was some undocumented technique I wasn't aware of.

But I've asked various people who work on core a lot more than I do, and they've confirmed that what I've been doing is pretty much the way that they do it:

Tags

  • Composer
  • Drupal core
By joachim, Tue, 27/10/2020 - 11:52

Different ways to make entity bundles

A lot of the time, a custom content entity type only needs a single bundle: all the entities of this type have the same structure. But there are times where they need to vary, typically to have different fields, while still being the same type. This is where entity bundles come in.

Tags

  • Drupal core
  • Entity API
By joachim, Sun, 18/10/2009 - 11:09

Small Core, Big Drupal, Tighter Contrib: Outer Core?

I've been mulling this idea since Paris, trying to figure out the best way to present it.

But basically:

We want a smaller, slimmer, efficient core.
But we also want Drupal to, like, be useful.
We want contrib, at least the high-use end of contrib, to be smoother, more organized, released on time with core.
It's been suggested we have a contrib maintainer, who would have the unenviable task of managing a huge kaboodle.

Tags

  • drupal
  • thinking aloud
  • roadmap
  • drupal planet
  • Drupal core
Drupal core

Frequent tags

  • Drupal Code Builder (9)
  • git (7)
  • module builder (7)
  • 6.x (5)
  • Drupal core (5)
  • drupal commerce (4)
  • Field API (4)
  • Entity API (3)
  • tests (3)
  • development (3)
  • patching (3)
  • Rector (3)
  • Composer (3)
  • contributing code (3)
  • Drush (3)
  • drupal.org (2)
  • debugging (2)
  • code style (2)
  • deprecation (2)
  • 7.x (2)
  • issue queue (2)
  • multisite (2)
  • developer tools (2)
  • wtf (2)
  • modules (2)
  • roadmap (2)
  • maintaining projects (2)
  • contrib module (2)
Powered by Drupal