Return computed fields in FieldAPIHandlerTrait::getFieldStorageDefinition()

Created on 15 January 2018, almost 7 years ago
Updated 28 June 2024, 6 months ago

Problem/Motivation

In #2852067: Add support for rendering computed fields to the "field" views field handler a fix was added for computed fields in the views field handler. The filter handler needs this fix as well to be able to filter views on computed fields.

I ran into this while creating a search API based view that indexes a computed entity reference field. While trying to filter on the computed entity reference field, the filter options for entity references are not very useful. It would be nice to make the entity references work like TaxonomyIndexTid. This is being fixed in 📌 Add Views EntityReference filter to be available for all entity reference fields Closed: duplicate .

This does not automatically work for computed entity reference fields. I traced this to \Drupal\views\FieldAPIHandlerTrait::getFieldStorageDefinition(). This method should also return the computedd base fields.

Proposed resolution

Work for this started in #2852067: Add support for rendering computed fields to the "field" views field handler but since that issue originally intended to fix only the field handler, this is a follow up to make the fix more generic. I would propose the move the code in EntityField::getFieldStorageDefinition() to FieldAPIHandlerTrait::getFieldStorageDefinition().

Remaining tasks

Discuss the proposed patch.
Add tests.

User interface changes

API changes

Data model changes

Feature request
Status

Needs work

Version

11.0 🔥

Component
Field 

Last updated 1 day ago

Created by

🇳🇱Netherlands seanB Netherlands

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • VDC

    Related to the Views in Drupal Core initiative.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024