function context_condition::get_contexts in Context 6.3
Same name and namespace in other branches
- 6 plugins/context_condition.inc \context_condition::get_contexts()
- 7.3 plugins/context_condition.inc \context_condition::get_contexts()
Retrieve all contexts with the condition value provided.
11 calls to context_condition::get_contexts()
- context_condition_book::execute in plugins/
context_condition_book.inc - context_condition_context::execute in plugins/
context_condition_context.inc - Execute.
- context_condition_language::execute in plugins/
context_condition_language.inc - context_condition_menu::execute in plugins/
context_condition_menu.inc - Override of execute().
- context_condition_node::execute in plugins/
context_condition_node.inc
File
- 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;
}