drupal context

Context Weights

Déja Augustine's picture

The context module is great, but it's lacking one distinct feature: weighting. There's no way to explicitly determine which order the contexts are evaluated in.

This leaves us to rely on a little known, implicit ordering system: alphabetical by context name.

As of version 6.x-3.0-beta5, the context module evaluates contexts in the order they appear on the admin panel. Using ordering prefixes can help to control the order. For example, if we have three contexts that apply to a particular path:

One
Two
Three

they would show up on the admin list as

One
Three
Two

and be evaluated in that order. In order to control the order, one solution might be to do:

a_One
b_Two
c_Three

Making use of this "feature" is obnoxious at best, obfuscative at worst, but it's what we have out of the box.