Problem/Motivation
detectFieldsRenderIssues() in modules/audit_views/src/Plugin/AuditAnalyzer/ViewsAnalyzer.php adds a FIELDS_NON_TABLE notice ("Using fields on non-table format. Consider using rendered entity with a view mode.") to every display whose row plugin is 'fields' and whose style is not a table-like format. It only skips Search API views.
An entity_reference display (the selection handler of an entity reference field) can only use the entity_reference style and the entity_reference row plugin, which is fields-based (core EntityReference display plugin, defineOptions()). A rendered entity is not an option there, so every autocomplete view gets a notice pointing to a change that is not possible.
It happens on any standard configuration: Views stores the entity_reference display with its style only (see core's entity_reference_test module, views.view.test_entity_reference_entity_test), so the analyzer merges in the default display's row, which is 'fields', and reports the display.
Feed displays mentioned in earlier reports are not affected: their row plugins (rss_fields, node_rss...) are never counted as 'fields', and node_rss already renders the entity with a view mode.
Steps to reproduce
1. Create a view with a page display using fields and an entity_reference display (selection handler for an entity reference field).
2. Run drush audit:run views --format=json.
3. FIELDS_NON_TABLE is reported on the entity_reference display.
Proposed resolution
Skip display_plugin === 'entity_reference' in detectFieldsRenderIssues(), with a comment explaining why.
Remaining tasks
- Add the display plugin check.
- Unit test with a data provider on analyzeDisplays(), with the entity_reference display stored like core does (style only): entity_reference => no FIELDS_NON_TABLE; page with fields in an unformatted list => FIELDS_NON_TABLE; feed with rss_fields => no FIELDS_NON_TABLE.
User interface changes
Entity reference displays no longer get the FIELDS_NON_TABLE notice.
API changes
None.
Data model changes
None.
Comments
Comment #3
trebormc