function context_condition::get_contexts

cis7 context_condition.inc context_condition::get_contexts($value = NULL)
cle7 context_condition.inc context_condition::get_contexts($value = NULL)
elmsmedia7 context_condition.inc context_condition::get_contexts($value = NULL)
icor7 context_condition.inc context_condition::get_contexts($value = NULL)
meedjum_blog7 context_condition.inc context_condition::get_contexts($value = NULL)
mooc7 context_condition.inc context_condition::get_contexts($value = NULL)

Retrieve all contexts with the condition value provided.

15 calls to context_condition::get_contexts()
context_condition_book::execute in sites/all/modules/ulmus/context/plugins/context_condition_book.inc
context_condition_context_all::execute in sites/all/modules/ulmus/context/plugins/context_condition_context_all.inc
Execute.
context_condition_language::execute in sites/all/modules/ulmus/context/plugins/context_condition_language.inc
context_condition_menu::execute in sites/all/modules/ulmus/context/plugins/context_condition_menu.inc
Override of execute().
context_condition_node::execute in sites/all/modules/ulmus/context/plugins/context_condition_node.inc

... See full list

1 method overrides context_condition::get_contexts()
context_condition_context::get_contexts in sites/all/modules/ulmus/context/plugins/context_condition_context.inc
Retrieve all context conditions.

File

sites/all/modules/ulmus/context/plugins/context_condition.inc, line 159

Class

context_condition
Base class for a context condition.

Code

function get_contexts($value = NULL) {
  $map = context_condition_map();
  $map = isset($map[$this->plugin]) ? $map[$this->plugin] : array();

  $contexts = array();
  if (isset($value) && (is_string($value) || is_numeric($value))) {
    if (isset($map[$value]) && is_array($map[$value])) {
      foreach ($map[$value] as $name) {
        if (!isset($contexts[$name])) {
          $context = context_load($name);
          $contexts[$context->name] = $context;
        }
      }
    }
  }
  else {
    foreach ($map as $submap) {
      foreach ($submap as $name) {
        if (!isset($contexts[$name])) {
          $context = context_load($name);
          $contexts[$context->name] = $context;
        }
      }
    }
  }
  return $contexts;
}