Just run into this; essentially the same issue as in #1231768: Countdown does not show for anonymous users but for the D7 branch.

Thankfully it's easier to fix, as we have render arrays nowadays. Rather than calling theme() directly and returning strings from block and formatter view functions, we can instead return render arrays.

This mean that any caches (eg the block cache) get populated with a render array, rather than rendered strings. These render arrays then get rendered down to html post-cache; meaning theme_jquery_countdown gets called every time the block is viewed, and the javascript gets added consistently.

Patch to follow…

Members fund testing for the Drupal project. Drupal Association Learn more


stevetweeddale’s picture

stevetweeddale’s picture

Status: Active » Needs review
Tyler the Creator’s picture

I just ran into this same problem and created a patch that attaches the js and library to the block as opposed to loading it in the theme function, which allows the block to be cached. It would be nice to get this reviewed and committed.

Tyler the Creator’s picture

3.52 KB

Ah just realized that options aren't needed in the theme function anymore so I removed them from the patch.