At the moment it is impossible for elements with a #type to set default cache behaviour because #cache is checked before element_info() is called.
This is obviously for speed, we could check #cache a second time after #pre_render, in the same way that we check #printed a second time.
This would allow elements with #type to define default render cache behaviour.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 2046563-1.patch | 1.28 KB | thedavidmeister |
Comments
Comment #1
thedavidmeister commentedpatch
Comment #2
jlindsey15 commentedJust stumbled across this and thought I'd make sure the patch gets tested before everyone forgets about it.
Comment #3
fabianx commentedI am not sure this is necessary and how it relates to the more general cache tags support in core, but if this would like to go in, it needs tests.
Comment #4
thedavidmeister commentedmmm, I agree that it probably needs more thought/discussion in general. This is something I thought we could do "just because we can" but I would like to have some use cases and tests for it first.
Comment #5
lauriiiThis sounds like render system problem
Comment #19
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #20
smustgrave commentedI believe this one is outdated. The (now) render function has several checks for cache before hand and has gone through numerous changes in the last 12 years. If still valid please re-open.