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.
I've tested this with Garland, nice menus become regular menus a few minutes after emptying cache. Emptying cache is the only way to get nice menus to work. It's not related with CSS, is like the module es disabled.
Comment | File | Size | Author |
---|---|---|---|
#8 | nice_menus-fix-block-caching-1925816-8-do-not-test.patch | 828 bytes | hosef |
Comments
Comment #1
almc CreditAttribution: almc commentedI encounter the same issue. I've tried Nice Menus on Drupal 7.26 with Nice Menus 7.x-2.5, and Bartik and Responsive Bartik. If the cache for blocks is turned on, Nice Menus work ok first time, before the cache gets filled with blocks, after that Nice Menus lose their appearance on the screen, transforming to simple links. Spent few hours trying to identify the cause of this issue. I've used DRUPAL_CACHE_PER_ROLE and DRUPAL_CACHE_GLOBAL for Nice Menus blocks.
I'm raising the priority of this issue, as caching blocks is important in production, and Nice Menus currently don't work with block cache.
Comment #2
almc CreditAttribution: almc commentedCommented more in the issue thread below. - almc
Comment #3
almc CreditAttribution: almc commentedTo help reproduce the issue: it started appearing for me, with activated block cache, when I added the second and third nice menus, on the same page. It seemed to work ok while I only had just one (nice menu) block in cache. After three nice menus blocks were cached, clicking different items in different menus caused menus to lose their Nice Menus styling (with them supposedly being pulled out from cache). With cache turned off and cleared all three menus work ok.
Comment #4
hosef CreditAttribution: hosef at Hook 42 commentedThis is caused because the js and css files are being added to the page in the same function that builds the menu. moving this to hook_init causes the js and css to be added even if the block is cached.
Comment #6
oadaeh CreditAttribution: oadaeh at Hook 42 commentedThis needs review. It keeps getting pushed to needs work because of this: #2645590: Ensure that simpletest job doesn't "fail" testing if no tests are present
Comment #7
oadaeh CreditAttribution: oadaeh at Hook 42 commentedI reviewed and tested the patch on a local installation, and it does what it claims.
The code looks okay, but considering what is being done, I think some additional comments explaining why those lines are in hook_init() would be a good idea. Therefore, I'm leaving the status as needs work.
Comment #8
hosef CreditAttribution: hosef at Hook 42 commentedI have added the requested comment to the patch and have added the -do-not-test extension so that the test bot does not change the status.
Comment #9
oadaeh CreditAttribution: oadaeh at Hook 42 commentedComment #11
xiukun.zhou CreditAttribution: xiukun.zhou commentedThanks