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


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.

5 Answers 5


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.


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.


I just fixed this for myself (while using version 7.x-3.x), using hook_context_load_alter(). Basically, you can implement this in your own misc module, print out what you're getting with dpm(), and then adjust as needed. Here's what I ended up doing:

 * Implements hook_context_load_alter().
function example_misc_context_load_alter(&$context) {
  // We need to make sure that the mobile section menu is printed before these menus,
  // so we set the weights to -9 here so they appear after it.
  if ($context->name == 'about') {
    $context->reactions['block']['blocks']['menu_block-15']['weight'] = -9;
  if ($context->name == 'traveler') {
    $context->reactions['block']['blocks']['menu_block-1']['weight'] = -9;
  • There is more then one way to fix this. John's solution is the most correct and certainly the cleanest. Documentation on hook_context_load_alter is here: drupalcontrib.org/api/drupal/…
    – sea26.2
    Jul 24, 2014 at 17:59

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:


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


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.

  • 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. Feb 15, 2013 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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