I have contexts that happen to both be set on certain pages on the site. The first context enables about 7 blocks, the other enables 1 block. On the shared pages, the 1 block shows in the middle of the seven. Is there a way to weight contexts so the blocks show up ordered?

CommentFileSizeAuthor
#14 context-editor.png314.46 KBstevenmhouse
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Steven Jones’s picture

Category: feature » support

Contexts are ordered alphabetically and blocks should be being ordered by weight, export your contexts to see the explicit weights of the blocks.

mstef’s picture

And that the weights are changed via the regular block admin interface, because there's no way to weight them across multiple contexts?

Steven Jones’s picture

Status: Active » Fixed

Use the weights in exported contexts. There is no UI to do this.

mstef’s picture

OK - Thanks. Might make things annoying when I continue to rebuild/update the feature.

Steven Jones’s picture

In context 3.x you layout the page 'live' so this isn't really an issue in the latest versions of context.

mstef’s picture

Yea I've been meaning to try.

Any idea when 3.x will have a stable release?

Status: Fixed » Closed (fixed)

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

aufumy’s picture

Version: 6.x-2.0-rc3 » 6.x-3.0-beta5
Status: Closed (fixed) » Active

I am using context 3, beta5.

A block I added through /admin/build/block is displaying above the blocks for a context. How can I re-order them?

I am not sure where I can go to layout the page 'live'.

aufumy’s picture

Status: Active » Closed (fixed)

I ended up excluding the default context block using:
<?php return !count(context_get());?>
from http://drupal.org/node/813954#comment-3043934

And adding the block back in for the particular context, so that it can be re-ordered through the context page.

seanr’s picture

Just found this - truly awesome.

MattBrigade’s picture

I know this thread is closed, by I thought I would post my workaround in hopes that it might benefit someone. I got around this problem by altering block weights programatically using hook_context_load_alter() (hook defined in the Context API). I set up a small custom module named "context_mods" and called hook_context_load_alter() to change the block weights as needed.

Here's an example from my project (defined in "/sites/all/modules/custom/context_mods/context_mods.module"):

/**
 * Implementation of hook_context_load_alter()
 */
function context_mods_context_load_alter(&$context) {
  // If Context "user_admin" is loaded,
  // change weight of the "Site Admin Menu" block (block id "menu-menu-site-admin")
  } if($context->name == 'user_admin') {
    $context->reactions['block']['blocks']['menu-menu-site-admin']['weight'] = -99;
  }
}
SocialNicheGuru’s picture

waldbeek’s picture

stevenmhouse’s picture

FileSize
314.46 KB

After reviewing I'd recommend trying this first! I have the 'admin' module installed that provides a lot of ease of access, including to 'Context editor'. I'm using Context 3 and Context Editor is included in Context UI, which comes with Context but is a separate module. Here's how I accomplished what this thread is about.

1. Open the Admin bar via the wrench logo.
2. Click on 'Context editor'
3. Click on the 'edit' button next to the context that you want to alter the block placement for
4. At this point the other context's blocks are greyed out to focus on the blocks provided by the current context.
5. Hover over the block you want to move and an moving icon appears on the upper right corner.
6. Click on this icon and drag to desired place.
7. Click on 'Done' in the Admin bar.
8. Done! SUPER EASY - and also has a bunch of other cool context features

Enjoy!

doublejosh’s picture

That's not the question. It's about blocks across multiple contexts.

Pasqualle’s picture

Version: 6.x-3.0-beta5 » 6.x-3.0
Component: User interface » Documentation
Category: support » task
Status: Closed (fixed) » Active

block placement works across multiple contexts.
really cool feature!
please someone create a handbook page for this

doublejosh’s picture

Maybe we're talking about a difference between D6 and D7? Can't seem to do it in 6... if I'm just missing it, then +1 for a handbook! :)

Oliver Huynh’s picture

Status: Active » Fixed

#14 correctly fixed the issue.

wonder95’s picture

I have Admin module installed with Context 6.x-3.0, but for some reason the Context Editor block doesn't show up when I'm on the Context page, and when it does show up, it only shows one of my four contexts. Is there something I have to do to make it show up with all contexts?

wonder95’s picture

Here's another thing I tried. I have a context that just has one block in a sidebar (and shows up based on another context) I exported the content, modified the weight for the block and re-imported, but the block weight remains unchanged for some reason. Should that change it?

Status: Fixed » Closed (fixed)

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

franz’s picture

Status: Closed (fixed) » Active

How come the need for an additional module to do such a simple thing can be considered "fixed" ?

hefox’s picture

Status: Active » Closed (duplicate)
Prine’s picture

Thank you mattbrigade.

#11 did it for me.

thedavidmeister’s picture

#1 did it for me, although I did have to make sure to revert my contexts and clear my cache.

I can confirm that #14 is a feature that is relatively easy to set up with admin however #14 failed to mention that you have to turn the block on in the admin tools settings before it will appear in the wrench menu.

jalake’s picture

Sorry for bringing this back from the grave, however when I export a context, edit and then import (either deleting the old context or allowing overwrite) my adjusted weight always gets reset, as Context wants me to save after import.

Am I missing the point of the export? Should I be placing the export code somewhere else instead of editing and importing?

thedavidmeister’s picture

You adjust the weight in the code created by Features. I did this like two days ago and it worked fine for me.

When we're talking about exporting a context in this thread we're implying an export through the Features module, not through an import/export UI.

Context will read the code in the Feature and pull the weight from there as long as you don't override it in your database. Using an import/export UI will import the context straight into the database, from where it behaves exactly as any other context would and so the weights will be recalculated.

The important step, whether re-arranging your blocks through the context editor or directly in the Feature itself is to make sure that whatever is in your Feature represents what you want happening in your site.

info@cgfix.com’s picture

I think the solution is in each context above the blocks in the region, click on the arrange icon to expose the each block weight drop down. set these to interact with all blocks in that region even other contexts or regular blocks.

general_ludd’s picture

I know this is closed, but someone like me is bound to come across this and assume the problem still exists. It is solved with the context editor. It is built-in to the context UI.