You are here

function context_load in Context 7.3

Same name and namespace in other branches
  1. 6.3 context.module \context_load()

Context loader.

Parameters

$name: The name for this context object.

Return value

Returns a fully-loaded context definition.

7 calls to context_load()
context_condition::get_contexts in plugins/context_condition.inc
Retrieve all contexts with the condition value provided.
context_condition_context::get_contexts in plugins/context_condition_context.inc
Retrieve all context conditions.
context_condition_context_all::get_contexts in plugins/context_condition_context_all.inc
Retrieve all context conditions.
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.

... See full list

File

./context.module, line 274

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;
}