context_reaction_debug.inc

Go to the documentation of this file.
00001 <?php
00002 
00003 /**
00004  * Output context debug information.
00005  */
00006 class context_reaction_debug extends context_reaction {
00007   function options_form($context) {
00008     return array('debug' => array('#type' => 'value', '#value' => TRUE));
00009   }
00010 
00011   function options_form_submit($values) {
00012     return array('debug' => 1);
00013   }
00014 
00015   /**
00016    * Output a list of active contexts.
00017    */
00018   function execute() {
00019     $contexts = context_active_contexts();
00020     foreach ($contexts as $context) {
00021       if (!empty($context->reactions['debug'])) {
00022         if (user_access('administer site configuration') && module_exists('context_ui')) {
00023           $name = l($context->name, "admin/structure/context/list/{$context->name}", array('query' => array('destination' => $_GET['q'])));
00024         }
00025         else {
00026           $name = check_plain($context->name);
00027         }
00028         drupal_set_message(t("Active context: !name", array('!name' => $name)));
00029       }
00030     }
00031   }
00032 }

Generated on Sat May 25 02:23:39 2013 for Context by  doxygen 1.4.7