Context code?

Provides a new context condition plugin which allows you to trigger contexts from code. Anywhere you want in code you can trigger a context by calling context_code_trigger(KEY);. To register Context codes conditions, implement hook_context_code().

Use case

I wanted to trigger different contexts based on a simple option field of a Page. So one entity type for multiple contexts. I just implemented hook_entity_view() and checked the value of the field to trigger the correct context. As a reaction I added a body class so different theming could be applied.
This module provides so much flexibility you could counterfeit almost any existing context condition. If you have an interesting use case, let me know. Could be useful to make some cases available by this module.

Dependencies

Required
Context: http://drupal.org/project/context

Sponsors

Module sponsored by Nascom.

Project information

Releases