Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
For some reason the modal popup only works on my front home page, if i go into any other page (article, blog etc) then when I click on the login/create new account links they open the standard page and not model.
Is this by design because I cannot see any configuration that shows this kind of behaviour.
many thanks
Millzee
Comment | File | Size | Author |
---|---|---|---|
#6 | 1911256-move-js-css-to-attached-attribute-for-block-cache.patch | 5.6 KB | kalabro |
Comments
Comment #1
SpleshkaHi,
The problem is definetely in your theme. Module not provides settings for popup.
Comment #2
Teeman CreditAttribution: Teeman commentedHi,
I'm experiencing the same problem. What could the problem be with the theme?
Comment #3
Teeman CreditAttribution: Teeman commentedDisabling block caching solved the problem for me
Comment #4
SpleshkaThis is not a Ajax Register issue. The problem may occurs because of cache settings (page cache or block cache).
Comment #5
auberdjinn CreditAttribution: auberdjinn commentedHello,
I can confirm this issue.
I think it is an ajax_register issue because the links do not work if block caching is enabled. This means that a site admin cannot choose to cache other blocks if they are using ajax_register. I don't think it should be necessary to turn block caching off altogether in order to use this module.
The problem is that the javascript file is added to the page within ajax_register_block_view(). This is only called when the block is built. It's not called if the block is cached, so the javascript for the popup doesn't get included after the first view of the site.
It could be fixed by not caching this block, i.e. change the cache setting in ajax_register_block_info() to DRUPAL_NO_CACHE.
Or maybe the call to drupal_add_js() could be placed somewhere other than hook_block_view(), e.g. hook_init()?
I'm not sure which approach would be best.
Comment #5.0
auberdjinn CreditAttribution: auberdjinn commentedamended
Comment #6
kalabroBlocks support attached JS/CSS with "#attached" key. I used it successfully and provide raw patch. It can be buggy or outdated.
Comment #7
swim CreditAttribution: swim commentedTested the patch in #6 and can confirm that Kalabro has amended the issue. This should be fairly easy to replicate, clean install of Drupal 7 & enable block & page cache.
As Kalabro has said above blocks support attaching CSS & JS in a renderable array which is more cache friendly.