Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
When you've got facets with "checkboxes and links" enabled on a Solr search page the checkboxes will be displayed when you're logged in.
Anonymous users on the other hand will not see the checkboxes when block caching is enabled. They just see links.
Turning block caching off fixes the problem with the checkboxes, but of course turns block caching off...
Comment | File | Size | Author |
---|---|---|---|
#17 | facetapi-checkboxes_with_cache-1621034-17.patch | 1.24 KB | TLWatson |
|
Comments
Comment #1
cpliakas CreditAttribution: cpliakas commentedThis is probably because the javascript that converts the links to checkboxes is added in the block rendering logic which is not executed when the block is cached. Therefore it is not added when the data is cached.
Thanks for posting,
Chris
Comment #2
cpliakas CreditAttribution: cpliakas commentedLooks like the technique at http://www.jaypan.com/tutorial/adding-css-and-js-cached-block-drupal-7 should fix the issue.
Comment #3
cpliakas CreditAttribution: cpliakas commentedThe attached patch moved the JS including into an #attached property.
Comment #4
cpliakas CreditAttribution: cpliakas commentedRe-thinking location of the #attached so it is in the base widget class.
Comment #5
cpliakas CreditAttribution: cpliakas commentedBumping to first page.
Comment #6
cpliakas CreditAttribution: cpliakas commented#4: checkboxes-with-cache-1621034-4.patch queued for re-testing.
Comment #7
cpliakas CreditAttribution: cpliakas commentedCommitted to 7.x version of Facet API.
Comment #9
CSoft CreditAttribution: CSoft commentedI still have this problem. To solve it, I changed the line of code in adapter.inc from:
to:
It works for me perfectly.
Comment #10
AntonnaviI confirm this bug (also reproduce it).
Solution from comment #9 works fine for me.
It also fix issue with soft limit show/hide link disappearing when block cache is enabled.
Thank You CSoft!
Comment #11
GaëlGThis works for me too.
Comment #12
DamienMcKennaThe code from #9 turned into a patch. There are probably other drupal_add_js() calls, and some drupal_add_css_() calls that need fixing, this should do for now.
Comment #13
frjo CreditAttribution: frjo commentedI had the same issue and patch #12 fixed the problem.
I found a problem with CSS as well and attach a extended patch that takes care of that as well.
Comment #14
kitikonti CreditAttribution: kitikonti commentedsame problem and #13 works for me
Comment #15
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commentedStrange, but I cannot reproduce this problem. Maybe it's not actual? I've checked it with the dev version.
Comment #16
brockfanning CreditAttribution: brockfanning commented@eugene.ilyin: For me patch #13 (thank you!) is still needed even with the latest dev version. Here's what I'm doing to recreate the problem:
So the javascript gets loaded the first time, but not successive times - which makes sense if the javascript is not added with '#attached' and the block has been cached.
Comment #17
TLWatsonAttached an update of patch #13 with line numbers compatible to version 1.5+30-dev.
Comment #18
TLWatsonFixed as of 7.x-1.6 - see https://www.drupal.org/project/facetapi/issues/3057283