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.
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()
.
Discuss the proposed patch.
Add tests.
Needs work
11.0 🔥
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Related to the Views in Drupal Core initiative.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.