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 created a context with "sitewide context" condition always active. On reaction I added "menu" and selected an item from the main menu. I also added a block to the main content region to verify the context is really active.
When visiting any page the block is shown but my main menu item is not active.
Comment | File | Size | Author |
---|---|---|---|
#24 | context_i18n_menu-active-path.patch | 624 bytes | tcmug |
#23 | context_i18n_menu-1124544-23.patch | 1019 bytes | tcmug |
#19 | context-insert page preprocess after i18n_menu-1124544-19.patch | 1.1 KB | joostpluijmers |
#10 | i18n_conflict-1124544-9.patch | 884 bytes | idflood |
#8 | i18n_conflict-1124544-8.patch | 980 bytes | wapnik |
Comments
Comment #1
idflood CreditAttribution: idflood commentedIt seems this is coming from a conflict with i18n. I'm not sure where the issue really is and by which module it must be handled.
Here is how to reproduce:
1. create a context with a menu reaction, with a sitewide context condition ( this should be working )
2. add i18n and variable ( dependency ) then enable "internationalization" and "Menu translation" modules
3. refresh, the menu is not set as active
Comment #2
idflood CreditAttribution: idflood commentedComment #3
luckystrikerin CreditAttribution: luckystrikerin commentedsubscribing
Comment #4
idflood CreditAttribution: idflood commentedI investigated a bit this issue. The execute function in context_reaction_menu.inc is triggered and change the active trail as expected. In fact it seems the menu links are redefined in i18n_menu.module ( in i18n_menu_preprocess_page ). Adding a return a the top of this function fix the context issue.
Digging deeper into the issue it seems I've found a hackish way of fixing the issue. In the file i18n_menu.module, change the end of i18n_menu_navigation_links function like this
I hope there is a better way to fix the issue, i18n module shouldn't have to worry about context and other modules. Here is a related issue in i18n about it #1139722: context conflict - Menu are recreated in i18n_menu_preprocess_page even if they were already defined
Comment #5
anthonyR CreditAttribution: anthonyR commentedsubscribe
Comment #6
wapnik CreditAttribution: wapnik commentedBoth context and i18n_menu are changing menu items by implementing hook_preprocess_page(). So the problem is about the order of execution. Changing module weights doesn't help because context is altering the theme registry to always hook right after template_preprocess_page() (see context_theme_registry_alter()). Now which module's weight should be changed and how? I think this is a question which maintainers of both modules have to decide.
Comment #7
idflood CreditAttribution: idflood commentedMaybe you can have a look at the patch i posted there http://drupal.org/node/1139722#comment-4494374 . It may be another way of fixing this.
I think i18n must be called after context since context can completely change the menu displayed. so the proposed patch alter the current variables instead of recreating them.
Comment #8
wapnik CreditAttribution: wapnik commentedIn #1139722: context conflict - Menu are recreated in i18n_menu_preprocess_page even if they were already defined the maintainer of i18n suggested that a context patch would be more efficient, here is the first try.
Comment #9
hctomThis patch in #8 works like a charm and the problems are gone! THanx a lot for this fix!
Cheers
hctom
Comment #10
idflood CreditAttribution: idflood commentedhmm, I've tested the patch in #8 and it didn't work for me. I will test again later and see if it pass the test I've created in http://drupal.org/files/issues/context_conflict-1139722-6.patch
I've manually corrected the path in the patch proposed in #8 since it wasn't applying (was pointing to /modules/contrib/context/context.core.inc instead of just /context.core.inc. (following the procedure described in http://drupal.org/project/context/git-instructions )
Comment #11
febbraro CreditAttribution: febbraro commentedOne of the problems with this is that context needs to preprocess the page early on, that is why it is splicing right into the preprocess stack immediately after template_preprocess_page, this patch however is now putting it after i18n_menu, which could be just about anywhere in the preprocess stack. This also does not handle the case where i18n_preprocess_page is not in the stack (if they change their implementation then this will stop working entirely)
Comment #12
hctomOkay.. how about this approach?
Cheers
hctom
Comment #13
hctomComment #14
ANDiTKO CreditAttribution: ANDiTKO commented#12 Works perfectly. Apply it and clear your cache.
Comment #15
stmh CreditAttribution: stmh commented#12 works on my side, too.
Comment #16
serg.remote CreditAttribution: serg.remote commentedNeither #10 nor #12 work for me (i18n-6.x-1.10, i18nmenu_node-6.x-1.2).
#4 works
Comment #17
leenyx CreditAttribution: leenyx commentedSerg.remote, this post if for D7.
I have the same problem for D6...I have applied the solutions here [http://drupal.org/node/586396] with no luck, any ideas?
Comment #18
Jason Dean CreditAttribution: Jason Dean commented#12 works great for me :)
Comment #19
joostpluijmers CreditAttribution: joostpluijmers commentedI took the liberty of creating a patch to hctom's solution in #12. I created it against the 7.x-3.x branch. I do hope this makes it to the 3.0 release!
Comment #20
nodestroy CreditAttribution: nodestroy commentedactually the changes from #12 are working. that means, the context action now does what it is supposed to do.
But, the i18n_menu functionality is kind of broken, there are german menu items on english pages and english menu items on german pages.
Comment #21
tcmug CreditAttribution: tcmug commentedI can confirm that the patch #12 causes all kind of weird shit to happen. So much so that I actually thought I'm losing my mind.
Comment #22
tcmug CreditAttribution: tcmug commentedIt appears that this is caused by the following part (between >>> and <<<) in plugins/context_reaction_menu.inc:
So, removing those lines leaves the i18n_menu translations intact and the menu works just fine (atleast in our setup).
Maybe that part just needs to be patched so that it does not reset the menu?
Comment #23
tcmug CreditAttribution: tcmug commentedAdding a patch for the above for quicker testing.
Comment #24
tcmug CreditAttribution: tcmug commentedAttached patch AND the #12 patch seems to get this thing working.
Comment #25
luco CreditAttribution: luco commented@tcmug, thank you for your work but it just won't work with me.
I got the latest DEV branch, applied patches from #12 and #24 but it will only work for menu items in English, not in Portuguese.
if you need more details please let me know. thanks in advance.
cheers,
Luciano
Comment #26
tcmug CreditAttribution: tcmug commentedLuciano: I had a look at what other patches we run to the module and found this Fix breadcrumb not working properly with i18n - I'm no expert on how the menus work but worth trying?
Also another difference is that we're using the beta3 version along with menu_block 2.2 to display the menus.
Comment #27
luco CreditAttribution: luco commented@tcmug thanks for the reply. I'll test these options as soon as possible, but right now I have to present a working, well - something - without so much as real content. go figure. :)
Comment #28
guy_schneerson CreditAttribution: guy_schneerson commentedI used both #8 and #24 and it fixed my issue, however I think this issue should be split into two:
Issue 1
"Stop i18n_menu from overriding context menu reactions" for patch #8, This should be committed as it insures the context menu reaction isn't overridden by i18n_menu.
Issue 2
"Make context menu reaction use i18n_menu if it is enabled" for patch #24, this worked for me but as i18n_menu has a number of use cases this may need more testing and is a separate issue from #8
I would handle this by keeping this issue "i18n conflict - Menu reaction doesn't have any effect" for Issue 1 (patch #8) and creating an new one for Issue 2 (patch #24)
Comment #29
tekante CreditAttribution: tekante commentedCommitted 8 and 24 together. Thanks for the bug report and to the various work on the patch(es).
http://drupalcode.org/project/context.git/commit/baacf1593ab42fd63193afa...
Comment #31
luco CreditAttribution: luco commentedI can confirm it works even without Menu Block. :) thank you guys!