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

Files: 
CommentFileSizeAuthor
#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 ]

Comments

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

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
StatusFileSize
new1013 bytes
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es).
[ View ]

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

cpliakas’s picture

StatusFileSize
new1013 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

#4: checkboxes-with-cache-1621034-4.patch queued for re-testing.

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:

<?php
  drupal_add_js
($merge_settings, 'setting');
?>

to:

<?php
  $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
StatusFileSize
new692 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

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