You are here

function context_reaction_debug::execute in Context 6

Same name and namespace in other branches
  1. 6.3 plugins/context_reaction_debug.inc \context_reaction_debug::execute()
  2. 7.3 plugins/context_reaction_debug.inc \context_reaction_debug::execute()

Output a list of active contexts.

File

plugins/context_reaction_debug.inc, line 18

Class

context_reaction_debug
Output context debug information.

Code

function execute() {
  $contexts = context_active_contexts();
  foreach ($contexts as $context) {
    if (!empty($context->reactions['debug'])) {
      if (user_access('administer site configuration') && module_exists('context_ui')) {
        $name = l($context->name, "admin/build/context/list/{$context->name}", array(
          'query' => 'destination=' . $_GET['q'],
        ));
      }
      else {
        $name = check_plain($context->name);
      }
      drupal_set_message(t("Active context: !name", array(
        '!name' => $name,
      )));
    }
  }
}