Skip to content

Instantly share code, notes, and snippets.

@matiskay
Created September 3, 2012 14:16
Show Gist options
  • Save matiskay/3609626 to your computer and use it in GitHub Desktop.
Save matiskay/3609626 to your computer and use it in GitHub Desktop.
Trigger a Drupal Context programatically
It's not immediately clear from the context_set() function how to trigger a context to be "active" using code. Do it like this:
Source: http://snipplr.com/view/58723/trigger-a-drupal-context-programatically/
<?php
$context = context_load('context_name');
context_set('context', $context->name, $context);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment