function context_load in Context 6.3
Same name and namespace in other branches
- 7.3 context.module \context_load()
Context loader.
Parameters
$name: The name for this context object.
Return value
Returns a fully-loaded context definition.
4 calls to context_load()
- context_condition::get_contexts in plugins/
context_condition.inc - Retrieve all contexts with the condition value provided.
- context_context_list in ./
context.module - CTools list callback for bulk export.
- context_enabled_contexts in ./
context.module - Wrapper around context_load() that only returns enabled contexts.
- context_save in ./
context.module - Inserts or updates a context object into the database. @TODO: should probably return the new cid on success -- make sure this doesn't break any checks elsewhere.
File
- ./
context.module, line 191
Code
function context_load($name = NULL, $reset = FALSE) {
ctools_include('export');
static $contexts;
static $altered;
if (!isset($contexts) || $reset) {
$contexts = $altered = array();
if (!$reset && ($contexts = context_cache_get('context'))) {
// Nothing here.
}
else {
if ($reset) {
ctools_export_load_object_reset('context');
}
$contexts = ctools_export_load_object('context', 'all');
context_cache_set('context', $contexts);
}
}
if (isset($name)) {
// Allow other modules to alter the value just before it's returned.
if (isset($contexts[$name]) && !isset($altered[$name])) {
$altered[$name] = TRUE;
drupal_alter('context_load', $contexts[$name]);
}
return isset($contexts[$name]) ? $contexts[$name] : FALSE;
}
return $contexts;
}