Provides a computed field type whose value depends on whether another field is empty or not. It presents a TRUE or FALSE result, which can optionally be set inverted.

Some use cases

  • Search API indexing.
  • Exposing empty/non-empty information about private fields through REST/JSON:API.
  • Your very special case.

How to use it

Just like any other field module

A Field Is Empty field can be added and configured through the admin UI in the usual way. Its value will be recalculated whenever the parent entity is saved, and stored in the database.

As a computed base field

A field can be added programmatically to any entity type. This approach makes it a base field, available on all bundles of the entity type. See the example included in the project package.

As a computed bundle field

It is also possible to add a field programmatically to an entity bundle. This approach requires #2986836 to be merged or a patch applied (tested with this one). See the example that will be included in the project package once the core issue is closed.

Related core issues

Supporting organizations: 

Project information

Releases