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

#13 facetapi_1621034_13.patch1.24 KBfrjo
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es). View
#12 facetapi-n1621034-12.patch692 bytesDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es). View
#4 checkboxes-with-cache-1621034-4.patch1013 bytescpliakas
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es). View
#3 checkboxes-with-cache-1621034-3.patch1013 bytescpliakas
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


cpliakas’s picture

This 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,

cpliakas’s picture

Looks like the technique at http://www.jaypan.com/tutorial/adding-css-and-js-cached-block-drupal-7 should fix the issue.

cpliakas’s picture

Version: 7.x-1.0-rc4 » 7.x-1.x-dev
Status: Active » Needs review
1013 bytes
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es). View

The attached patch moved the JS including into an #attached property.

cpliakas’s picture

1013 bytes
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es). View

Re-thinking location of the #attached so it is in the base widget class.

cpliakas’s picture

Bumping to first page.

cpliakas’s picture

cpliakas’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

CSoft’s picture

Issue summary: View changes
Status: Closed (fixed) » Needs work

I still have this problem. To solve it, I changed the line of code in adapter.inc from:

  drupal_add_js($merge_settings, 'setting');


  $build['#attached']['js'][] = array(
    'data' => $merge_settings,
    'type' => 'setting',

It works for me perfectly.

Antonnavi’s picture

I 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!

GaëlG’s picture

Status: Needs work » Reviewed & tested by the community

This works for me too.

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Needs review
692 bytes
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es). View

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

frjo’s picture

1.24 KB
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es). View

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

kitikonti’s picture

same problem and #13 works for me

eugene.ilyin’s picture

Status: Needs review » Postponed (maintainer needs more info)

Strange, but I cannot reproduce this problem. Maybe it's not actual? I've checked it with the dev version.