You are here

function context_reaction_disable_context::execute in Context Disable Context 6

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

File

plugins/context_reaction_disable_context.inc, line 39

Class

context_reaction_disable_context
Expose themes as context reactions.

Code

function execute() {
  $contexts = $this
    ->get_contexts();
  $processed = array();
  foreach ($contexts as $context) {
    $values = $this
      ->fetch_from_context($context);
    foreach ($values['disabled'] as $disable) {
      if (context_isset('context', $disable) && !in_array($disable, $processed)) {
        context_set('context', $disable, FALSE);
      }
    }

    // Add the current context to $processed so it is not removed by other contexts
    $processed[] = $context->name;
  }
}