Quantcast
Channel: EchoDitto Labs - Today I Learned...
Viewing all articles
Browse latest Browse all 20

Set Sitewide Default Context in Drupal

$
0
0

In Context 3 they removed the sitewide default context, that is, the context that can be set to be enabled when no other context is active. The sitewide context, which is enabled at all times, is still available.

But, in its place, Dev Seed has added a very powerful feature, sneakily powerful, in fact.

You can set a context to be active using another context. Seeming kind of meh? Well, read on. You will soon see, young apprentice, just as I did just earlier today.

First, name all the contexts you DON'T want this context to coincide with in a regularized way, like

myspecialname_normalcontextname1
myspecialname_normalcontextname2

Make sure the sitewide context that is prepackaged in Context module is enabled. It is enabled by default.

Next, create a context that does not start with myspecialname_. This will be your default context.

Set up the "Context" condition:
set default sitewide context

And here is the secret sauce, have it appear wherever the sitewide context appears, except where your specialname contexts appear. And yes, that thing in red is a tilde, which took me finding this thread to discover.
set default sitewide context

Using this recipe I am sure you can come up with all manner of ways to set contexts.

I have a few more context tricks I can document. Would that be useful? Comment and I'll write another post.


Viewing all articles
Browse latest Browse all 20