Hi,
Here is the issue I'm facing: I have a document content type with multiple fields, which display is controlled by panels (and panelizer). In the teaser display, some fields are displayed with their field label set to "inline". In the default full display, all fields are displayed with their field label set to "Above".
When I have display cache activated, with the cache empty, if I load a page displaying all of my documents in teaser view mode, then, when looking at the document's default view mode, the fields shown in the teaser will have their field labels set to "Inline" instead of "Above". At the opposite, when the display cache is empty, if I look at a document in Default view mode first, and then look at it in Teaser view mode, the fields in the teaser view mode will be displayed with field labels set to "Above" instead of "Inline".
The reason for this is because, even though I have Display Cache set to cache the HTML, Display Cache also caches the fields, therefore in the first view request (whether the view mode is teaser or default), fields are cached, and then displayed from the cache in all of the other view modes, but in my case in the wrong way...
I will provide a patch to fix this, to avoid caching fields when the HTML is being cached.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | display_cache-cache_fields_only_if_wanted-2328355-6.patch | 701 bytes | func0der |
| #6 | diff_1_6.interdiff.patch | 654 bytes | func0der |
| #1 | 2328355-display_cache_html_only-1.patch | 703 bytes | guillaumev |
Comments
Comment #1
guillaumev commentedHere is the patch. Fields will be cached only when "Cache fields" is selected.
Comment #2
kars-t commentedHi
thank you for pointing this out. But I will need to ask Caseledde if this is on purpose or some bug. Makes no sense to me why there is only a check about "use" and not as you added what kind of "use"...
Comment #3
kars-t commented@guillaumev Did the patch really solve your problem? To me it reads more like "Cache the fields additionally to the HTML". And if I look in the database it seems the same.
Comment #4
mfernea commentedI used the patch from #1 and it works. I also checked the db.
Comment #5
func0der commentedYep. For us, too.
Please merge instantly. The current state fills the cache unnecessarily.
Except the fact, that the usage of === should be avoided here. Because often there is coming strings from the database where it should be integers.
I will attach a diff and an interdiff.
Comment #6
func0der commentedComment #7
func0der commentedComment #8
kars-t commentedThis has been commited. Thank you :)
Comment #10
kars-t commentedI added a new release because of this.
Comment #11
func0der commentedCool. Thank you.