Context

Context allows you to manage contextual conditions and reactions for different portions of your site. You can think of each context as representing a "section" of your site. For each context, you can choose the conditions that trigger this context to be active and choose different aspects of Drupal that should react to this active context.

Think of conditions as a set of rules that are checked during page load to see what context is active. Any reactions that are associated with active contexts are then fired.

An example of a condition could be when viewing a certain node type and blocks should be placed as a reaction when viewing a page with this node type.

Included modules

  • Context UI provides an administrative interface for managing and editing Contexts. It is not necessary for the proper functioning of contexts once they are built and can be turned off on most production sites.

Drupal 8

The Drupal 8 version is a port of the Drupal 7 version.

Drupal 8 version of this module uses the built in condition plugins supplied by Drupal through the Plugin API. So any conditional plugins supplied by other modules can also be used with Context.

Reactions are also defined through the new Drupal 8 Plugin API. The context module defines a plugin type named ContextReaction that you can extend when creating your own plugins.

Modules which extend functionality of Context:

Drupal 7

The inline editor

Drupal 7 version of module includes inline editor which is activated via a "Configure Layout" contextual link on blocks that appear on the page. Note that the inline editor must be enabled in the main context settings for this link to appear.

Other included modules

  • Context layouts provides a formalized way for themes to declare and switch between page templates using Context. It is a continuation of an old Drupal themer's trick to switch to something besides the standard page.tpl.php file for a variety of special case pages like the site frontpage, login page, admin section, etc.

Dependencies

Thanks

  • Contributors: dmitrig01 (Dmitri Gaskin), Pasqualle (Bálint Csuthy), alex_b (Alex Barth), yhahn (Young Hahn), jmiccolis (Jeff Miccolis)
  • Maintainers: febbraro (Frank Febbraro), Steven Jones, tekante (Chris Johnson), boshtian (Bostjan Kovac)
  • Sponsored by Phase2 Technology & Development Seed
Supporting organizations: 
Drupal 8 maintenance and development
Drupal 7 maintenance and development
Drupal 8 maintenance and development

Project information

Releases