Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have 2 Contexts set up that each place a block in the same region.

There are times when both these contexts will happen at the same time and as such both blocks appear together.

Currently when both appear they are not in the order I require, is there a way of weighting these across contexts? I know the weighting works within a context however this is not what I need at this point.

Currently using: Drupal 6.22, Context 6.x-3.0

UPDATE:

Hi All,

This post appears to get quite of interest but I'm afraid I don't use Drupal anymore or have any time (or sites) to check these answers. If any answer gets enough interest and appear to be right then I'll happily mark it correct but I can't actually verify anything.

share|improve this question
add comment

4 Answers

This patch worked for me. Enable the patch at admin/build/context/settings.

There is a lot that gets discussed after that comment and one contributor even created a module. I haven't read much of the other comments, implemented the module nor any of the patches posted after the one I referred to above.

share|improve this answer
add comment

There's still no definitive solution for this problem, you might have a look at Block weights when multiple contexts are set or maybe context_respect. You can also have a look at Way to Weight Blocks that Show From Multiple Contexts for some background information.

One work-around is to export all your context to code (using features) and edit the weight inside the created code files, the only problem is that if you re-export your feature, your manual changes will be reverted. We use this approach for the moment because it fits in our workflow.

share|improve this answer
add comment

The weight context assign to a block is a number, that will effect the position of all the blocks that any context will add to any region. There isn't an UI to tweak these weights to mix blocks from several contexts, but there is a way around it.

The easiest solution I could find, was to run some custom JavaScript in a browser console:

 $(".form-item").show()

This will show all the weights that control the sorting. Tweaking these would allow you to sort the blocks like you want.

share|improve this answer
add comment

You can edit (carefully) the serialised values in the context table through phpMyAdmin. This has to be done again every time the context is edited through the UI. But it's not a bad solution which avoids the overhead of installing extra modules to solve this.

share|improve this answer
    
The reason I suggested this was a failure to get anywhere with some of the suggestions above: (1) I didn't like the idea of patching Context, as that opens up a maintenance liability. (2) context_respect seemed not to affect weights - only block visibility. (3) Implementing Features is a much more admin-intensive solution than the occasional phpMyAdmin tweak - if Features is not currently part of the workflow. So I felt that my solution, while clearly not perfect, may be worth considering alongside the other options. –  Mark Nielsen Feb 15 '13 at 16:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.