| 6 context.module | context_load($name = NULL, $reset = FALSE) |
| 7 context.module | context_load($name = NULL, $reset = FALSE) |
Context loader.
$name: The name for this context object.
Returns a fully-loaded context definition.
<?php
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;
}
?>