Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When not using any arguments the current code executes and renders the same view output for every row in the parent view. Even when the parent view has regular caching enabled this still adds a lot of unnecessary code to the critical path. The attached patch adds a simple static caching layer.
This could potentially be extended to work with arguments also (by adding a 3rd dimension to the array), but that doesn't add any value unless you are adding fields multiple times (see idea in #1920730: Provide a way to retrieve values from field based views).
Comment | File | Size | Author |
---|---|---|---|
#4 | 1920740-4.patch | 2.68 KB | damiankloip |
static-cache.patch | 3.2 KB | Owen Barton | |
Comments
Comment #1
damiankloip CreditAttribution: damiankloip commentedI'm definitely not opposed to this idea!
We might as well just have this as a property on the class? Running is slightly different in that respect.
Comment #2
Owen Barton CreditAttribution: Owen Barton commentedWould moving it to the class make a difference in functionality, given that it is only used by the one function?
Comment #3
damiankloip CreditAttribution: damiankloip commentedDoesn't matter that it's just used in one function I guess. It's just using a property on the class to do this instead of a static variable.
Comment #4
damiankloip CreditAttribution: damiankloip commentedI was thinking something like this.
Comment #5
damiankloip CreditAttribution: damiankloip commented#4: 1920740-4.patch queued for re-testing.
Comment #6
damiankloip CreditAttribution: damiankloip commentedI've just gone ahead and committed the patch from #4, passes tests, and doesn't seem to break things :)