function context_ui_defaults in Context 5
Invokes hook_context_define() to collect all contexts provided in code by modules.
Parameters
$space: An optional string namespace identifier. If provided, only context definitions with the specified namespace will be returned.
Return value
An array of context objects.
1 call to context_ui_defaults()
- context_ui_rebuild in context_ui/
context_ui_admin.inc - Cache system contexts
File
- context_ui/
context_ui.module, line 328
Code
function context_ui_defaults($namespace = null) {
static $contexts, $namespaces;
if (!$contexts) {
$contexts = array();
foreach (module_implements('context_define') as $module) {
$function = $module . '_context_define';
$contexts = array_merge($contexts, $function());
}
foreach ($contexts as $key => $context) {
$context = (object) $context;
$contexts[$key] = $context;
$namespaces[$context->namespace][] = $context;
}
}
if ($namespace) {
if (isset($namespaces[$namespace])) {
return $namespaces[$namespace];
}
else {
return array();
}
}
return $contexts;
}