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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

almc’s picture

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

almc’s picture

Title: nice menu to regular menu until emptying cache » Nice Menus don't work correctly with block cache
Version: 7.x-2.1 » 7.x-2.5
Issue summary: View changes
Priority: Normal » Major

Commented more in the issue thread below. - almc

almc’s picture

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

hosef’s picture

Status: Active » Needs review
FileSize
747 bytes

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

Status: Needs review » Needs work

The last submitted patch, 4: fix-block-caching-of-nice-menus-1925816-4.patch, failed testing.

oadaeh’s picture

This 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

oadaeh’s picture

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

hosef’s picture

Status: Needs work » Needs review
FileSize
828 bytes

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

oadaeh’s picture

Status: Needs review » Reviewed & tested by the community

  • xiukun.zhou committed e7c4676 on 7.x-2.x authored by hosef
    Issue #1925816 by hosef: Nice Menus don't work correctly with block...
xiukun.zhou’s picture

Status: Reviewed & tested by the community » Fixed

Thanks

Status: Fixed » Closed (fixed)

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