Views filters crash on entity types where the disclosure field is a base field
Problem / Motivation
The Views filters ("Label required" and "Effective grade") only work when the ai_disclosure field is a configurable field stored in its own dedicated table. If the field is a base field, the filters generate broken SQL and the page throws an exception (white screen).
The cause: DisclosureQueryConditions::collectFieldTables() (src/DisclosureQueryConditions.php, around lines 836–868) assumes every disclosure field lives in a dedicated field table that has entity_id, deleted, bundle and langcode columns. For a base field, getFieldTableName() returns the entity's base or data table instead, which has none of those columns — so the conditions built by labelRequiredCondition() and effectiveGradeCondition() reference columns that do not exist.
This is inconsistent with the rest of the module: DisclosureFieldFinder explicitly supports base fields ("Non-configurable definitions, such as base fields, count too"), and the module's own test module ai_disclosure_test creates one.
Today the bug is latent — only the node report actually uses these filters, and node disclosure fields are configurable. But the views data is registered for every fieldable entity type, so any site that adds one of these filters to a view over an entity type with a base disclosure field gets a crash.
Affected code
src/DisclosureQueryConditions.php—collectFieldTables(),labelRequiredCondition(),effectiveGradeCondition()
Proposed resolution
- In
collectFieldTables(), skip (or specially handle) storage definitions where$table_mapping->requiresDedicatedTableStorage($storage_definition)returnsFALSE. - Add a kernel test that exercises the filters against
ai_disclosure_test's base field.