function context_active_values in Context 6.2
Same name and namespace in other branches
- 6 context.module \context_active_values()
Builds an array of values based on the current active contexts and group by conditions/reactions.
Parameters
$type: The condition or reaction type to pull values for.
$reset: Boolean value for resetting the static cache.
Return value
Returns a keyed array of reactions and values.
8 calls to context_active_values()
- context_blocks in ./
context.core.inc - This override of theme_blocks() is called because of an alter of the theme registry. See context_theme_registry_alter().
- context_block_list in ./
context.core.inc - An alternative version of block_list() that provides any context enabled blocks.
- context_links in ./
context.core.inc - Generates an array of links (suitable for use with theme_links) to the node forms of types associated with current active contexts.
- context_menu_navigation_links in ./
context.core.inc - Wrapper around menu_navigation_links() that gives themers the option of building navigation links based on an active context trail.
- context_menu_set_active in ./
context.core.inc - Iterates through a provided links array for use with theme_links() (e.g. from menu_primary_links()) and provides an active class for any items that have a path that matches an active context.
File
- ./
context.module, line 510
Code
function context_active_values($type = NULL, $reset = FALSE) {
static $value_map;
if (!isset($value_map) || $reset) {
$value_map = array();
$keys = array_keys(context_reactions() + context_conditions());
$keys[] = 'block';
foreach ($keys as $key) {
foreach (context_active_contexts() as $identifier => $context) {
if (!empty($context->{$key})) {
if (!isset($value_map[$key])) {
$value_map[$key] = array();
}
if (is_array($context->{$key})) {
$value_map[$key] = array_merge($value_map[$key], $context->{$key});
}
else {
$value_map[$key][] = $context->{$key};
}
}
}
}
}
if (!empty($type)) {
return !empty($value_map[$type]) ? $value_map[$type] : array();
}
return $value_map;
}