You are here

function context_condition_met in Context 6.3

Same name and namespace in other branches
  1. 7.3 context.module \context_condition_met()

Queue or activate contexts that have met the specified condition.

Parameters

$context: The context object to queue or activate.

$condition: String. Name for the condition that has been met.

$reset: Reset flag for the queue static cache.

1 call to context_condition_met()
context_condition::condition_met in plugins/context_condition.inc
Marks a context as having met this particular condition.

File

./context.module, line 348

Code

function context_condition_met($context, $condition, $reset = FALSE) {
  static $queue;
  if (!isset($queue) || $reset) {
    $queue = array();
  }
  if (!context_isset('context', $context->name)) {

    // Context is using AND mode. Queue it.
    if (isset($context->condition_mode) && $context->condition_mode == CONTEXT_CONDITION_MODE_AND) {
      $queue[$context->name][$condition] = $condition;

      // If all conditions have been met. set the context.
      if (!array_diff(array_keys($context->conditions), $queue[$context->name])) {
        context_set('context', $context->name, $context);
      }
    }
    else {
      context_set('context', $context->name, $context);
    }
  }
}