Skip to main content
Joachim's blog

Main navigation

  • Home
  • About

Breadcrumb

  1. Home

Entity API

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

  • core
  • Entity API
  • Field API
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, Tue, 18/11/2014 - 13:38

Building Fast and Flexible Application UIs with Entity Operations

Now I've finished the Big Monster Project of Doom that I've been on the last two years, I can talk more about some of the code that I wrote for it. I can also say what it was: it was a web application for activists to canvass the public for a certain recent national referendum (I'll let you guess which one).

One of the major modules I wrote was Entity Operations module. What began as a means to avoid repeating the same code each time I needed a new entity type soon became the workhorse for the whole application UI.

Tags

  • contrib module
  • Entity API
Entity API

Frequent tags

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