Add an isComputed method to field handlers

Created on 3 October 2014, over 9 years ago
Updated 27 June 2024, 1 day ago

Problem/Motivation

All field handlers that provide things like links do not want to do anything to affect the views query. So the current 'API' for this is just overriding the query() method and leaving it empty, so the parent does not get called. It would be nicer to make this explicit, like click sort is declared.

Additionally, other Views plugins need to be able to determine whether or not a field handler influences the query, since those plugins might rely on the fact that the field handler adds one or more fields to the query. See #2401953: Database exception for View with Combined field filter with fields with no query alias β†’ for an example of this scenario.

Proposed resolution

Add an isComputed() method to FieldPluginBase, this would default to false. Handlers could then either add 'computed' to the views data implementation using the handler or just overriding the method. The base query method can then check this property.

Remaining tasks

User interface changes

API changes

Beta phase evaluation

πŸ“Œ Task
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 1 hour ago

Created by

πŸ‡¬πŸ‡§United Kingdom damiankloip

Live updates comments and jobs are added and updated live.
  • VDC

    Related to the Views in Drupal Core initiative.

  • 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.

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.69.0 2024