Steps to reproduce:
On a site with 2 or more languages enabled... (for the example I'll use EN and IE as the two languages)
1) Create a new block
- set the language to IE
- set the title to 'IE block'
- set the content to 'ie test content'
1) Create another new block
- set the language to EN
- set the title to 'EN block'
- set the content to 'en test content'
3) Position both blocks on the same page using the standard blocks interface (not context).
- Visit the page at /ie/test-page and verify that only the IE block shows
- Visit the page at /en/test-page and verify that only the EN block shows
(This is correct behaviour)
4) Remove the blocks
5) Create a new context and use it to place both of the blocks in a region.
- Visit the page at /ie/test-page:
now, you will see both blocks, but only the IE block has a title
- Visit the page at /en/test-page:
again, you will see both blocks, but only the EN block has a title this time.
I managed to trace the problem to this section of code in context.core.inc in context_block_list()
// It's possible that there are still some leftover blocks in the enabled contexts.
// Add these in as well.
if (!empty($context_blocks)) {
foreach ($context_blocks as $block) {
$block = (object) $block;
$block->status = 1;
$block->enabled = TRUE;
$block->page_match = TRUE;
$block->throttle = FALSE;
$block->title = '';
$blocks[$block->region]["{$block->module}_{$block->delta}"] = $block;
}
}
Remove that chunk of code and the language sensitive blocks function perfectly (as per serp 3 above).
So, why is that chunk of code there? And, if it is really needed, how can we make it not screw up the language sensitive blocks like it does currently?
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 657710-context_respect-i18nblocks.patch | 6.48 KB | afox |
| #12 | block-settings.png | 174.46 KB | jbomb |
| #12 | context.png | 154.17 KB | jbomb |
| #2 | 657710-context-respect-block-language.patch | 931 bytes | mrfelton |
Comments
Comment #1
pasqualle#402150: Conflict with i18n block translation: Context defined blocks don't show up
#632322: Context language condition support
Comment #2
mrfelton commentedAttached is a patch that removes the offending code for those affected. Perhaps not a final solution, but it's been working perfectly for me, though there may be some use case that I am unaware of that requires this additional code.
Comment #3
mrfelton commentedComment #4
kle commentedsubscribing
Comment #5
kle commentedOK - Context doesn't recognize the blocks language setting in a proper way...
My workaround: Instead of using these settings I set the Block to Language neutral and add some PHP in the Show-Block section:
"de" <-> german ...
Works like expected...
Comment #6
svendecabooterPatch in #2 works perfectly on multiple testing sites.
I applied it together with the patch in http://drupal.org/node/457512#comment-2352474 to fix the registry_alter conflict between context & i18nblocks module.
Comment #7
steven jones commentedLooks like this got fixed in the i18nblocks module: #457512: i18n blocks creates conflicts with themes and modules that override the theme_blocks function.
Comment #8
NaX commentedI am currently working on a site with 6 languages and I have just run into this same problem and the #2 patch seem to work for me.
I am going to do more testing to confirm.
I am running i18n 6.x-1.5 and Context 6.x-2.0.
From what I can tell the bug mentioned in #7 only solved part of the problem (committed since i18n 6.x-1.4 release).
Can anybody confirm if the code suggested for removal is required for anything.
Comment #9
danny_joris commented#2 nor #5 is working for me using 6.x-3.0. Odd.
I really wonder why it wouldn't work for me. Any ideas?
Comment #10
jax commentedpatch in #2 is currently working for me but that code is there for a reason
Update: I created a new views block and added it through context but it didn't show up. Resetting the code made it show up. So the patch no longer works for me.
The same issue exists with #934484: Respect domain_blocks settings.
Comment #11
jmseigneur commentedSubscribing
Comment #12
jbomb commentedI am experiencing the same problem with block visibility settings and context. I've included a description of my installation below
The block reactions for the my sitewide context will always display all blocks regardless of the visibility settings set within the block administrator. This is easily reproduced by adding a block that should not be displayed on any page to a context.
Comment #13
jbomb commentedLooks like the issue that I described here was considered "by design" in #550934: Block visibility by role is not respected.. Reverting to previous title and version.
Comment #14
steven jones commentedComment #15
wanjee commentedsubscribing
Comment #16
BarisW commentedSubscribing, this is a must-have for context..
Comment #17
botrisSubscribing.
Right now I have many contexts, discovering menu are shown for each language, forces me to copy each context for each language. A lot off work...
Comment #18
hedac commentedI'm having the same problem... i18nblocks options not being respected.
i18nblocks 6.x-1.9 context 6.x-3.0
Comment #19
steinmb commentedAlso see this odd behavior. Have not had time to dwell deeply into the issue yet, but still there. Bumping this up do latest 6.x code version, 2.x is dead.
Comment #20
thomas.feichter commentedsubscribing
Comment #21
afox commentedThis issue would be better dealt in a separate module, like http://drupal.org/project/context_respect. Context Respect already enables context to respect other block settings, so that would be a more logical place for this issue also.
Issue #1108566: Extend to support i18nblocks was already created for it. Marking that issue as duplicate and transferring this one to the context respect queue as this issue is older.
Comment #22
afox commentedWell, it was actually quite easy with Context respect. Here's a patch which includes the i18nblocks support and a little modification to make future implementations easier. Initial testing made on couple sites and seems to work.
Comment #23
kevinquillen commentedI want to get this patch into dev for testing, but I am having trouble getting ahold of the 6.x-1.x branch. It might not even exist. I'll need to figure that out then I can get this patch in to be tested.
Comment #24
steinmb commentedgit -r list all remote branches, and no it's not there though git ls-remote show the tags list so you prob. could checkout by using the ver 6.x-1.1 sha key.
Comment #25
kevinquillen commentedI think I got it. Check the new dev version later it should have the changes in it.
Comment #26
kevinquillen commentedYeah, looks like the dev updated.
Comment #27
gagarine commentedI opened the same bug in i18n for D7 #1838610: Menu block language visibility do not work with context
Comment #28
frobIs this still an issue with the latest dev applied?
Comment #29
kevinquillen commented