You are here

class context_reaction_debug in Context 6

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

Output context debug information.

Hierarchy

Expanded class hierarchy of context_reaction_debug

2 string references to 'context_reaction_debug'
_context_context_plugins in ./context.plugins.inc
Context plugins.
_context_context_registry in ./context.plugins.inc
Context registry.

File

plugins/context_reaction_debug.inc, line 6

View source
class context_reaction_debug extends context_reaction {
  function options_form($context) {
    return array(
      'debug' => array(
        '#type' => 'value',
        '#value' => TRUE,
      ),
    );
  }
  function options_form_submit($values) {
    return array(
      'debug' => 1,
    );
  }

  /**
   * Output a list of active contexts.
   */
  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,
        )));
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
context_reaction::$description property
context_reaction::$plugin property
context_reaction::$title property
context_reaction::fetch_from_context function Retrieve options from the context provided.
context_reaction::get_contexts function Retrieve active contexts that have values for this reaction.
context_reaction::settings_form function Settings form. Provide variable settings for your reaction. 1
context_reaction::__clone function Clone our references when we're being cloned.
context_reaction::__construct function Constructor. Do not override.
context_reaction_debug::execute function Output a list of active contexts.
context_reaction_debug::options_form function Overrides context_reaction::options_form
context_reaction_debug::options_form_submit function Options form submit handler. Overrides context_reaction::options_form_submit