Hi,

i've added several context's to display differnt blocks per context. but i need an option to set a default context to show a default block, which should only be shown if no other context is present...any ideas?

regards

Comments

yhahn’s picture

Assigned: Unassigned » yhahn
Status: Active » Postponed

This is a really interesting request... I don't have any good ideas for incorporating this right now but I'll keep it in the back of my head for the future...

steven jones’s picture

This is possible with context, if you add a context into your namespace and make it a 'sitewide context', but make context evaluate it first, then it will be a default context. If you give it the value of say: 'a_default_context' then it will get sorted to the top and evaluated first.

This is a bit of a hacky way to do this.

benleivian’s picture

I'd like to add my vote for having a default context as well. It would do wonders for the current site i'm developing. I will give Steven Jones' idea a try. Thanks.

a_c_m’s picture

Can confirm the hack/work around works, but dont try to be too clever '_context_name' doesn't seem to work as expected, where as 'a_context_name' does.

steven jones’s picture

Title: Default context » Rename 'Sitewide' context to 'Sitewide/default' context
Version: 6.x-2.0-beta1 » 6.x-2.0-beta7
Assigned: yhahn » Unassigned
Status: Postponed » Active
Issue tags: +context-2.x-rc-blocker

Maybe we just need to rename the sitewide context to indicate it can be used as a default context. Also need to add some documentation of how to do things like this.

steven jones’s picture

Component: Code » Documentation

Decided that I'm not going to rename the context, but will need to add some documentation about 'default' contexts.

steven jones’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

TwoMice’s picture

Status: Closed (fixed) » Postponed

Maybe the OP would disagree, but I think the fix here doesn't match the use case. OP said: "to set a default context to show a default block, which should only be shown if no other context is present". The solution provided in #2 shows the blocks in the sitewide context on all paths, it doesn't account for the "only show if no other context is present" part: it's truly sitewide, regardless of any other contexts that apply.

TwoMice’s picture

Status: Postponed » Fixed

Okay, sorry about that. I was unaware of the very cool context exclusion conditions explained here: http://drupal.org/node/813954#comment-3267016

TwoMice’s picture

Status: Fixed » Closed (fixed)